Why use one
- Keep the main context clean: a subagent can read a hundred files and report back a summary.
- Limit what it can do: give a reviewer subagent read-only tools.
- Reuse a setup across projects.
- Control cost: Claude Code's docs mention routing work to a cheaper model.
Where they live in Claude Code
Custom subagents are Markdown files with YAML frontmatter in .claude/agents/ (one project) or ~/.claude/agents/ (all your projects). When both define the same name, the project one wins. See also AI agent and context engineering.