Create and manage specialized Claude Code subagents for task-specific workflows...
Pre-configured AI personalities that Claude Code can delegate tasks to. Each:
Benefits:
| Type | Location | Scope |
|---|---|---|
| Project subagents | .claude/agents/ |
Current project only |
| User subagents | ~/.claude/agents/ |
All projects |
Project-level subagents take precedence over user-level when names conflict.
Each subagent is a Markdown file with YAML frontmatter:
---
name: your-sub-agent-name
description: When this subagent should be invoked
tools: tool1, tool2, tool3 # Optional - inherits all if omitted
model: sonnet # Optional - specify model or 'inherit'
---
Your subagent's system prompt goes here. Multiple paragraphs.
Include role, capabilities, approach, best practices, constraints.
| Field | Required | Description |
|---|---|---|
name |
Yes | Unique identifier (lowercase + hyphens) |
description |
Yes | Natural language purpose description |
tools |
No | Comma-separated tools (inherits all if omitted) |
model |
No | Model alias (sonnet, opus, haiku) or 'inherit' |
Claude Code proactively delegates based on:
description field in subagent configurationTo encourage proactive use, include "use PROACTIVELY" or "MUST BE USED" in description.
Request specific subagents by name:
> Use the test-runner subagent to fix failing tests
> Have the code-reviewer subagent look at my recent changes
/agents Command (Recommended)Interactive menu for:
mkdir -p .claude/agents
cat > .claude/agents/test-runner.md << 'EOF'
---
name: test-runner
description: Use proactively to run tests and fix failures
---
You are a test automation expert. When you see code changes, proactively run the appropriate tests. If tests fail, analyze failures and fix them.
EOF