surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
Document the `skills` frontmatter field added in v2.0.43 for declaring skills to auto-load for subagents and commands. This helps ensure skills persist across context compaction by explicitly declaring required skills. - Add skills field to agent-development SKILL.md frontmatter fields section - Add skills field to command-development frontmatter-reference.md - Update examples, validation checklists, and best practices
| Mplugins/plugin-dev/skills/agent-development/SKILL.md |
| Mplugins/plugin-dev/skills/command-development/references/frontmatter-reference.md |
| @@ -42,6 +42,7 @@ | ||
| 42 | 42 | model: inherit |
| 43 | 43 | color: blue |
| 44 | 44 | tools: ["Read", "Write", "Grep"] |
| 45 | +skills: skill-name-1, skill-name-2 | |
| 45 | 46 | --- |
| 46 | 47 | |
| 47 | 48 | You are [agent role description]... |
| @@ -159,6 +160,35 @@ | ||
| 159 | 160 | - Testing: `["Read", "Bash", "Grep"]` |
| 160 | 161 | - Full access: Omit field or use `["*"]` |
| 161 | 162 | |
| 163 | +### skills (optional) | |
| 164 | + | |
| 165 | +Declare skills to auto-load when this agent is invoked. | |
| 166 | + | |
| 167 | +**Format:** Comma-separated list of skill names | |
| 168 | + | |
| 169 | +```yaml | |
| 170 | +skills: database-migration, postgres-ops | |
| 171 | +``` | |
| 172 | + | |
| 173 | +**Purpose:** Ensures specific skills are always available to the agent, regardless of context matching. This is especially useful for: | |
| 174 | +- Skills that should persist across context compaction | |
| 175 | +- Specialized agents that always need certain domain knowledge | |
| 176 | +- Ensuring consistent agent behavior with required skills | |
| 177 | + | |
| 178 | +**Example:** | |
| 179 | +```yaml | |
| 180 | +--- | |
| 181 | +name: db-admin | |
| 182 | +description: Use this agent for database administration tasks... | |
| 183 | +model: inherit | |
| 184 | +color: cyan | |
| 185 | +tools: ["Bash", "Read", "Write"] | |
| 186 | +skills: database-migration, sql-optimization | |
| 187 | +--- | |
| 188 | +``` | |
| 189 | + | |
| 190 | +**Best practice:** Only declare skills essential to the agent's core function. Let context-triggered skills load naturally for optional capabilities. | |
| 191 | + | |
| 162 | 192 | ## System Prompt Design |
| 163 | 193 | |
| 164 | 194 | The markdown body becomes the agent's system prompt. Write in second person, addressing the agent directly. |
| @@ -355,6 +385,7 @@ | ||
| 355 | 385 | | model | Yes | inherit/sonnet/opus/haiku | inherit | |
| 356 | 386 | | color | Yes | Color name | blue | |
| 357 | 387 | | tools | No | Array of tool names | ["Read", "Grep"] | |
| 388 | +| skills | No | Comma-separated names | skill-a, skill-b | | |
| 358 | 389 | |
| 359 | 390 | ### Best Practices |
| 360 | 391 |
| @@ -12,6 +12,7 @@ | ||
| 12 | 12 | allowed-tools: Read, Write |
| 13 | 13 | model: sonnet |
| 14 | 14 | argument-hint: [arg1] [arg2] |
| 15 | +skills: skill-a, skill-b | |
| 15 | 16 | --- |
| 16 | 17 | |
| 17 | 18 | Command prompt content here... |
| @@ -321,6 +322,51 @@ | ||
| 321 | 322 | - Document why in command comments |
| 322 | 323 | - Consider if command should exist if always manual |
| 323 | 324 | |
| 325 | +### skills | |
| 326 | + | |
| 327 | +**Type:** String (comma-separated list) | |
| 328 | +**Required:** No | |
| 329 | +**Default:** None | |
| 330 | + | |
| 331 | +**Purpose:** Declare skills to auto-load when this command executes. Ensures specific skills are always available regardless of context matching. | |
| 332 | + | |
| 333 | +**Examples:** | |
| 334 | +```yaml | |
| 335 | +skills: database-migration, sql-optimization | |
| 336 | +``` | |
| 337 | + | |
| 338 | +**When to use:** | |
| 339 | + | |
| 340 | +1. **Commands requiring domain knowledge:** Ensure relevant skills load | |
| 341 | + ```yaml | |
| 342 | + --- | |
| 343 | + description: Run database migration | |
| 344 | + skills: database-migration, postgres-ops | |
| 345 | + --- | |
| 346 | + ``` | |
| 347 | + | |
| 348 | +2. **Skills that should persist across compaction:** Force-load skills that might otherwise be lost | |
| 349 | + ```yaml | |
| 350 | + --- | |
| 351 | + description: Complex multi-step workflow | |
| 352 | + skills: workflow-skill, validation-skill | |
| 353 | + --- | |
| 354 | + ``` | |
| 355 | + | |
| 356 | +3. **Specialized commands:** Commands that always need specific expertise | |
| 357 | + ```yaml | |
| 358 | + --- | |
| 359 | + description: Generate API documentation | |
| 360 | + skills: api-documentation, openapi-spec | |
| 361 | + --- | |
| 362 | + ``` | |
| 363 | + | |
| 364 | +**Best practices:** | |
| 365 | +- Only declare skills essential to the command's function | |
| 366 | +- Use skill names exactly as defined in SKILL.md frontmatter | |
| 367 | +- Keep the list focused (2-4 skills max) | |
| 368 | +- Let context-triggered skills load naturally for optional capabilities | |
| 369 | + | |
| 324 | 370 | ## Complete Examples |
| 325 | 371 | |
| 326 | 372 | ### Minimal Command |
| @@ -451,6 +497,7 @@ | ||
| 451 | 497 | - [ ] model is valid value if specified |
| 452 | 498 | - [ ] argument-hint matches positional arguments |
| 453 | 499 | - [ ] disable-model-invocation used appropriately |
| 500 | +- [ ] skills references valid skill names if specified | |
| 454 | 501 | |
| 455 | 502 | ## Best Practices Summary |
| 456 | 503 | |
| @@ -460,4 +507,5 @@ | ||
| 460 | 507 | 4. **Choose right model:** Use haiku for speed, opus for complexity |
| 461 | 508 | 5. **Manual-only sparingly:** Only use disable-model-invocation when necessary |
| 462 | 509 | 6. **Clear descriptions:** Make commands discoverable in `/help` |
| 463 | -7. **Test thoroughly:** Verify frontmatter works as expected | |
| 510 | +7. **Declare essential skills:** Use skills field for domain knowledge that must persist | |
| 511 | +8. **Test thoroughly:** Verify frontmatter works as expected |