Minideas

Idea 3 of 15 · Claude Code

Handing off to subagents

Send side jobs to a separate agent with a fresh context: the built-in ones, your own, and when it’s worth it.

search thesefound in 4 filesmain sessionsubagent2,000 filesits own context window; only a summary comes back
1 / 5

Side jobs in their own context

Searching 2,000 files would fill the context window. So Claude hands jobs like that to a subagent: a separate agent that starts with a fresh context of its own, does the job and sends back only a short summary. Your session gets the answer, not the 2,000 files.

Exploreread onlysearchesthe codePlanread onlyresearchesfor plan modegeneral-purposeall toolsside jobs withseveral stepsbuilt in: Claude picks one when a job fits
2 / 5

Built-in subagents

Claude Code comes with a few, and Claude picks one when a job fits. Explore searches the code and can only read. Plan does the same research while you’re in plan mode. General-purpose can also edit files and run commands, for side jobs with several steps. Several can run at once: “check the cart, payment and email code in parallel”.

.claude/agents/code-reviewer.md---name: code-reviewerdescription: Reviews code for bugs. Use after edits.tools: Read, Grep, Glob---You review code for bugs and risky changes…one project: .claude/agents/ · all projects: ~/.claude/agents/
3 / 5

Create your own subagent

A subagent is a Markdown file in .claude/agents/: a name, a description of when to use it, its allowed tools, then instructions. Easiest: ask Claude to write one, like “a read-only code reviewer”. Claude delegates when the description matches, or you say “use the code-reviewer subagent”. Details on the subagents page.

tools:model:ReadGrepEditBashhaikuquick, cheap searchesopusharder problemsa reviewerthat can’t editleft out:your session’s modelonly the tools it needs, a model that fits the job
4 / 5

Limit its tools, pick its model

Left alone, a subagent gets almost all the tools your session has. List tools to allow only some: a reviewer that can only read won’t start “fixing” what it finds. disallowedTools takes a few away instead. model sets its model: haiku for quick, cheap searches, opus for harder problems; left out, it uses your session’s model.

main session“it’s fixed!”diffreviewer subagentdiscountapplied twice!has seen the whole chatsees only the diffthe coststarts from scratch: time and tokensyou see only its summaryquick edit or back-and-forth? stay in your session
5 / 5

Fresh eyes, and the cost

A subagent doesn’t see your chat, which makes it a good reviewer: it reads only the diff, not the reasoning that convinced you, and spots the discount applied twice. The cost: it starts from scratch, which takes time and tokens, and you see only its summary. For a quick edit, or work with lots of back-and-forth, stay in your session.

Swipe the card, or use the arrow keys.

Go deeper

Each card stack gives you the idea. These open resources go into the detail.

Notes on the Claude Partner Network learning path on Anthropic Academy.