A subagent is a specialized assistant that Claude Code delegates one task to. It works in a separate conversation, returns a short summary to the main conversation (the parent), and its own conversation is then discarded.1
How it runs
A subagent receives two inputs: a system prompt from its configuration file, which defines its role, and a task description the parent writes from the user’s request.1 Its file reads, searches, edits, and tool results stay in its own context; the parent keeps only the original request and the returned summary.1 Why that matters, and what it costs, is on Context isolation.
flowchart TD accTitle: Subagent delegation lifecycle accDescr: The parent defines a bounded task, the subagent investigates with its permitted tools and returns a focused result, and the parent verifies it. The subagent's detailed context is discarded. U[User request] --> P[Parent defines bounded task and expected output] P --> S[Subagent receives task and system prompt] S --> T[Investigates with permitted tools] T --> R[Returns focused result and obstacles] R --> V[Parent verifies and uses the result] S -.-> X[Detailed context discarded]
The parent only ever sees the result box, so the delegation contract has to say what that result contains.
Built-in and custom subagents
| Subagent | Purpose in the course |
|---|---|
| General purpose | Multi-step tasks that need both exploration and action |
| Explore | Fast searching and navigation of codebases |
| Plan | Codebase research and analysis during plan mode |
Claude Code also supports custom subagents with their own system prompts and tool access.1
Subagents and skills
Subagents do not inherit the main conversation’s skills. Built-in agents cannot use skills at all; a custom subagent can, but only the ones listed in its frontmatter, and those load when the subagent starts rather than matching on demand.2 The skills field is on Subagent configuration file. Where subagents sit among Claude Code’s other mechanisms is on Claude Code extension mechanisms.
Subagents also work in cloud sessions as they do locally, and .claude/agents/ definitions are picked up automatically.3
Contradictions
The two sources name the built-in agents differently:
- The subagents course lists General purpose, Explore, and Plan.1
- The skills course, when saying built-in agents cannot access skills, names Explorer, Plan, and Verify.2
Neither source explains the difference. Check the current Claude Code documentation before relying on either list.
Example
To find which service handles refunds in an unfamiliar codebase, Claude might read around 15 files, run searches, and trace function calls. Done in the main conversation, all of that lands in its context although the wanted output is one fact; an Explore subagent keeps the investigation isolated and returns only the answer.1
Related
- Source: Claude Code Cloud Sessions
- When to delegate: the decision rule and the anti-patterns.
- Least-privilege tool access: which tools a subagent should get.
- Source: Introduction to Claude Code Agent Skills
- Source: Introduction to Claude Code Subagents