references/discovery.md
Writing SKILL.md for Discovery
Section titled “Writing SKILL.md for Discovery”Part of superpowers:writing-skills: the SKILL.md template and how to name, describe and size a skill so agents find it and read it.
SKILL.md Structure
Section titled “SKILL.md Structure”Frontmatter (YAML):
- Two required fields:
nameanddescription(see agentskills.io/specification for all supported fields) - Max 1024 characters total
name: Use letters, numbers, and hyphens only (no parentheses, special chars)description: Third-person, describes ONLY when to use (NOT what it does)- Start with “Use when…” to focus on triggering conditions
- Include specific symptoms, situations, and contexts
- NEVER summarize the skill’s process or workflow (see Skill Discovery Optimization below for why)
- Keep under 500 characters if possible
---name: Skill-Name-With-Hyphensdescription: Use when [specific triggering conditions and symptoms]---
# Skill Name
## OverviewWhat is this? Core principle in 1-2 sentences.
## When to Use[Small inline flowchart IF decision non-obvious]
Bullet list with SYMPTOMS and use casesWhen NOT to use
## Core Pattern (for techniques/patterns)Before/after code comparison
## Quick ReferenceTable or bullets for scanning common operations
## ImplementationInline code for simple patternsLink to file for heavy reference or reusable tools
## Common MistakesWhat goes wrong + fixes
## Real-World Impact (optional)Concrete resultsSkill Discovery Optimization (SDO)
Section titled “Skill Discovery Optimization (SDO)”Critical for discovery: Future agents need to FIND your skill
1. Rich Description Field
Section titled “1. Rich Description Field”Purpose: Your agent reads the description to decide which skills to load for a given task. Make it answer: “Should I read this skill right now?”
Format: Start with “Use when…” to focus on triggering conditions
CRITICAL: Description = When to Use, NOT What the Skill Does
The description should ONLY describe triggering conditions. Do NOT summarize the skill’s process or workflow in the description.
Why this matters: Testing revealed that when a description summarizes the skill’s workflow, an agent may follow the description instead of reading the full skill content. A description saying “code review between tasks” caused an agent to do ONE review, even though the skill’s flowchart clearly showed TWO reviews (spec compliance then code quality).
When the description was changed to just “Use when executing implementation plans with independent tasks” (no workflow summary), the agent correctly read the flowchart and followed the two-stage review process.
The trap: Descriptions that summarize workflow create a shortcut agents will take. The skill body becomes documentation agents skip.
# ❌ BAD: Summarizes workflow - agents may follow this instead of reading skilldescription: Use when executing plans - dispatches subagent per task with code review between tasks
# ❌ BAD: Too much process detaildescription: Use for TDD - write test first, watch it fail, write minimal code, refactor
# ✅ GOOD: Just triggering conditions, no workflow summarydescription: Use when executing implementation plans with independent tasks in the current session
# ✅ GOOD: Triggering conditions onlydescription: Use when implementing any feature or bugfix, before writing implementation codeContent:
- Use concrete triggers, symptoms, and situations that signal this skill applies
- Describe the problem (race conditions, inconsistent behavior) not language-specific symptoms (setTimeout, sleep)
- Keep triggers technology-agnostic unless the skill itself is technology-specific
- If skill is technology-specific, make that explicit in the trigger
- Write in third person (injected into system prompt)
- NEVER summarize the skill’s process or workflow
# ❌ BAD: Too abstract, vague, doesn't include when to usedescription: For async testing
# ❌ BAD: First persondescription: I can help you with async tests when they're flaky
# ❌ BAD: Mentions technology but skill isn't specific to itdescription: Use when tests use setTimeout/sleep and are flaky
# ✅ GOOD: Starts with "Use when", describes problem, no workflowdescription: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently
# ✅ GOOD: Technology-specific skill with explicit triggerdescription: Use when using React Router and handling authentication redirects2. Keyword Coverage
Section titled “2. Keyword Coverage”Use words an agent would search for:
- Error messages: “Hook timed out”, “ENOTEMPTY”, “race condition”
- Symptoms: “flaky”, “hanging”, “zombie”, “pollution”
- Synonyms: “timeout/hang/freeze”, “cleanup/teardown/afterEach”
- Tools: Actual commands, library names, file types
3. Descriptive Naming
Section titled “3. Descriptive Naming”Use active voice, verb-first:
- ✅
creating-skillsnotskill-creation - ✅
condition-based-waitingnotasync-test-helpers
4. Token Efficiency (Critical)
Section titled “4. Token Efficiency (Critical)”Problem: getting-started and frequently-referenced skills load into EVERY conversation. Every token counts.
Target word counts:
- getting-started workflows: <150 words each
- Frequently-loaded skills: <200 words total
- Other skills: <500 words (still be concise)
Techniques:
Move details to tool help:
# ❌ BAD: Document all flags in SKILL.mdsearch-conversations supports --text, --both, --after DATE, --before DATE, --limit N
# ✅ GOOD: Reference --helpsearch-conversations supports multiple modes and filters. Run --help for details.Use cross-references:
# ❌ BAD: Repeat workflow detailsWhen searching, dispatch subagent with template...[20 lines of repeated instructions]
# ✅ GOOD: Reference other skillAlways use subagents (50-100x context savings). REQUIRED: Use [other-skill-name] for workflow.Compress examples:
# ❌ BAD: Verbose example (42 words)your human partner: "How did we handle authentication errors in React Router before?"You: I'll search past conversations for React Router authentication patterns.[Dispatch subagent with search query: "React Router authentication error handling 401"]
# ✅ GOOD: Minimal example (20 words)Partner: "How did we handle auth errors in React Router?"You: Searching...[Dispatch subagent → synthesis]Eliminate redundancy:
- Don’t repeat what’s in cross-referenced skills
- Don’t explain what’s obvious from command
- Don’t include multiple examples of same pattern
Verification:
wc -w skills/path/SKILL.md# getting-started workflows: aim for <150 each# Other frequently-loaded: aim for <200 totalName by what you DO or core insight:
- ✅
condition-based-waiting>async-test-helpers - ✅
using-skillsnotskill-usage - ✅
flatten-with-flags>data-structure-refactoring - ✅
root-cause-tracing>debugging-techniques
Gerunds (-ing) work well for processes:
creating-skills,testing-skills,debugging-with-logs- Active, describes the action you’re taking
5. Cross-Referencing Other Skills
Section titled “5. Cross-Referencing Other Skills”When writing documentation that references other skills:
Use skill name only, with explicit requirement markers:
- ✅ Good:
**REQUIRED SUB-SKILL:** Use superpowers:test-driven-development - ✅ Good:
**REQUIRED BACKGROUND:** You MUST understand superpowers:systematic-debugging - ❌ Bad:
See skills/testing/test-driven-development(unclear if required) - ❌ Bad:
@skills/testing/test-driven-development/SKILL.md(force-loads, burns context)
Why no @ links: @ syntax force-loads files immediately, consuming 200k+ context before you need them.
Original Markdown source
# Writing SKILL.md for Discovery
Part of superpowers:writing-skills: the SKILL.md template and how to name,describe and size a skill so agents find it and read it.
## SKILL.md Structure
**Frontmatter (YAML):**- Two required fields: `name` and `description` (see [agentskills.io/specification](https://agentskills.io/specification) for all supported fields)- Max 1024 characters total- `name`: Use letters, numbers, and hyphens only (no parentheses, special chars)- `description`: Third-person, describes ONLY when to use (NOT what it does) - Start with "Use when..." to focus on triggering conditions - Include specific symptoms, situations, and contexts - **NEVER summarize the skill's process or workflow** (see Skill Discovery Optimization below for why) - Keep under 500 characters if possible
```markdown---name: Skill-Name-With-Hyphensdescription: Use when [specific triggering conditions and symptoms]---
# Skill Name
## OverviewWhat is this? Core principle in 1-2 sentences.
## When to Use[Small inline flowchart IF decision non-obvious]
Bullet list with SYMPTOMS and use casesWhen NOT to use
## Core Pattern (for techniques/patterns)Before/after code comparison
## Quick ReferenceTable or bullets for scanning common operations
## ImplementationInline code for simple patternsLink to file for heavy reference or reusable tools
## Common MistakesWhat goes wrong + fixes
## Real-World Impact (optional)Concrete results```
## Skill Discovery Optimization (SDO)
**Critical for discovery:** Future agents need to FIND your skill
### 1. Rich Description Field
**Purpose:** Your agent reads the description to decide which skills to load for a given task. Make it answer: "Should I read this skill right now?"
**Format:** Start with "Use when..." to focus on triggering conditions
**CRITICAL: Description = When to Use, NOT What the Skill Does**
The description should ONLY describe triggering conditions. Do NOT summarize the skill's process or workflow in the description.
**Why this matters:** Testing revealed that when a description summarizes the skill's workflow, an agent may follow the description instead of reading the full skill content. A description saying "code review between tasks" caused an agent to do ONE review, even though the skill's flowchart clearly showed TWO reviews (spec compliance then code quality).
When the description was changed to just "Use when executing implementation plans with independent tasks" (no workflow summary), the agent correctly read the flowchart and followed the two-stage review process.
**The trap:** Descriptions that summarize workflow create a shortcut agents will take. The skill body becomes documentation agents skip.
```yaml# ❌ BAD: Summarizes workflow - agents may follow this instead of reading skilldescription: Use when executing plans - dispatches subagent per task with code review between tasks
# ❌ BAD: Too much process detaildescription: Use for TDD - write test first, watch it fail, write minimal code, refactor
# ✅ GOOD: Just triggering conditions, no workflow summarydescription: Use when executing implementation plans with independent tasks in the current session
# ✅ GOOD: Triggering conditions onlydescription: Use when implementing any feature or bugfix, before writing implementation code```
**Content:**- Use concrete triggers, symptoms, and situations that signal this skill applies- Describe the *problem* (race conditions, inconsistent behavior) not *language-specific symptoms* (setTimeout, sleep)- Keep triggers technology-agnostic unless the skill itself is technology-specific- If skill is technology-specific, make that explicit in the trigger- Write in third person (injected into system prompt)- **NEVER summarize the skill's process or workflow**
```yaml# ❌ BAD: Too abstract, vague, doesn't include when to usedescription: For async testing
# ❌ BAD: First persondescription: I can help you with async tests when they're flaky
# ❌ BAD: Mentions technology but skill isn't specific to itdescription: Use when tests use setTimeout/sleep and are flaky
# ✅ GOOD: Starts with "Use when", describes problem, no workflowdescription: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently
# ✅ GOOD: Technology-specific skill with explicit triggerdescription: Use when using React Router and handling authentication redirects```
### 2. Keyword Coverage
Use words an agent would search for:- Error messages: "Hook timed out", "ENOTEMPTY", "race condition"- Symptoms: "flaky", "hanging", "zombie", "pollution"- Synonyms: "timeout/hang/freeze", "cleanup/teardown/afterEach"- Tools: Actual commands, library names, file types
### 3. Descriptive Naming
**Use active voice, verb-first:**- ✅ `creating-skills` not `skill-creation`- ✅ `condition-based-waiting` not `async-test-helpers`
### 4. Token Efficiency (Critical)
**Problem:** getting-started and frequently-referenced skills load into EVERY conversation. Every token counts.
**Target word counts:**- getting-started workflows: <150 words each- Frequently-loaded skills: <200 words total- Other skills: <500 words (still be concise)
**Techniques:**
**Move details to tool help:**```bash# ❌ BAD: Document all flags in SKILL.mdsearch-conversations supports --text, --both, --after DATE, --before DATE, --limit N
# ✅ GOOD: Reference --helpsearch-conversations supports multiple modes and filters. Run --help for details.```
**Use cross-references:**```markdown# ❌ BAD: Repeat workflow detailsWhen searching, dispatch subagent with template...[20 lines of repeated instructions]
# ✅ GOOD: Reference other skillAlways use subagents (50-100x context savings). REQUIRED: Use [other-skill-name] for workflow.```
**Compress examples:**```markdown# ❌ BAD: Verbose example (42 words)your human partner: "How did we handle authentication errors in React Router before?"You: I'll search past conversations for React Router authentication patterns.[Dispatch subagent with search query: "React Router authentication error handling 401"]
# ✅ GOOD: Minimal example (20 words)Partner: "How did we handle auth errors in React Router?"You: Searching...[Dispatch subagent → synthesis]```
**Eliminate redundancy:**- Don't repeat what's in cross-referenced skills- Don't explain what's obvious from command- Don't include multiple examples of same pattern
**Verification:**```bashwc -w skills/path/SKILL.md# getting-started workflows: aim for <150 each# Other frequently-loaded: aim for <200 total```
**Name by what you DO or core insight:**- ✅ `condition-based-waiting` > `async-test-helpers`- ✅ `using-skills` not `skill-usage`- ✅ `flatten-with-flags` > `data-structure-refactoring`- ✅ `root-cause-tracing` > `debugging-techniques`
**Gerunds (-ing) work well for processes:**- `creating-skills`, `testing-skills`, `debugging-with-logs`- Active, describes the action you're taking
### 5. Cross-Referencing Other Skills
**When writing documentation that references other skills:**
Use skill name only, with explicit requirement markers:- ✅ Good: `**REQUIRED SUB-SKILL:** Use superpowers:test-driven-development`- ✅ Good: `**REQUIRED BACKGROUND:** You MUST understand superpowers:systematic-debugging`- ❌ Bad: `See skills/testing/test-driven-development` (unclear if required)- ❌ Bad: `@skills/testing/test-driven-development/SKILL.md` (force-loads, burns context)
**Why no @ links:** `@` syntax force-loads files immediately, consuming 200k+ context before you need them.