Create specialized Claude Code sub-agents with custom system prompts and tool configurations. Use when users ask to create a new sub-agent, custom agent, specialized assistant, or want to configure task-specific AI workflows for Claude Code.
Create specialized AI sub-agents for Claude Code that handle specific tasks with customized prompts and tool access.
Sub-agents are Markdown files with YAML frontmatter stored in:
.claude/agents/ (higher priority)~/.claude/agents/ (lower priority)---
name: subagent-name
description: When to use this subagent (include "use proactively" for auto-delegation)
tools: Tool1, Tool2, Tool3 # Optional - inherits all if omitted
model: sonnet # Optional - sonnet/opus/haiku/inherit
permissionMode: default # Optional - default/acceptEdits/bypassPermissions/plan
skills: skill1, skill2 # Optional - auto-load skills
---
System prompt goes here. Define role, responsibilities, and behavior.
| Field | Required | Description |
|-------|----------|-------------|
| name | Yes | Lowercase with hyphens |
| description | Yes | Purpose and when to use (key for auto-delegation) |
| tools | No | Comma-separated tool list (omit to inherit all) |
| model | No | sonnet, opus, haiku, or inherit |
| permissionMode | No | default, acceptEdits, bypassPermissions, plan |
| skills | No | Skills to auto-load |
.claude/agents/) or user (~/.claude/agents/).md file to the appropriate locationThe description field is critical for automatic delegation:
# Good - specific triggers
description: Expert code reviewer. Use PROACTIVELY after writing or modifying code.
# Good - clear use cases
description: Debugging specialist for errors, test failures, and unexpected behavior.
# Bad - too vague
description: Helps with code
Read, Grep, Glob, BashRead, Write, Edit, Grep, Glob, Bashtools fieldSee references/available-tools.md for complete tool list.
See references/examples.md for complete examples:
Copy from assets/subagent-template.md to start a new sub-agent.
Create a code reviewer sub-agent:
mkdir -p .claude/agents
Write to .claude/agents/code-reviewer.md:
---
name: code-reviewer
description: Reviews code for quality and security. Use proactively after code changes.
tools: Read, Grep, Glob, Bash
model: inherit
---
You are a senior code reviewer.
When invoked:
1. Run git diff to see changes
2. Review modified files
3. Report issues by priority
Focus on:
- Code readability
- Security vulnerabilities
- Error handling
- Best practices
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer