subagent-creator
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, or task-specific AI workflows.
What this skill does
# Sub-agent Creator
Create specialized AI sub-agents for Claude Code that handle specific tasks
with customized prompts and tool access.
## Sub-agent File Format
Sub-agents are Markdown files with YAML frontmatter stored in:
- **Project**: `.claude/agents/` (higher priority)
- **User**: `~/.claude/agents/` (lower priority)
### Structure
```markdown
---
name: subagent-name
description: When to use (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/plan
skills: skill1, skill2 # Optional - auto-load skills
---
System prompt goes here. Define role, responsibilities, and behavior.
```
### Configuration Fields
| Field | Required | Description |
| ---------------- | -------- | -------------------------------------- |
| `name` | Yes | Lowercase with hyphens |
| `description` | Yes | Purpose and when to use (key trigger) |
| `tools` | No | Comma-separated tool list |
| `model` | No | `sonnet`, `opus`, `haiku`, or `inherit`|
| `permissionMode` | No | `default`, `acceptEdits`, `plan`, etc. |
| `skills` | No | Skills to auto-load |
| `hooks` | No | Hooks for lifecycle (PreToolUse, etc.) |
## Creation Workflow
1. **Gather requirements**: Ask about purpose, when to use, and capabilities
2. **Choose scope**: Project (`.claude/agents/`) or user (`~/.claude/agents/`)
3. **Define configuration**: Name, description, tools, model
4. **Write system prompt**: Clear role, responsibilities, and output format
5. **Create file**: Write the `.md` file to the appropriate location
## Writing Effective Sub-agents
### Description Best Practices
The `description` field is critical for automatic delegation:
```yaml
# Good - specific triggers
description: Expert code reviewer. Use PROACTIVELY after writing code.
# Good - clear use cases
description: Debugging specialist for errors, test failures, unexpected behavior.
# Bad - too vague
description: Helps with code
```
### System Prompt Guidelines
1. **Define role clearly**: "You are a [specific expert role]"
2. **List actions on invocation**: What to do first
3. **Specify responsibilities**: What the sub-agent handles
4. **Include guidelines**: Constraints and best practices
5. **Define output format**: How to structure responses
### Tool Selection
- **Read-only tasks**: `Read, Grep, Glob, Bash`
- **Code modification**: `Read, Write, Edit, Grep, Glob, Bash`
- **Full access**: Omit `tools` field
See [available-tools.md](references/available-tools.md) for complete tool list.
## Example Sub-agents
See [references/examples.md](references/examples.md) for complete examples:
- Code Reviewer
- Debugger
- Data Scientist
- Test Runner
- Documentation Writer
- Security Auditor
## Template
Copy from [subagent-template.md](assets/subagent-template.md) to start a new sub-agent.
## Quick Start Example
Create a code reviewer sub-agent:
```bash
mkdir -p .claude/agents
```
Write to `.claude/agents/code-reviewer.md`:
```markdown
---
name: code-reviewer
description: Reviews code for quality and security. Use proactively after 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
```
### Hooks in Subagents
Define hooks that run during subagent execution:
```yaml
---
name: code-reviewer
description: Review code with auto-linting
hooks:
PostToolUse:
- matcher: "Edit|Write"
hooks:
- type: command
command: "./scripts/run-linter.sh"
---
```
Hooks are scoped to the subagent's execution and automatically cleaned up.
## Triggers
This skill activates when users want to:
- Create a new sub-agent or custom agent for Claude Code
- Configure task-specific AI workflows with specialized prompts
- Set up automatic delegation for specific task types
- Customize tool access or permission modes for agents
- Build specialized assistants (code reviewer, debugger)
## Extension Points
1. **Template customization**: Modify `assets/subagent-template.md`
to match organizational standards or add custom fields
2. **Permission mode additions**: Extend `references/permission-modes.md`
with organization-specific permission configurations
3. **Example library**: Add new sub-agent examples to `references/examples.md`
4. **Tool configurations**: Create preset tool combinations for agent types
## Anti-Patterns
Avoid these common mistakes when creating sub-agents:
- **Overly broad descriptions**: Vague descriptions prevent auto-delegation
- **Missing proactive trigger**: Forgetting "use proactively" in description
- **Excessive tool restrictions**: Over-restricting when agent needs flexibility
- **Monolithic prompts**: Long system prompts instead of focused, concise ones
- **Hardcoded paths**: Including absolute paths or env-specific values
- **Ignoring permission modes**: Not using `permissionMode` for elevated access
## Design Rationale
**Why YAML frontmatter?** Provides structured, parseable configuration while
keeping the system prompt in readable Markdown. Matches skill format.
**Why description is critical?** The Task tool uses descriptions to determine
which sub-agent to delegate to. Descriptions are the primary routing mechanism.
**Why optional tools field?** Most sub-agents benefit from full tool access.
Restricting is only needed for security-sensitive or read-only tasks.
**Why permission modes?** Different tasks require different trust levels.
A code reviewer needs only read access, while an auto-fixer needs edit.
Permission modes enable safe automation without blanket approvals.
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.