Claude Code Essentials¶
The concepts on this page are the difference between "Claude wrote some code" and "Claude is genuinely 2x-ing my output." Understanding context, effort, and delegation is what makes AI-assisted development work at scale.
Context Window¶
Claude Code operates with a 200K token context window by default (1M tokens on Max/Team/Enterprise plans with Opus 4.6 and Sonnet 4.6). As context fills with messages, file contents, and tool outputs, the model's ability to recall earlier information degrades — this is called context rot.
Managing Context¶
| Command | When to Use | What It Does |
|---|---|---|
/clear |
Between unrelated tasks | Completely resets the context window |
/compact |
Long sessions filling up | Summarizes conversation, preserves key decisions, discards redundant content |
/context |
Mid-session check | Shows current token usage |
A fresh session in a monorepo consumes ~20K tokens (10% of capacity). Preserve the remaining ~180K for actual work.
Rule of thumb
Use /clear aggressively between tasks. Don't let context from a frontend task pollute a backend task. When context exceeds 50%, consider /compact.
For practical context strategies, see Tips & Patterns.
Effort Levels & Thinking¶
Control how much reasoning Claude applies using effort levels:
| Level | When to Use |
|---|---|
low |
Simple, mechanical changes |
medium |
Standard development (default) |
high |
Architecture decisions, complex bugs |
max |
Critical architecture, security review (Opus 4.6 only) |
auto |
Reset to model default |
How to Set¶
| Method | Details |
|---|---|
/effort command |
/effort low, /effort high, /effort max |
/model menu |
Interactive — select model and adjust effort with arrow keys |
| Environment variable | CLAUDE_CODE_EFFORT_LEVEL=high |
| Toggle thinking | Option+T (macOS) / Alt+T (Linux/Windows) |
| Max thinking budget | MAX_THINKING_TOKENS env var |
| Always-on thinking | alwaysThinkingEnabled setting |
Example¶
Plan how to add OAuth2 support while maintaining consistency
with our existing session handling. Create a written plan. Don't implement yet.
Higher effort levels consume extra tokens but produce significantly better plans and architectural decisions.
For the full reference, see official docs.
Subagents¶
Subagents run in isolated context, preventing exploration work from polluting your main conversation.
Built-in Subagents¶
| Subagent | Purpose | Invocation |
|---|---|---|
| Explore | Fast, read-only code search and analysis | "Use a subagent to explore..." |
| Plan | Research and planning mode | "Create a plan using a subagent..." |
| General-purpose | Complex multi-step tasks | "Use a subagent to..." |
When to Use Subagents¶
- Large codebase exploration — reading many files without filling main context
- Research tasks — investigating patterns across the codebase
- Parallel investigation — multiple independent searches
Managing Subagents¶
Use /agents to interactively view and manage active subagents.
Custom Subagents¶
Define custom subagents by placing .md files in .claude/agents/ (project) or ~/.claude/agents/ (personal):
<!-- .claude/agents/security-review.md -->
---
name: security-review
description: Analyzes code for security vulnerabilities.
---
You are a security review agent. Analyze the provided code for:
1. Input validation gaps
2. SQL injection risks
3. Authentication/authorization issues
4. Secrets in code
5. XSS vulnerabilities
Report findings with severity (Critical/High/Medium/Low).
Subagent frontmatter fields include: name, description, tools, disallowedTools, model, maxTurns, hooks, skills, mcpServers, permissionMode, background, isolation. Only name and description are required.
For the full reference, see official docs.
Agent Teams¶
Experimental
Agent teams are an experimental feature (Feb 2026). Behavior may change.
Agent teams let multiple Claude instances collaborate on a shared task list. One instance acts as the team lead (you interact with it directly), and it spawns teammates that work in parallel on subtasks — each with their own context window and tools.
How to Enable¶
Add to your environment or .claude/settings.json:
Or export in your shell: export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
Subagents vs Agent Teams¶
| Subagents | Agent Teams | |
|---|---|---|
| Scope | Single tool call | Full session with own tools |
| Communication | Returns result to parent | Mailbox (async messages) |
| Task tracking | None | Shared task list |
| Parallelism | Sequential or limited parallel | True parallel (separate processes) |
| Context | Fork of parent or fresh | Fully independent |
| Use case | Quick research, exploration | Large multi-file features, parallel workstreams |
Starting a Team¶
Use natural language to describe parallel work:
I need to implement the new Projects domain. Split the work:
- Teammate 1: Create the data model and migrations
- Teammate 2: Create the API endpoints and schemas
- Teammate 3: Write the tests
Coordinate via the task list.
Display Modes¶
| Mode | How | Description |
|---|---|---|
| In-process | Shift+Down |
Cycle through teammate views in the same terminal |
| Split panes | tmux / iTerm2 | Each teammate in its own pane for real-time monitoring |
Hooks¶
Agent teams introduce two new hook events:
| Event | Fires When |
|---|---|
TeammateIdle |
A teammate finishes all assigned tasks |
TaskCompleted |
Any task in the shared list is marked completed |
When to Use¶
Good fit:
- Large features touching many independent files/modules
- Parallel test writing and implementation
- Multi-service changes (frontend + backend + infra)
- Bulk operations (rename across many files, migrate patterns)
Not a good fit:
- Small, focused changes (use subagents or work directly)
- Tightly coupled changes where every file depends on the previous
- Tasks requiring human review between steps
Best Practices¶
- Include context in spawn prompts — teammates start with fresh context, so describe the codebase patterns they need
- Avoid file conflicts — assign different files/directories to each teammate
- Keep teams small — 5-6 tasks per teammate is the sweet spot; too many causes coordination overhead
- Use the task list — it's the coordination primitive; don't rely on teammates "knowing" what others are doing
- Monitor early — check teammate progress after the first few tasks to catch misunderstandings
Limitations¶
- Teammates cannot see each other's context windows
- File conflicts (two teammates editing the same file) require manual resolution
- No automatic dependency ordering between teammates' tasks
- Token costs scale linearly with the number of teammates
For the full reference, see official docs.
Task System¶
For complex multi-step work, Claude's task system tracks progress:
| Command | Purpose |
|---|---|
TaskCreate |
Create a new task with description |
TaskUpdate |
Mark tasks in_progress or completed |
TaskList |
View all tasks and their status |
TaskGet |
Get full details of a specific task |
Example¶
Claude will create tasks, mark them in progress as it works, and complete them when done.
Memory¶
The /memory command lets you view and edit Claude's persistent memory files. Use this for:
- Personal preferences that persist across sessions
- Notes about ongoing work
- Learnings from debugging sessions
Use /memory to view and edit CLAUDE.md memory files, or ask Claude to add rules to CLAUDE.md directly.
Quick Command Reference¶
| Goal | Command |
|---|---|
| Start fresh | /clear |
| Compress context | /compact |
| Check token usage | /context |
| Edit memory | /memory |
| Bootstrap CLAUDE.md | /init |
| Toggle verbose output | Ctrl+O |
| Cancel generation | Ctrl+C or Escape |
| Rewind conversation | Escape twice |
| Effort level | /effort or CLAUDE_CODE_EFFORT_LEVEL |
| Toggle thinking | Option+T / Alt+T |
| Manage agents | /agents |
| Check MCP status | /mcp |
| List skills | /skills |
| Plugin manager | /plugin |
| Hook manager | /hooks |