Create a specialized subagent
mcp, agents & hooks
// what it does
A subagent is a Markdown file with YAML frontmatter in .claude/agents/ (project) or ~/.claude/agents/ (personal). Only name and description are required; add tools to restrict its tool access and model to route it to a cheaper or stronger model. The body is its system prompt. Claude reads each subagent's description and delegates matching side tasks so they run in a separate context and return just a summary.
// shell
$ .claude/agents/code-reviewer.md$ use the code-reviewer agent on src/api.ts// gotcha
The /agents command no longer opens a creation wizard (v2.1.198+) — it prints a reminder to ask Claude to write the file or edit .claude/agents/ directly. If a newly created subagent isn't found, restart Claude Code: a running session doesn't detect a freshly created agents directory.