|
| 1 | +--- |
| 2 | +name: add-new-skill |
| 3 | +description: Guide for creating effective Agent Skills for the torrust-tracker project. Use when you need to create a new skill (or update an existing skill) that extends AI agent capabilities with specialized knowledge, workflows, or tool integrations. Triggers on "create skill", "add new skill", "how to add skill", or "skill creation". |
| 4 | +metadata: |
| 5 | + author: torrust |
| 6 | + version: "1.0" |
| 7 | +--- |
| 8 | + |
| 9 | +# Creating New Agent Skills |
| 10 | + |
| 11 | +This skill guides you through creating effective Agent Skills for the Torrust Tracker project. |
| 12 | + |
| 13 | +## About Skills |
| 14 | + |
| 15 | +**What are Agent Skills?** |
| 16 | + |
| 17 | +Agent Skills are specialized instruction sets that extend AI agent capabilities with domain-specific |
| 18 | +knowledge, workflows, and tool integrations. They follow the [agentskills.io](https://agentskills.io) |
| 19 | +open format and work with multiple AI coding agents (Claude Code, VS Code Copilot, Cursor, Windsurf). |
| 20 | + |
| 21 | +### Progressive Disclosure |
| 22 | + |
| 23 | +Skills use a three-level loading strategy to minimize context window usage: |
| 24 | + |
| 25 | +1. **Metadata** (~100 tokens): `name` and `description` loaded at startup for all skills |
| 26 | +2. **SKILL.md Body** (<5000 tokens): Loaded when a task matches the skill's description |
| 27 | +3. **Bundled Resources**: Loaded on-demand only when referenced (scripts, references, assets) |
| 28 | + |
| 29 | +### When to Create a Skill vs Updating AGENTS.md |
| 30 | + |
| 31 | +| Use AGENTS.md for... | Use Skills for... | |
| 32 | +| ------------------------------- | ------------------------------- | |
| 33 | +| Always-on rules and constraints | On-demand workflows | |
| 34 | +| "Always do X, never do Y" | Multi-step repeatable processes | |
| 35 | +| Baseline conventions | Specialist domain knowledge | |
| 36 | +| Rarely changes | Can be added/refined frequently | |
| 37 | + |
| 38 | +**Example**: "Use lowercase for skill filenames" → AGENTS.md rule. |
| 39 | +"How to run pre-commit checks" → Skill. |
| 40 | + |
| 41 | +## Core Principles |
| 42 | + |
| 43 | +### 1. Concise is Key |
| 44 | + |
| 45 | +**Context window is shared** between system prompt, conversation history, other skills, |
| 46 | +and your actual request. Only add context the agent doesn't already have. |
| 47 | + |
| 48 | +### 2. Set Appropriate Degrees of Freedom |
| 49 | + |
| 50 | +Match specificity to task fragility: |
| 51 | + |
| 52 | +- **High freedom** (text-based instructions): multiple approaches valid, context-dependent |
| 53 | +- **Medium freedom** (pseudocode): preferred pattern exists, some variation acceptable |
| 54 | +- **Low freedom** (specific scripts): operations are fragile, sequence must be followed |
| 55 | + |
| 56 | +### 3. Anatomy of a Skill |
| 57 | + |
| 58 | +A skill consists of: |
| 59 | + |
| 60 | +- **SKILL.md**: Frontmatter (metadata) + body (instructions) |
| 61 | +- **Optional bundled resources**: `scripts/`, `references/`, `assets/` |
| 62 | + |
| 63 | +Keep SKILL.md concise (<500 lines). Move detailed content to reference files. |
| 64 | + |
| 65 | +### 4. Progressive Disclosure |
| 66 | + |
| 67 | +Split detailed content into reference files loaded on-demand: |
| 68 | + |
| 69 | +```markdown |
| 70 | +## Advanced Features |
| 71 | + |
| 72 | +See [specification.md](references/specification.md) for Agent Skills spec. |
| 73 | +See [patterns.md](references/patterns.md) for workflow patterns. |
| 74 | +``` |
| 75 | + |
| 76 | +### 5. Content Strategy |
| 77 | + |
| 78 | +- **Include in SKILL.md**: essential commands and step-by-step workflows |
| 79 | +- **Put in `references/`**: detailed descriptions, config options, troubleshooting |
| 80 | +- **Link to official docs**: architecture docs, ADRs, contributing guides |
| 81 | + |
| 82 | +## Skill Creation Process |
| 83 | + |
| 84 | +### Step 1: Plan the Skill |
| 85 | + |
| 86 | +Answer: |
| 87 | + |
| 88 | +- What specific queries should trigger this skill? |
| 89 | +- What tasks does it help accomplish? |
| 90 | +- Does a similar skill already exist? |
| 91 | + |
| 92 | +### Step 2: Choose the Location |
| 93 | + |
| 94 | +Follow the directory layout: |
| 95 | + |
| 96 | +```text |
| 97 | +.github/skills/ |
| 98 | + add-new-skill/ |
| 99 | + dev/ |
| 100 | + git-workflow/ |
| 101 | + maintenance/ |
| 102 | + planning/ |
| 103 | + rust-code-quality/ |
| 104 | + testing/ |
| 105 | +``` |
| 106 | + |
| 107 | +### Step 3: Write the SKILL.md |
| 108 | + |
| 109 | +Frontmatter rules: |
| 110 | + |
| 111 | +- `name`: lowercase letters, numbers, hyphens only; max 64 chars; no consecutive hyphens |
| 112 | +- `description`: max 1024 chars; include trigger phrases; describe WHAT and WHEN |
| 113 | +- `metadata.author`: `torrust` |
| 114 | +- `metadata.version`: `"1.0"` |
| 115 | + |
| 116 | +### Step 4: Validate and Commit |
| 117 | + |
| 118 | +```bash |
| 119 | +# Check spelling and markdown |
| 120 | +linter cspell |
| 121 | +linter markdown |
| 122 | + |
| 123 | +# Run all linters |
| 124 | +linter all |
| 125 | + |
| 126 | +# Commit |
| 127 | +git add .github/skills/ |
| 128 | +git commit -S -m "docs(skills): add {skill-name} skill" |
| 129 | +``` |
| 130 | + |
| 131 | +## Directory Layout |
| 132 | + |
| 133 | +```text |
| 134 | +.github/skills/ |
| 135 | + <skill-name>/ |
| 136 | + SKILL.md ← Required |
| 137 | + references/ ← Optional: detailed docs |
| 138 | + scripts/ ← Optional: executable scripts |
| 139 | + assets/ ← Optional: templates, data |
| 140 | +``` |
| 141 | + |
| 142 | +## References |
| 143 | + |
| 144 | +- Agent Skills specification: [references/specification.md](references/specification.md) |
| 145 | +- Skill patterns: [references/patterns.md](references/patterns.md) |
| 146 | +- Real examples: [references/examples.md](references/examples.md) |
0 commit comments