Use the workflow to follow the task, and the architecture map to separate responsibilities. These are conceptual maps; the guide below defines implementation details and verification limits.
01 / WorkflowFrom intent to a checked result
1Define a narrow responsibility↓
2Supply scoped context↓
3Execute isolated work↓
4Return findings to coordinator
02 / ArchitectureResponsibility boundaries
Boundary 1Delegation contract
Boundary 2Subagent context
Boundary 3Coordinator review
Connected responsibilities, not a required class hierarchy or an execution trace.
Load this when: a task is large enough to split, a search would flood your
context, you need work verified by something other than the agent that wrote it,
or you are defining a new specialist in .claude/agents/.
A subagent is a separate Claude instance with its own context window, its
own system prompt, and optionally a restricted tool set. The main agent
delegates a task to it, the subagent works in isolation, and it returns a single
final report.
1. Why delegate at all
Three reasons, in order of how often they apply:
Context preservation. A search that reads forty files costs forty files
of your context. Delegated to a subagent, it costs one paragraph of findings.
This is the most common reason and the most undervalued.
Independent verification. An agent that wrote code is a bad judge of
whether that code works — it is predisposed to see its own intent rather than
what it typed. A fresh subagent has no such stake. See verification.md.
Parallelism. Independent read-only investigations run concurrently
instead of serially.
Delegation is not free. Each subagent starts cold — it does not inherit your
conversation, the file you just read, or the decision the user made three turns
ago. Everything it needs must be in the prompt you give it. For a task you could
finish in two tool calls, spawning a subagent is slower and worse.
Do the work inline when: it is a couple of files, you already have the
context loaded, or the task is a single edit. "Thorough", "multiple angles", and
"several parts" are not by themselves reasons to delegate.
2. Defining a subagent
Subagents are markdown files with YAML frontmatter. Project-level definitions
live in .claude/agents/; user-level ones in ~/.claude/agents/. Project
definitions take precedence when names collide.
---
name: swift-reviewer
description: Independent verifier for Swift changes. Use after code is written to check it against the repo rules and prove it builds. Runs builds and tests and returns real output.
tools: Read, Grep, Glob, Bash
model: inherit
---
You are an independent reviewer. …system prompt…
Field
Required
Notes
name
yes
Lowercase kebab-case, unique. This is how you invoke it.
description
yes
This is the routing signal. The main agent selects a subagent by matching the task against this text.
tools
no
Comma-separated allowlist. Omit to inherit all tools.
model
no
sonnet, opus, haiku, or inherit. Defaults to the configured subagent model.
The description is the interface
The main agent picks a subagent by reading descriptions, not by reading system
prompts. A vague description means the subagent never gets invoked, or gets
invoked for the wrong things.
# WEAK — nothing here says when to use it.
description: Reviews code.
# STRONG — names the trigger, the input, and the output.
description: Independent verifier for Swift/iOS changes. Use after another agent
has written code, to check it against repository rules and prove it builds and
tests pass. Runs builds and tests and returns their real output.
Write descriptions in the form *". Use when . Returns