Claude Code lets you define your own subagents — Markdown files that give Claude a specialist it can delegate to, with its own system prompt, its own tool access, and its own context window. The mechanism is simple, but most "my subagent doesn't work" problems come from three details the docs mention once and people skim past: the description field is the router, name collisions silently drop a file, and one bad tools entry stops the agent from launching at all.
Here's the whole system, verified against the current docs.
The 30-second version
A subagent is one Markdown file with YAML frontmatter:
name: code-improver






