Subagents
A subagent is a markdown file in agents/ defining a worker with its own system prompt, tool access, and optionally its own model. Subagents run in a fresh context window, completely separate from your main conversation. They might read dozens of files, but your session only receives a summary — this isolation is why subagents help with long sessions.
---name: code-reviewerdescription: Reviews code for correctness, security, and maintainabilitytools: Read, Grep, Glob---
You are a senior code reviewer. Review for:
1. Correctness: logic errors, edge cases, null handling2. Security: injection, auth bypass, data exposure3. Maintainability: naming, complexity, duplication
Every finding must include a concrete fix.The description tells Claude when to delegate automatically; tools: restricts access (here read-only — it can inspect but never edit). Type @ to delegate directly from the autocomplete. Subagents with memory: project|local|user get their own persistent MEMORY.md.
Skill vs subagent: skills are reusable content loaded into any context; subagents are isolated workers. They combine — a subagent can preload skills via its skills: field, and a skill can run isolated with context: fork.
Check your understanding
Section titled “Check your understanding”Question 1What returns to your main conversation when a subagent finishes?
The work happens in isolation; only the summary lands in your context.
Question 2How do you restrict a subagent to read-only inspection?
The tools: field limits which tools the subagent may use.