Use this skill when creating new Claude Code subagents, authoring agent definitions, writing agent system prompts, or when the user asks about "create agent", "new subagent", "agent template", "agent best practices", "agent configuration", "define specialist", or "custom agent". Provides templates, validation, and best practices for high-quality agent authoring.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
references/agent-template.mdreferences/code-reviewer-example.mdreferences/debugger-example.mdreferences/researcher-example.mdreferences/security-scanner-example.mdThis skill provides comprehensive guidance for creating high-quality Claude Code subagents. Use this when helping users define new specialized agents.
Subagents are specialized AI assistants that can be invoked from the main Claude Code conversation. They run in isolated contexts with specific tools, prompts, and capabilities tailored to their purpose.
.claude/agents/ and commit themSubagents are Markdown files with YAML frontmatter:
---
name: agent-name
description: Description of when this agent should be invoked
tools: Tool1, Tool2, Tool3
model: sonnet
---
Your agent's system prompt goes here.
| Field | Required | Description |
|---|---|---|
name | Yes | Unique identifier (lowercase, hyphens only) |
description | Yes | When to use this agent. Use "PROACTIVELY" or "MUST BE USED" for auto-invocation |
tools | No | Comma-separated tool list. If omitted, inherits all tools |
model | No | Model to use: sonnet, opus, haiku, or inherit |
permissionMode | No | Permission handling: default, acceptEdits, bypassPermissions, plan |
skills | No | Comma-separated list of skills to auto-load |
File Operations:
Read - Read file contentsWrite - Create new filesEdit - Make precise editsGlob - Find files by patternCode Search:
Grep - Search with regexBash - Run terminal commandsWeb & Research:
WebSearch - Search the webWebFetch - Fetch web pagesSpecial:
Task - Invoke other subagents| Use Case | Recommended Tools |
|---|---|
| Read-only analysis | Read, Grep, Glob |
| Code modification | Read, Edit, Write, Grep, Glob |
| Test execution | Bash, Read, Grep |
| Web research | WebSearch, WebFetch, Read |
| Full access | (omit tools field) |
| Model | Use For |
|---|---|
haiku | Fast searches, simple lookups, exploration |
sonnet | Balanced tasks, most common choice |
opus | Complex analysis, critical reviews, security |
inherit | Match parent conversation model |
Project-Level (highest priority):
.claude/agents/User-Level (lower priority):
~/.claude/agents/When helping a user create a subagent, follow this process:
Ask the user:
Use the template from references/agent-template.md as a starting point.
Key considerations:
A good system prompt includes:
Check:
.claude/agents/ (project) or ~/.claude/agents/ (user)See references/ for complete examples:
references/agent-template.md - Base templatereferences/code-reviewer-example.md - Code review specialistreferences/debugger-example.md - Debugging specialistreferences/researcher-example.md - Research specialistreferences/security-scanner-example.md - Security analysis---
name: your-agent-name
description: PROACTIVELY use when [specific trigger conditions]
tools: Read, Grep, Glob
model: sonnet
---
You are a [role] specializing in [domain].
## When Invoked
1. First, [immediate action]
2. Then, [analysis step]
3. Finally, [output step]
## Process
- [Step-by-step guidance]
- [Quality criteria]
- [Edge case handling]
## Output Format
Provide results as:
- [Structured format]
- [Priority levels]
- [Actionable items]
## Constraints
- Never [unwanted behavior]
- Always [required behavior]
- Focus on [scope limitation]