subagents-reference
Claude Code subagents configuration reference. Use when creating custom subagents, understanding agent types, configuring agent prompts, or extending the Task tool with specialized agents.
What this skill does
# Claude Code Subagents Reference Subagents are specialized AI assistants that Claude can spawn for specific tasks. Define custom agents to extend Claude's capabilities. ## Agent File Locations ``` ~/.claude/agents/ # User agents (all projects) .claude/agents/ # Project agents (team shared) ``` ## Agent File Format ```markdown --- name: agent-identifier description: What this agent does and when to use it model: sonnet tools: - Read - Grep - Glob - Bash --- # Agent Name Detailed instructions for the agent's behavior. ## Capabilities - Specific task the agent handles - Another capability ## Approach How the agent should tackle problems. ``` ## Frontmatter Fields | Field | Required | Type | Description | |-------|----------|------|-------------| | `name` | No | string | Agent identifier for Task tool | | `description` | Yes | string | When/why to use this agent | | `model` | No | string | haiku, sonnet, opus | | `tools` | No | array | Available tools | | `allowed_tools` | No | array | Alias for `tools` | ## Built-in Agent Types | Agent | Purpose | Tools | |-------|---------|-------| | `Explore` | Codebase exploration | Read, Grep, Glob | | `general-purpose` | Multi-step tasks | All tools | | `Bash` | Command execution | Bash | | `Plan` | Implementation planning | All tools | ## Custom Agent Example ```markdown --- name: security-reviewer description: Review code for security vulnerabilities. Use when checking for injection, XSS, auth issues. model: sonnet tools: - Read - Grep - Glob --- # Security Review Agent You are a security specialist reviewing code for vulnerabilities. ## Review Checklist 1. SQL injection 2. XSS vulnerabilities 3. Authentication bypass 4. Sensitive data exposure 5. Insecure dependencies ## Process 1. Read the target files 2. Search for common vulnerability patterns 3. Report findings with severity ratings ``` ## Invoking Agents ### Via Task Tool ``` Claude uses Task tool with: - subagent_type: "security-reviewer" - prompt: "Review the auth module for vulnerabilities" ``` ### From Skills/Instructions Reference agent in CLAUDE.md or skills: ``` When reviewing security, use the security-reviewer agent. ``` ## Tool Restrictions Limit what agents can do: ```yaml tools: - Read # Read files - Grep # Search content - Glob # Find files # No Bash, Write, Edit = read-only agent ``` ## Model Selection | Model | Use Case | |-------|----------| | `haiku` | Fast, simple tasks | | `sonnet` | Balanced (default) | | `opus` | Complex reasoning | ## Agent Prompt Best Practices 1. **Clear identity**: State what the agent specializes in 2. **Specific instructions**: Be explicit about approach 3. **Tool guidance**: Explain which tools to use when 4. **Output format**: Specify expected output structure 5. **Boundaries**: Define what's in/out of scope ## Example: Code Reviewer ```markdown --- name: code-reviewer description: Review code changes for quality, patterns, and issues model: sonnet tools: - Read - Grep - Glob --- # Code Review Agent Review code for: - Logic errors - Performance issues - Code style violations - Missing error handling ## Output Format For each issue found: 1. File and line number 2. Issue description 3. Severity (high/medium/low) 4. Suggested fix ``` ## Example: Test Writer ```markdown --- name: test-writer description: Write unit tests for functions and modules model: sonnet tools: - Read - Write - Bash --- # Test Writing Agent Write comprehensive unit tests. ## Approach 1. Read the target code 2. Identify testable functions 3. Write test cases covering: - Happy path - Edge cases - Error conditions 4. Run tests to verify ``` ## Agent Communication Agents receive: - The prompt from Task tool - Access to specified tools - Project context Agents return: - Single response to parent Claude - Any artifacts created ## Debugging ```bash # List available agents /agents # Check agent loading claude --debug ``` --- For complete documentation, see: - [subagents-full.md](subagents-full.md) - Complete subagents reference
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.