Create a specialized AI subagent with isolated context and custom configuration. Use when user says "create subagent", "create agent", "make an agent", or needs task-specific delegation.
Create a specialized AI subagent that runs in its own context window with custom system prompt, tool access, and permissions. Subagents preserve main conversation context by handling complex tasks independently.
# Interactive mode - guided creation
/create-subagent
# Auto mode - create from name
/create-subagent code-reviewer
| Location | Path | Scope | Priority |
|----------|------|-------|----------|
| Project | .claude/agents/<name>.md | This project | Higher |
| User | ~/.claude/agents/<name>.md | All projects | Lower |
Project-level subagents override user-level when names conflict.
$ARGUMENTS): Auto mode - generate from name and recent workflowUse AskUserQuestion with these prompts:
Question 1 - Role:
Question 2 - Activation:
Question 3 - Tools (multiSelect: true):
Question 4 - Model:
Question 5 - Scope:
When analyzing recent conversation:
# User-level
~/.claude/agents/$SUBAGENT_NAME.md
# Project-level
.claude/agents/$SUBAGENT_NAME.md
Use this template:
---
name: subagent-name
description: Role + when to invoke. Include trigger keywords for auto-delegation.
tools: Read, Write, Bash # Optional, inherits all if omitted
model: sonnet # Optional: sonnet, opus, haiku, inherit
---
You are a [specific role] specializing in [domain].
## Responsibilities
1. **Primary Task**: What you do first
2. **Secondary Task**: What you do next
3. **Quality Assurance**: How you verify work
## Workflow
When invoked:
1. **Analyze**: Understand the current state
2. **Execute**: Perform the main task
3. **Verify**: Check results meet standards
4. **Report**: Summarize findings
## Best Practices
- Guideline 1
- Guideline 2
- Common pitfall to avoid
## Output Format
[Template for deliverables]
See reference.md for complete frontmatter field documentation.
Key fields:
| Field | Description |
|-------|-------------|
| name | Unique identifier (lowercase, hyphens) |
| description | Role + activation triggers (critical for auto-delegation) |
| tools | Comma-separated list; inherits all if omitted |
| disallowedTools | Tools to explicitly deny |
| model | sonnet, opus, haiku, or inherit |
| permissionMode | default, acceptEdits, dontAsk, bypassPermissions, plan |
| skills | Skills to preload into subagent context |
| hooks | Lifecycle hooks for this subagent |
Poor descriptions:
Good descriptions:
Claude Code includes these built-in subagents:
| Agent | Model | Tools | Purpose | |-------|-------|-------|---------| | Explore | Haiku | Read-only | Fast codebase exploration | | Plan | Inherit | Read-only | Research during plan mode | | general-purpose | Inherit | All | Complex multi-step tasks |
Use subagents when:
Use main conversation when:
Before finalizing:
After creation:
Subagent created: subagent-name
Location: ~/.claude/agents/subagent-name.md
Role: [description]
Model: sonnet
Tools: Read, Write, Bash
To use:
- Automatic: Claude delegates when context matches
- Explicit: "Use the subagent-name subagent to [task]"
See examples.md for complete subagent examples.
If subagent doesn't activate:
ls ~/.claude/agents/subagent-name.mdhead -10 ~/.claude/agents/subagent-name.md/agents to verify it's loadedSearch 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