Subagents: a team of specialists
Module 8 — Subagents: a team of specialists
← Module 7 | Index | Next: Module 9 →
So far, “Claude” has been one worker at one desk. A subagent is a separate Claude that the main one can hand a job to — with its own fresh desk (its own context window), its own instructions, and its own limited toolset.
Two big benefits
1. Clean context. Remember the desk from Module 4. If the main Claude had to do a giant search through hundreds of files itself, all that clutter would pile onto its desk and crowd out your actual task. Instead, it spins up a subagent, says “go find where the payment logic lives,” and the subagent does all the messy searching on its own desk. It returns just the answer — a clean, short result — and the main desk stays focused. Subagents are, above all, a way to protect the main context.
2. Specialization. You can define a subagent with a focused job and personality. A “code reviewer” agent that only reviews and never edits. A “test writer” that only writes tests. A “researcher” that searches broadly and reports back. Each has instructions tuned to its role.
What a subagent looks like, physically
A markdown file in .claude/agents/, with frontmatter and instructions:
---
name: code-reviewer
description: Reviews code changes for bugs and style.
Use after writing or modifying code.
tools: Read, Grep, Glob
model: sonnet
---
You are a careful code reviewer. Look for bugs,
security issues, and style problems. Do not edit
files — only report what you find.
The frontmatter lets you control the agent precisely: its name, a description of when to use it (matched the same way skills are), the tools it’s allowed to touch (a reviewer might be read-only, with no power to edit), and even which model it runs on (a cheap fast model for simple jobs, a stronger one for hard ones).
How they get used
The main Claude reads the descriptions and delegates automatically when a task fits, or you can explicitly ask “use the code-reviewer agent.” Subagents can even run in parallel — several specialists working at once — which is both faster and keeps each desk clean.
The mental model
You’re a manager. The main Claude is your lead. Subagents are specialists the lead can delegate to, each working in their own room so nobody’s desk gets cluttered, each reporting back just the result.