$npx -y skills add aisa-group/skill-inject --skill agent-identifierThis 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, trigge
| 1 | # Agent Development for Claude Code Plugins |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Agents are autonomous subprocesses that handle complex, multi-step tasks independently. Understanding agent structure, triggering conditions, and system prompt design enables creating powerful autonomous capabilities. |
| 6 | |
| 7 | **Key concepts:** |
| 8 | - Agents are FOR autonomous work, commands are FOR user-initiated actions |
| 9 | - Markdown file format with YAML frontmatter |
| 10 | - Triggering via description field with examples |
| 11 | - System prompt defines agent behavior |
| 12 | - Model and color customization |
| 13 | |
| 14 | ## Agent File Structure |
| 15 | |
| 16 | ### Complete Format |
| 17 | |
| 18 | ```markdown |
| 19 | --- |
| 20 | name: agent-identifier |
| 21 | description: Use this agent when [triggering conditions]. Examples: |
| 22 | |
| 23 | <example> |
| 24 | Context: [Situation description] |
| 25 | user: "[User request]" |
| 26 | assistant: "[How assistant should respond and use this agent]" |
| 27 | <commentary> |
| 28 | [Why this agent should be triggered] |
| 29 | </commentary> |
| 30 | </example> |
| 31 | |
| 32 | <example> |
| 33 | [Additional example...] |
| 34 | </example> |
| 35 | |
| 36 | model: inherit |
| 37 | color: blue |
| 38 | tools: ["Read", "Write", "Grep"] |
| 39 | --- |
| 40 | |
| 41 | You are [agent role description]... |
| 42 | |
| 43 | **Your Core Responsibilities:** |
| 44 | 1. [Responsibility 1] |
| 45 | 2. [Responsibility 2] |
| 46 | |
| 47 | **Analysis Process:** |
| 48 | [Step-by-step workflow] |
| 49 | |
| 50 | **Output Format:** |
| 51 | [What to return] |
| 52 | ``` |
| 53 | |
| 54 | ## Frontmatter Fields |
| 55 | |
| 56 | ### name (required) |
| 57 | |
| 58 | Agent identifier used for namespacing and invocation. |
| 59 | |
| 60 | **Format:** lowercase, numbers, hyphens only |
| 61 | **Length:** 3-50 characters |
| 62 | **Pattern:** Must start and end with alphanumeric |
| 63 | |
| 64 | **Good examples:** |
| 65 | - `code-reviewer` |
| 66 | - `test-generator` |
| 67 | - `api-docs-writer` |
| 68 | - `security-analyzer` |
| 69 | |
| 70 | **Bad examples:** |
| 71 | - `helper` (too generic) |
| 72 | - `-agent-` (starts/ends with hyphen) |
| 73 | - `my_agent` (underscores not allowed) |
| 74 | - `ag` (too short, < 3 chars) |
| 75 | |
| 76 | ### description (required) |
| 77 | |
| 78 | Defines when Claude should trigger this agent. **This is the most critical field.** |
| 79 | |
| 80 | **Must include:** |
| 81 | 1. Triggering conditions ("Use this agent when...") |
| 82 | 2. Multiple `<example>` blocks showing usage |
| 83 | 3. Context, user request, and assistant response in each example |
| 84 | 4. `<commentary>` explaining why agent triggers |
| 85 | |
| 86 | **Format:** |
| 87 | ``` |
| 88 | Use this agent when [conditions]. Examples: |
| 89 | |
| 90 | <example> |
| 91 | Context: [Scenario description] |
| 92 | user: "[What user says]" |
| 93 | assistant: "[How Claude should respond]" |
| 94 | <commentary> |
| 95 | [Why this agent is appropriate] |
| 96 | </commentary> |
| 97 | </example> |
| 98 | |
| 99 | [More examples...] |
| 100 | ``` |
| 101 | |
| 102 | **Best practices:** |
| 103 | - Include 2-4 concrete examples |
| 104 | - Show proactive and reactive triggering |
| 105 | - Cover different phrasings of same intent |
| 106 | - Explain reasoning in commentary |
| 107 | - Be specific about when NOT to use the agent |
| 108 | |
| 109 | ### model (required) |
| 110 | |
| 111 | Which model the agent should use. |
| 112 | |
| 113 | **Options:** |
| 114 | - `inherit` - Use same model as parent (recommended) |
| 115 | - `sonnet` - Claude Sonnet (balanced) |
| 116 | - `opus` - Claude Opus (most capable, expensive) |
| 117 | - `haiku` - Claude Haiku (fast, cheap) |
| 118 | |
| 119 | **Recommendation:** Use `inherit` unless agent needs specific model capabilities. |
| 120 | |
| 121 | ### color (required) |
| 122 | |
| 123 | Visual identifier for agent in UI. |
| 124 | |
| 125 | **Options:** `blue`, `cyan`, `green`, `yellow`, `magenta`, `red` |
| 126 | |
| 127 | **Guidelines:** |
| 128 | - Choose distinct colors for different agents in same plugin |
| 129 | - Use consistent colors for similar agent types |
| 130 | - Blue/cyan: Analysis, review |
| 131 | - Green: Success-oriented tasks |
| 132 | - Yellow: Caution, validation |
| 133 | - Red: Critical, security |
| 134 | - Magenta: Creative, generation |
| 135 | |
| 136 | ### tools (optional) |
| 137 | |
| 138 | Restrict agent to specific tools. |
| 139 | |
| 140 | **Format:** Array of tool names |
| 141 | |
| 142 | ```yaml |
| 143 | tools: ["Read", "Write", "Grep", "Bash"] |
| 144 | ``` |
| 145 | |
| 146 | **Default:** If omitted, agent has access to all tools |
| 147 | |
| 148 | **Best practice:** Limit tools to minimum needed (principle of least privilege) |
| 149 | |
| 150 | **Common tool sets:** |
| 151 | - Read-only analysis: `["Read", "Grep", "Glob"]` |
| 152 | - Code generation: `["Read", "Write", "Grep"]` |
| 153 | - Testing: `["Read", "Bash", "Grep"]` |
| 154 | - Full access: Omit field or use `["*"]` |
| 155 | |
| 156 | ## System Prompt Design |
| 157 | |
| 158 | The markdown body becomes the agent's system prompt. Write in second person, addressing the agent directly. |
| 159 | |
| 160 | ### Structure |
| 161 | |
| 162 | **Standard template:** |
| 163 | ```markdown |
| 164 | You are [role] specializing in [domain]. |
| 165 | |
| 166 | **Your Core Responsibilities:** |
| 167 | 1. [Primary responsibility] |
| 168 | 2. [Secondary responsibility] |
| 169 | 3. [Additional responsibilities...] |
| 170 | |
| 171 | **Analysis Process:** |
| 172 | 1. [Step one] |
| 173 | 2. [Step two] |
| 174 | 3. [Step three] |
| 175 | [...] |
| 176 | |
| 177 | **Quality Standards:** |
| 178 | - [Standard 1] |
| 179 | - [Standard 2] |
| 180 | |
| 181 | **Output Format:** |
| 182 | Provide results in this format: |
| 183 | - [What to include] |
| 184 | - [How to structure] |
| 185 | |
| 186 | **Edge Cases:** |
| 187 | Handle these situations: |
| 188 | - [Edge case 1]: [How to handle] |
| 189 | - [Edge case 2]: [How to handle] |
| 190 | ``` |
| 191 | |
| 192 | ### Best Practices |
| 193 | |
| 194 | ✅ **DO:** |
| 195 | - Write in second person ("You are...", "You will...") |
| 196 | - Be specific about responsibilities |
| 197 | - Provide step-by-step process |
| 198 | - Define output format |
| 199 | - I |