Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Claude Code agentic coding tool — terminal-based assistant for coding, git workflows, and codebase understanding.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: Agent Development3description: This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.4version: 0.1.05---67# Agent Development for Claude Code Plugins89## Overview1011Agents are autonomous subprocesses that handle complex, multi-step tasks independently. Understanding agent structure, triggering conditions, and system prompt design enables creating powerful autonomous capabilities.1213**Key concepts:**14- Agents are FOR autonomous work, commands are FOR user-initiated actions15- Markdown file format with YAML frontmatter16- Triggering via description field with examples17- System prompt defines agent behavior18- Model and color customization1920## Agent File Structure2122### Complete Format2324```markdown25---26name: agent-identifier27description: Use this agent when [triggering conditions]. Examples:2829<example>30Context: [Situation description]31user: "[User request]"32assistant: "[How assistant should respond and use this agent]"33<commentary>34[Why this agent should be triggered]35</commentary>36</example>3738<example>39[Additional example...]40</example>4142model: inherit43color: blue44tools: ["Read", "Write", "Grep"]45---4647You are [agent role description]...4849**Your Core Responsibilities:**501. [Responsibility 1]512. [Responsibility 2]5253**Analysis Process:**54[Step-by-step workflow]5556**Output Format:**57[What to return]58```5960## Frontmatter Fields6162### name (required)6364Agent identifier used for namespacing and invocation.6566**Format:** lowercase, numbers, hyphens only67**Length:** 3-50 characters68**Pattern:** Must start and end with alphanumeric6970**Good examples:**71- `code-reviewer`72- `test-generator`73- `api-docs-writer`74- `security-analyzer`7576**Bad examples:**77- `helper` (too generic)78- `-agent-` (starts/ends with hyphen)79- `my_agent` (underscores not allowed)80- `ag` (too short, < 3 chars)8182### description (required)8384Defines when Claude should trigger this agent. **This is the most critical field.**8586**Must include:**871. Triggering conditions ("Use this agent when...")882. Multiple `<example>` blocks showing usage893. Context, user request, and assistant response in each example904. `<commentary>` explaining why agent triggers9192**Format:**93```94Use this agent when [conditions]. Examples:9596<example>97Context: [Scenario description]98user: "[What user says]"99assistant: "[How Claude should respond]"100<commentary>101[Why this agent is appropriate]102</commentary>103</example>104105[More examples...]106```107108**Best practices:**109- Include 2-4 concrete examples110- Show proactive and reactive triggering111- Cover different phrasings of same intent112- Explain reasoning in commentary113- Be specific about when NOT to use the agent114115### model (required)116117Which model the agent should use.118119**Options:**120- `inherit` - Use same model as parent (recommended)121- `sonnet` - Claude Sonnet (balanced)122- `opus` - Claude Opus (most capable, expensive)123- `haiku` - Claude Haiku (fast, cheap)124125**Recommendation:** Use `inherit` unless agent needs specific model capabilities.126127### color (required)128129Visual identifier for agent in UI.130131**Options:** `blue`, `cyan`, `green`, `yellow`, `magenta`, `red`132133**Guidelines:**134- Choose distinct colors for different agents in same plugin135- Use consistent colors for similar agent types136- Blue/cyan: Analysis, review137- Green: Success-oriented tasks138- Yellow: Caution, validation139- Red: Critical, security140- Magenta: Creative, generation141142### tools (optional)143144Restrict agent to specific tools.145146**Format:** Array of tool names147148```yaml149tools: ["Read", "Write", "Grep", "Bash"]150```151152**Default:** If omitted, agent has access to all tools153154**Best practice:** Limit tools to minimum needed (principle of least privilege)155156**Common tool sets:**157- Read-only analysis: `["Read", "Grep", "Glob"]`158- Code generation: `["Read", "Write", "Grep"]`159- Testing: `["Read", "Bash", "Grep"]`160- Full access: Omit field or use `["*"]`161162## System Prompt Design163164The markdown body becomes the agent's system prompt. Write in second person, addressing the agent directly.165166### Structure167168**Standard template:**169```markdown170You are [role] specializing in [domain].171172**Your Core Responsibilities:**1731. [Primary responsibility]1742. [Secondary responsibility]1753. [Additional responsibilities...]176177**Analysis Process:**1781. [Step one]1792. [Step two]1803. [Step three]181[...]182183**Quality Standards:**184- [Standard 1]185- [Standard 2]186187**Output Format:**188Provide results in this format:189- [What to include]190- [How to structure]191192**Edge Cases:**193Handle these situations:194- [Edge case 1]: [How to handle]195- [Edge case 2]: [How to handle]196```197198### Best Practices199200✅ **DO:**201- Write in second person ("You are...", "You will...")202- Be specific about responsibilities203- Provide step-by-step process204- Define output format205- Include quality standards206- Address edge cases207- Keep under 10,000 characters208209❌ **DON'T:**210- Write in first person ("I am...", "I will...")211- Be vague or generic212- Omit process steps213- Leave output format undefined214- Skip quality guidance215- Ignore error cases216217## Creating Agents218219### Method 1: AI-Assisted Generation220221Use this prompt pattern (extracted from Claude Code):222223```224Create an agent configuration based on this request: "[YOUR DESCRIPTION]"225226Requirements:2271. Extract core intent and responsibilities2282. Design expert persona for the domain2293. Create comprehensive system prompt with:230- Clear behavioral boundaries231- Specific methodologies232- Edge case handling233- Output format2344. Create identifier (lowercase, hyphens, 3-50 chars)2355. Write description with triggering conditions2366. Include 2-3 <example> blocks showing when to use237238Return JSON with:239{240"identifier": "agent-name",241"whenToUse": "Use this agent when... Examples: <example>...</example>",242"systemPrompt": "You are..."243}244```245246Then convert to agent file format with frontmatter.247248See `examples/agent-creation-prompt.md` for complete template.249250### Method 2: Manual Creation2512521. Choose agent identifier (3-50 chars, lowercase, hyphens)2532. Write description with examples2543. Select model (usually `inherit`)2554. Choose color for visual identification2565. Define tools (if restricting access)2576. Write system prompt with structure above2587. Save as `agents/agent-name.md`259260## Validation Rules261262### Identifier Validation263264```265✅ Valid: code-reviewer, test-gen, api-analyzer-v2266❌ Invalid: ag (too short), -start (starts with hyphen), my_agent (underscore)267```268269**Rules:**270- 3-50 characters271- Lowercase letters, numbers, hyphens only272- Must start and end with alphanumeric273- No underscores, spaces, or special characters274275### Description Validation276277**Length:** 10-5,000 characters278**Must include:** Triggering conditions and examples279**Best:** 200-1,000 characters with 2-4 examples280281### System Prompt Validation282283**Length:** 20-10,000 characters284**Best:** 500-3,000 characters285**Structure:** Clear responsibilities, process, output format286287## Agent Organization288289### Plugin Agents Directory290291```292plugin-name/293└── agents/294├── analyzer.md295├── reviewer.md296└── generator.md297```298299All `.md` files in `agents/` are auto-discovered.300301### Namespacing302303Agents are namespaced automatically:304- Single plugin: `agent-name`305- With subdirectories: `plugin:subdir:agent-name`306307## Testing Agents308309### Test Triggering310311Create test scenarios to verify agent triggers correctly:3123131. Write agent with specific triggering examples3142. Use similar phrasing to examples in test3153. Check Claude loads the agent3164. Verify agent provides expected functionality317318### Test System Prompt319320Ensure system prompt is complete:3213221. Give agent typical task3232. Check it follows process steps3243. Verify output format is correct3254. Test edge cases mentioned in prompt3265. Confirm quality standards are met327328## Quick Reference329330### Minimal Agent331332```markdown333---334name: simple-agent335description: Use this agent when... Examples: <example>...</example>336model: inherit337color: blue338---339340You are an agent that [does X].341342Process:3431. [Step 1]3442. [Step 2]345346Output: [What to provide]347```348349### Frontmatter Fields Summary350351| Field | Required | Format | Example |352|-------|----------|--------|---------|353| name | Yes | lowercase-hyphens | code-reviewer |354| description | Yes | Text + examples | Use when... <example>... |355| model | Yes | inherit/sonnet/opus/haiku | inherit |356| color | Yes | Color name | blue |357| tools | No | Array of tool names | ["Read", "Grep"] |358359### Best Practices360361**DO:**362- ✅ Include 2-4 concrete examples in description363- ✅ Write specific triggering conditions364- ✅ Use `inherit` for model unless specific need365- ✅ Choose appropriate tools (least privilege)366- ✅ Write clear, structured system prompts367- ✅ Test agent triggering thoroughly368369**DON'T:**370- ❌ Use generic descriptions without examples371- ❌ Omit triggering conditions372- ❌ Give all agents same color373- ❌ Grant unnecessary tool access374- ❌ Write vague system prompts375- ❌ Skip testing376377## Additional Resources378379### Reference Files380381For detailed guidance, consult:382383- **`references/system-prompt-design.md`** - Complete system prompt patterns384- **`references/triggering-examples.md`** - Example formats and best practices385- **`references/agent-creation-system-prompt.md`** - The exact prompt from Claude Code386387### Example Files388389Working examples in `examples/`:390391- **`agent-creation-prompt.md`** - AI-assisted agent generation template392- **`complete-agent-examples.md`** - Full agent examples for different use cases393394### Utility Scripts395396Development tools in `scripts/`:397398- **`validate-agent.sh`** - Validate agent file structure399- **`test-agent-trigger.sh`** - Test if agent triggers correctly400401## Implementation Workflow402403To create an agent for a plugin:4044051. Define agent purpose and triggering conditions4062. Choose creation method (AI-assisted or manual)4073. Create `agents/agent-name.md` file4084. Write frontmatter with all required fields4095. Write system prompt following best practices4106. Include 2-4 triggering examples in description4117. Validate with `scripts/validate-agent.sh`4128. Test triggering with real scenarios4139. Document agent in plugin README414415Focus on clear triggering conditions and comprehensive system prompts for autonomous operation.416