Skills with Subagents
A skill does not have to do everything itself. With the Task tool enabled in allowed-tools, your skill becomes an orchestrator — it spawns parallel child Claude instances, each handling one subtask, then collects and synthesises their output.
What is a subagent?
In Claude Code, a subagent is a separate Claude instance that your orchestrating skill spawns to handle one specific piece of work. Each subagent:
How it works
/research "React Server Components"allowed-tools: [Task] and your Steps instructionsThe key ingredient: allowed-tools
By default, skills do not have access to any tools. To enable subagents, add Task to the allowed-tools list in the frontmatter. Add any other tools your subagents will need too.
Example 1 — /research
A single command spawns three subagents in parallel — one per angle — then returns one synthesised report. Without subagents this would require three separate conversations.
Example 2 — /audit
Review every TypeScript file in a directory by spawning one dedicated subagent per file. Each subagent reads only its file and reports findings independently.
Best practices
When to use subagents vs a single skill
| Situation | Use subagents? | Why |
|---|---|---|
| Multiple independent search queries | ✅ Yes | Queries have no dependency on each other; parallel is faster |
| Review N files independently | ✅ Yes | Each file is self-contained; one subagent per file is clean |
| Sequential steps (A depends on B) | ❌ No | Subagents cannot share state; orchestrate sequentially instead |
| One focused transformation task | ❌ No | A single Claude invocation is faster and simpler |
| Tasks needing shared memory | ❌ No | Subagents are isolated — use a single skill with context instead |
| Gathering data from multiple sources | ✅ Yes | Each source is independent; parallelism cuts total time significantly |
What's Next
Sub-agents extend what a single skill can do. The final skills lesson shows you how to package and share your skills with your team.