Skip to content

Latest commit

 

History

History
182 lines (125 loc) · 8.64 KB

File metadata and controls

182 lines (125 loc) · 8.64 KB

Skill Anatomy

This document describes the structure and format of agent-skills skill files. Use this as a guide when contributing new skills or understanding existing ones.

File Location

Every skill lives in its own directory under skills/:

skills/
  skill-name/
    SKILL.md           # Required: The skill definition
    scripts/           # Optional: Runnable helpers used by the skill workflow
    references/        # Optional: Skill-specific reference documentation
    supporting-file.md # Optional: Reference material loaded on demand

SKILL.md is the only required file. Add scripts/ or references/ only when the skill actually needs them, and omit them entirely for simpler skills.

SKILL.md Format

Frontmatter (Required)

---
name: skill-name-with-hyphens
description: Guides agents through [task/workflow]. Use when [specific trigger conditions].
---

Rules:

  • name: Lowercase, hyphen-separated. Must match the directory name.
  • description: Start with what the skill does in third person, then include one or more clear "Use when" trigger conditions. Include both what and when. Maximum 1024 characters.

Why this matters: Agents discover skills by reading descriptions. The description is injected into the system prompt, so it must tell the agent both what the skill provides and when to activate it. Do not summarize the workflow — if the description contains process steps, the agent may follow the summary instead of reading the full skill.

Standard Sections (Recommended Pattern)

The frontmatter contract above is required. The section layout below is a recommended pattern, not a rigid template: equivalent headings are acceptable when they serve the same purpose clearly.

# Skill Title

## Overview
One-two sentences explaining what this skill does and why it matters.

## When to Use
- Bullet list of triggering conditions (symptoms, task types)
- When NOT to use (exclusions)

## [Core Process / The Workflow / Steps]
The main workflow, broken into numbered steps or phases.
Include code examples where they help.
Use flowcharts (ASCII) where decision points exist.

## [Specific Techniques / Patterns]
Detailed guidance for specific scenarios.
Code examples, templates, configuration.

## Common Rationalizations
| Rationalization | Reality |
|---|---|
| Excuse agents use to skip steps | Why the excuse is wrong |

## Red Flags
- Behavioral patterns indicating the skill is being violated
- Things to watch for during review

## Verification
After completing the skill's process, confirm:
- [ ] Checklist of exit criteria
- [ ] Evidence requirements

Section Purposes

Overview

The "elevator pitch" for the skill. Should answer: What does this skill do, and why should an agent follow it?

When to Use

Helps agents and humans decide if this skill applies to the current task. Include both positive triggers ("Use when X") and negative exclusions ("NOT for Y").

Core Process

The heart of the skill. This is the step-by-step workflow the agent follows. Must be specific and actionable — not vague advice.

Good: "Run npm test and verify all tests pass" Bad: "Make sure the tests work"

Common Rationalizations

The most distinctive feature of well-crafted skills. These are excuses agents use to skip important steps, paired with rebuttals. They prevent the agent from rationalizing its way out of following the process.

Think of every time an agent has said "I'll add tests later" or "This is simple enough to skip the spec" — those go here with a factual counter-argument.

Red Flags

Observable signs that the skill is being violated. Useful during code review and self-monitoring.

Verification

The exit criteria. A checklist the agent uses to confirm the skill's process is complete. Every checkbox should be verifiable with evidence (test output, build result, screenshot, etc.).

Supporting Files

Create supporting files only when:

  • Reference material exceeds 100 lines (keep the main SKILL.md focused)
  • Code tools or scripts are needed
  • Checklists are long enough to justify separate files

Keep patterns and principles inline when under 50 lines.

If a skill does not need runnable helpers, do not create an empty scripts/ directory just to mirror other skills. Empty directories add noise without changing how the skill works.

Shared References

Checklists used by more than one skill — testing, security, performance, accessibility, definition-of-done — live in references/ at the repository root, deliberately not inside any skill directory.

This is a pack-level design choice. The Agent Skills spec describes a skill as a self-contained directory, but several skills here point at the same checklists. Colocating those would force one of two options: copy the checklist into every skill that uses it, or pick one skill to "own" it and have the others reach into that directory. Both drift over time. A single repo-root copy stays the source of truth.

The tradeoff is portability: a whole-repo install (such as the Claude Code marketplace plugin) carries references/ along, but a per-skill install that copies only skills/<name>/ leaves the repo-root sibling behind, and those links resolve to nothing. That gap is tracked in #361.

Current convention: material used by exactly one skill is a supporting file inside that skill's directory; material shared across skills goes in references/.

Context Efficiency

Skills load on demand: only the skill name and description sit in context at startup. The full SKILL.md loads only when an agent decides the skill is relevant. To keep that load cheap:

  • Keep SKILL.md under 500 lines. Move detailed reference material into supporting files.
  • Write specific descriptions. A precise description helps the agent activate the skill at the right moment and skip it otherwise.
  • Use progressive disclosure. Reference supporting files that are read only when the workflow reaches them.
  • Prefer scripts over inline code. Executing a script consumes no context; only its output does. Inline code blocks are paid for on every load.
  • Keep file references one level deep. Link directly from SKILL.md to supporting files rather than chaining through intermediate documents.

Script Requirements

When a skill ships runnable helpers under scripts/, each script follows these conventions:

  • Use a #!/bin/bash shebang.
  • Use set -e for fail-fast behavior.
  • Write status messages to stderr: echo "Message" >&2.
  • Write machine-readable output (JSON) to stdout.
  • Include a cleanup trap for temporary files.
  • Reference the script path as skills/<skill-name>/scripts/<script>.sh (repo-relative).

Writing Principles

  1. Process over knowledge. Skills are workflows, not reference docs. Steps, not facts.
  2. Specific over general. "Run npm test" beats "verify the tests".
  3. Evidence over assumption. Every verification checkbox requires proof.
  4. Anti-rationalization. Every skip-worthy step needs a counter-argument in the rationalizations table.
  5. Progressive disclosure. Main SKILL.md is the entry point. Supporting files are loaded only when needed.
  6. Token-conscious. Every section must justify its inclusion. If removing it wouldn't change agent behavior, remove it.

Naming Conventions

  • Skill directories: lowercase-hyphen-separated
  • Skill files: SKILL.md (always uppercase)
  • Supporting files: lowercase-hyphen-separated.md
  • Shared references: stored in the root references/ directory, not inside skill directories (see Shared References for why).
  • Skill-specific references: a single supporting doc can stay as a loose file in the skill directory (the Supporting files entry above); when several related docs travel with the skill, the emerging convention for self-contained, distributable skills is to group them in a references/ directory inside the skill directory, so the skill carries its own supporting docs.

Cross-Skill References

Reference other skills by name:

Follow the `test-driven-development` skill for writing tests.
If the build breaks, use the `debugging-and-error-recovery` skill.

Don't duplicate content between skills — reference and link instead.

Required vs Recommended

Required:

  • A skills/<skill-name>/SKILL.md file
  • Valid YAML frontmatter with name and description
  • A description that includes both what the skill does and when to use it

Recommended:

  • The standard section flow shown above
  • Equivalent headings such as How It Works, Core Process, or Workflow when they read more naturally for the skill
  • Supporting files only when they keep the main SKILL.md focused