This skill should be used when the user asks to "configure a subagent", "create a custom agent", "set up agent tools", "configure permissionMode", "add agent skills", or mentions subagent fields like...
Configure custom subagents in Claude Code with specialized tools, models, and permissions for task-specific workflows.
Subagents are pre-configured AI personalities that delegate specialized tasks. Each subagent operates in its own context window with custom system prompts, specific tool access, and tailored permission modes. This skill provides guidance on configuring subagent YAML frontmatter and system prompts effectively.
Use this skill when:
Subagents are defined in Markdown files with YAML frontmatter:
---
name: agent-name
description: When this agent should be invoked
tools: tool1, tool2, tool3 # Optional
model: sonnet # Optional
permissionMode: default # Optional
skills: skill1, skill2 # Optional
---
System prompt content goes here.
.claude/agents/ (highest priority)~/.claude/agents/ (lower priority)Unique identifier using lowercase letters, numbers, and hyphens only.
Format: lowercase-with-hyphens
Examples:
code-reviewertest-runnerdata-scientistsecurity-auditorInvalid:
Code_Reviewer (uppercase, underscores)test runner (spaces)my.agent (periods)Natural language description of when Claude should invoke this subagent. This field is critical for automatic delegation.
Best practices:
Examples:
Good:
description: Expert code reviewer. Use proactively after code changes to check quality, security, and best practices.
Good:
description: Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when encountering any issues.
Weak:
description: Helps with code
Comma-separated list of specific tools the subagent can use. If omitted, inherits all tools from main thread.
Common tools:
Read, Write, Edit - File operationsBash - Shell commandsGrep, Glob - Search operationsWebFetch, WebSearch - Web operationsTask - Delegate to other subagentsNotebookEdit - Jupyter notebooksmcp__server__toolExamples:
Read-only agent:
tools: Read, Grep, Glob
Full-stack developer:
tools: Read, Write, Edit, Bash, Grep, Glob, WebFetch, WebSearch, Task
Code reviewer (no modifications):
tools: Read, Grep, Glob, Bash
Security consideration: Limit tools to minimum needed for the subagent's purpose.
Specify which AI model the subagent uses.
Values:
sonnet - Balanced capability (default for subagents)opus - Most capable, higher costhaiku - Fast and efficient, lower costinherit - Use same model as main conversationExamples:
Fast searching with Haiku:
model: haiku
Complex reasoning with Opus:
model: opus
Match main conversation:
model: inherit
Defaults: If omitted, uses configured subagent model (typically sonnet).
Controls how the subagent handles permission requests.
Values:
default - Normal permission flow (asks for confirmation)acceptEdits - Automatically accepts edit operationsbypassPermissions - Bypasses permission system entirelyplan - Plan mode (read-only, no execution)ignore - Ignores permission requestsExamples:
Auto-formatter (accepts edits):
permissionMode: acceptEdits
Data analyst (bypasses for automation):
permissionMode: bypassPermissions
Architecture planner (read-only):
permissionMode: plan
Standard agent (asks permission):
permissionMode: default
Security note: Use bypassPermissions carefully, only for trusted workflows.
Comma-separated list of skill names to auto-load when the subagent starts.
Format: skill-name-1, skill-name-2
Example:
skills: test-driven-development, code-reviewer
Skills are loaded into the subagent's context automatically, providing specialized knowledge.
For simple, general-purpose subagents:
---
name: simple-helper
description: A basic helper agent for simple tasks
---
Provide quick answers and basic guidance.
For exploration and analysis without modifications:
---
name: documentation-reader
description: Read-only agent for exploring documentation
tools: Read, Grep, Glob
model: haiku
---
Explore documentation and provide information about what exists.
Never suggest modifications.
For automated workflows that shouldn't ask permission:
---
name: auto-formatter
description: Automatically formats code files without asking permission
tools: Read, Edit, Bash
model: haiku
permissionMode: acceptEdits
---
Automatically format code files when invoked.
Run formatting tools without asking for confirmation.
For specialized domains requiring loaded knowledge:
---
name: pdf-expert
description: PDF processing expert with specialized skills
tools: Read, Write, Bash
model: sonnet
skills: pdf-processing, form-filling
---
Process PDF files, forms, and document extraction using specialized skills.
For security audits with restricted tools:
---
name: security-auditor
description: Security audit specialist. Use when reviewing code for vulnerabilities.
tools: Read, Grep, Glob, Bash
model: sonnet
permissionMode: default
---
Find vulnerabilities: SQL injection, XSS, CSRF, exposed secrets.
Provide severity ratings and remediation steps.
For complex tasks requiring all capabilities:
---
name: full-stack-developer
description: Full-stack development expert. MUST BE USED for complex features requiring both frontend and backend changes.
tools: Read, Write, Edit, Bash, Grep, Glob, WebFetch, WebSearch, Task
model: opus
permissionMode: default
skills: code-reviewer, test-driven-development
---
Implement complex features end-to-end:
1. Analyze requirements
2. Plan implementation strategy
3. Implement backend then frontend
4. Write comprehensive tests
5. Document changes
The system prompt (Markdown body) defines the subagent's behavior and expertise.
Best practices:
Structure example:
You are a [role] specializing in [domain].
When invoked:
1. [First step]
2. [Second step]
3. [Third step]
Key practices:
- [Practice 1]
- [Practice 2]
- [Practice 3]
For each [task], provide:
- [Output 1]
- [Output 2]
- [Output 3]
Interactive management:
/agents
Provides:
Manual creation:
# Project subagent
mkdir -p .claude/agents
nano .claude/agents/my-agent.md
# User subagent
mkdir -p ~/.claude/agents
nano ~/.claude/agents/my-agent.md
Changes take effect on next Claude Code session start.
Create subagents with single, clear responsibilities:
ā Good:
code-reviewer - Reviews code qualitytest-runner - Runs and fixes testssecurity-auditor - Finds vulnerabilitiesā Avoid:
everything-agent - Does everythinghelper - Too vagueInclude specific instructions, examples, and constraints. More guidance = better performance.
Only grant tools necessary for the subagent's purpose:
Security agent:
tools: Read, Grep, Glob, Bash # No Write/Edit
Formatter:
tools: Read, Edit, Bash # No WebFetch/Search
Check project subagents into git:
git add .claude/agents/
git commit -m "Add team subagents"
Team members automatically get the same subagents.
After creating, test by:
For detailed configuration examples:
references/configuration-examples.md - 12 complete subagent configurations with explanationsexamples/ - Working subagent files ready to useStudy Claude Code's built-in subagents:
general-purpose - Multi-step tasks, uses Sonnet, all toolsexplore - Fast searching, uses Haiku, read-onlyplan - Architecture planning, uses Sonnet, plan mode/docs/en/sub-agents/docs/en/plugins/docs/en/settings| Field | Required | Values | Default |
|---|---|---|---|
name |
ā | lowercase-with-hyphens | - |
description |
ā | Natural language | - |
tools |
ā | Comma-separated list | All tools |
model |
ā | sonnet, opus, haiku, inherit | sonnet |
permissionMode |
ā | default, acceptEdits, bypassPermissions, plan, ignore | default |
skills |
ā | Comma-separated list | None |
Read-only: Read, Grep, Glob
Basic editing: Read, Write, Edit
With execution: Read, Write, Edit, Bash
Full access: Read, Write, Edit, Bash, Grep, Glob, WebFetch, WebSearch, Task
default - Standard (asks permission)acceptEdits - Auto-approve editsbypassPermissions - Skip all permissionsplan - Read-only planningignore - Ignore permission dialogsSubagent not triggering automatically:
description is specific with trigger phrasesTools not working:
mcp__server__tool formatWrong model being used:
model field is set correctlyPermission issues:
permissionMode settingdefault for standard behavioracceptEdits for auto-approvalbypassPermissions unless necessaryTo create a subagent:
Focus on creating focused subagents with clear purposes, minimal tool access, and specific descriptions for effective automatic delegation.