|
| 1 | +--- |
| 2 | +name: skill-authoring |
| 3 | +description: Guide for creating and maintaining user-facing agent skills |
| 4 | +--- |
| 5 | + |
| 6 | +# Skill Authoring Guide |
| 7 | + |
| 8 | +This skill guides you through creating user-facing agent skills. For the canonical reference, see [agentskills.io](https://agentskills.io/home). |
| 9 | + |
| 10 | +## Skill Structure |
| 11 | + |
| 12 | +A skill is a folder containing a `SKILL.md` file with metadata and instructions: |
| 13 | + |
| 14 | +``` |
| 15 | +my-skill/ |
| 16 | +├── SKILL.md # Required: instructions + metadata |
| 17 | +├── scripts/ # Optional: executable code |
| 18 | +├── references/ # Optional: additional documentation |
| 19 | +└── assets/ # Optional: templates, resources |
| 20 | +``` |
| 21 | + |
| 22 | +## SKILL.md Format |
| 23 | + |
| 24 | +### Required Frontmatter |
| 25 | + |
| 26 | +```yaml |
| 27 | +--- |
| 28 | +name: skill-name |
| 29 | +description: Brief description of what the skill does |
| 30 | +--- |
| 31 | +``` |
| 32 | + |
| 33 | +- **name**: Unique identifier (lowercase, hyphens) |
| 34 | +- **description**: One-line summary (loaded at startup for all skills) |
| 35 | + |
| 36 | +### Instructions Body |
| 37 | + |
| 38 | +The body contains markdown instructions that tell the agent how to perform the task. |
| 39 | + |
| 40 | +```markdown |
| 41 | +--- |
| 42 | +name: my-skill |
| 43 | +description: Does something useful |
| 44 | +--- |
| 45 | + |
| 46 | +# Skill Title |
| 47 | + |
| 48 | +Brief overview of what this skill helps accomplish. |
| 49 | + |
| 50 | +## When to Use |
| 51 | + |
| 52 | +Describe scenarios when this skill applies. |
| 53 | + |
| 54 | +## How to Use |
| 55 | + |
| 56 | +Step-by-step instructions or patterns. |
| 57 | + |
| 58 | +## Examples |
| 59 | + |
| 60 | +Concrete examples demonstrating usage. |
| 61 | + |
| 62 | +## Reference |
| 63 | + |
| 64 | +- [Detailed Reference](references/REFERENCE.md) - Link to additional docs |
| 65 | +``` |
| 66 | + |
| 67 | +## Progressive Disclosure |
| 68 | + |
| 69 | +Structure skills for efficient context usage: |
| 70 | + |
| 71 | +| Layer | Token Budget | When Loaded | |
| 72 | +|-------|--------------|-------------| |
| 73 | +| Metadata | ~100 tokens | At startup (all skills) | |
| 74 | +| Instructions | < 5000 tokens | When skill activated | |
| 75 | +| References | As needed | On demand | |
| 76 | + |
| 77 | +### Guidelines |
| 78 | + |
| 79 | +1. **Keep SKILL.md under 500 lines** - Move detailed content to references |
| 80 | +2. **Front-load key information** - Put most important patterns first |
| 81 | +3. **Use tables for quick reference** - Easy to scan |
| 82 | +4. **Link to references** - Don't inline everything |
| 83 | + |
| 84 | +## Optional Directories |
| 85 | + |
| 86 | +### scripts/ |
| 87 | + |
| 88 | +Executable code that agents can run: |
| 89 | + |
| 90 | +``` |
| 91 | +scripts/ |
| 92 | +├── validate.sh # Validation script |
| 93 | +├── generate.py # Code generator |
| 94 | +└── setup.js # Setup helper |
| 95 | +``` |
| 96 | + |
| 97 | +Scripts should: |
| 98 | +- Be self-contained or document dependencies |
| 99 | +- Include helpful error messages |
| 100 | +- Handle edge cases gracefully |
| 101 | + |
| 102 | +### references/ |
| 103 | + |
| 104 | +Additional documentation loaded on demand: |
| 105 | + |
| 106 | +``` |
| 107 | +references/ |
| 108 | +├── PATTERNS.md # Common patterns |
| 109 | +├── API.md # API reference |
| 110 | +└── EXAMPLES.md # Extended examples |
| 111 | +``` |
| 112 | + |
| 113 | +Keep individual reference files focused. Smaller files = less context usage. |
| 114 | + |
| 115 | +### assets/ |
| 116 | + |
| 117 | +Static resources: |
| 118 | + |
| 119 | +``` |
| 120 | +assets/ |
| 121 | +├── template.xml # File templates |
| 122 | +├── schema.json # Schemas |
| 123 | +└── diagram.png # Visual aids |
| 124 | +``` |
| 125 | + |
| 126 | +## File References |
| 127 | + |
| 128 | +Use relative paths from the skill root: |
| 129 | + |
| 130 | +```markdown |
| 131 | +See [the reference guide](references/REFERENCE.md) for details. |
| 132 | + |
| 133 | +Run the setup script: |
| 134 | +scripts/setup.sh |
| 135 | +``` |
| 136 | + |
| 137 | +Keep references one level deep. Avoid deeply nested chains. |
| 138 | + |
| 139 | +## Skill Categories |
| 140 | + |
| 141 | +### Developer Skills (`.claude/skills/`) |
| 142 | + |
| 143 | +Skills for contributors working on this codebase: |
| 144 | + |
| 145 | +- Command development patterns |
| 146 | +- Testing approaches |
| 147 | +- API client patterns |
| 148 | +- Documentation standards |
| 149 | + |
| 150 | +### User-Facing Skills (`plugins/*/skills/`) |
| 151 | + |
| 152 | +Skills for users of the tool: |
| 153 | + |
| 154 | +- CLI command usage |
| 155 | +- Platform-specific patterns (B2C Commerce) |
| 156 | +- Integration guides |
| 157 | + |
| 158 | +## Writing Effective Skills |
| 159 | + |
| 160 | +### 1. Start with the User's Goal |
| 161 | + |
| 162 | +```markdown |
| 163 | +## Overview |
| 164 | + |
| 165 | +This skill helps you [accomplish X] by [doing Y]. |
| 166 | +``` |
| 167 | + |
| 168 | +### 2. Provide Quick Reference Tables |
| 169 | + |
| 170 | +```markdown |
| 171 | +| Command | Description | |
| 172 | +|---------|-------------| |
| 173 | +| `cmd1` | Does X | |
| 174 | +| `cmd2` | Does Y | |
| 175 | +``` |
| 176 | + |
| 177 | +### 3. Show Concrete Examples |
| 178 | + |
| 179 | +```markdown |
| 180 | +## Examples |
| 181 | + |
| 182 | +### Basic Usage |
| 183 | + |
| 184 | +\`\`\`bash |
| 185 | +b2c command --flag value |
| 186 | +\`\`\` |
| 187 | + |
| 188 | +### Advanced Usage |
| 189 | + |
| 190 | +\`\`\`bash |
| 191 | +b2c command --complex-flag |
| 192 | +\`\`\` |
| 193 | +``` |
| 194 | + |
| 195 | +### 4. Explain When NOT to Use |
| 196 | + |
| 197 | +```markdown |
| 198 | +## When NOT to Use |
| 199 | + |
| 200 | +- Scenario A (use skill-x instead) |
| 201 | +- Scenario B (manual approach better) |
| 202 | +``` |
| 203 | + |
| 204 | +### 5. Link to Authoritative Sources |
| 205 | + |
| 206 | +Reference official documentation rather than duplicating it: |
| 207 | + |
| 208 | +```markdown |
| 209 | +## Reference |
| 210 | + |
| 211 | +For complete API documentation, see [Official Docs](https://example.com/docs). |
| 212 | +``` |
| 213 | + |
| 214 | +## Validation Checklist |
| 215 | + |
| 216 | +Before publishing a skill: |
| 217 | + |
| 218 | +- [ ] Frontmatter has `name` and `description` |
| 219 | +- [ ] SKILL.md under 500 lines |
| 220 | +- [ ] Key information appears early |
| 221 | +- [ ] Examples are concrete and runnable |
| 222 | +- [ ] Reference links are valid |
| 223 | +- [ ] No deeply nested reference chains |
| 224 | +- [ ] Tested with target agent |
| 225 | + |
| 226 | +## Detailed Reference |
| 227 | + |
| 228 | +- [Patterns and Examples](references/PATTERNS.md) - Patterns from B2C skills |
0 commit comments