Chapter 2 · Anatomy of a Skill¶
Every skill — from a five-line helper to a complex workflow engine — follows the same shape. This chapter walks through that shape precisely, with the exact rules from the official specification.
The folder¶
skill-name/
├── SKILL.md # Required: YAML frontmatter + markdown instructions
├── scripts/ # Optional: executable code the agent can run
├── references/ # Optional: documentation the agent reads on demand
├── assets/ # Optional: templates, fixtures, static resources
└── ... # Anything else the skill needs
Only SKILL.md is required. The three directories are conventions, not
requirements — but they're the conventions every major agent and marketplace
understands, so use them:
| Directory | Contains | The agent… |
|---|---|---|
scripts/ |
Self-contained executables (Python, shell, JS) | Runs them |
references/ |
Docs too long for the SKILL.md body | Reads them on demand |
assets/ |
Templates, fixtures, schemas, images | Copies/uses them in output |
No README.md inside a skill
Skills are written for the agent, not for humans browsing folders. A
README.md in a skill folder is a smell: either the content belongs in
SKILL.md (agent-facing) or in your repository's docs (human-facing).
SKILL.md¶
The file is YAML frontmatter followed by markdown. The frontmatter is the contract; the body is the teaching.
---
name: changelog-forge
description: Generate CHANGELOG.md entries from git history using a deterministic script. Use when preparing a release, writing release notes, updating a changelog, or when the user mentions changelog, release notes, or versioning.
license: MIT
compatibility: Requires git and Python 3.9+
metadata:
author: paladini
version: "1.2.0"
---
# Changelog Forge
...instructions...
Frontmatter fields¶
| Field | Required | Constraints |
|---|---|---|
name |
Yes | Max 64 chars. Lowercase letters, numbers, hyphens only. No leading/trailing hyphen, no consecutive hyphens. Must match the parent directory name. |
description |
Yes | Max 1024 chars. Non-empty. Says what the skill does and when to use it. |
license |
No | License name or a reference to a bundled license file. |
compatibility |
No | Max 500 chars. Environment requirements: required system packages, network access, target agent. |
metadata |
No | Arbitrary string→string map. Common keys: author, version. |
allowed-tools |
No | Space-separated string of pre-approved tools (experimental; support varies by agent). Example: allowed-tools: Bash(git:*) Read |
Naming rules, concretely¶
name: pdf-processing # ✅ valid
name: data-analysis # ✅ valid
name: PDF-Processing # ❌ uppercase not allowed
name: -pdf # ❌ cannot start with a hyphen
name: pdf--processing # ❌ consecutive hyphens not allowed
The name must be identical to the folder name — commit-crafter/ holds
the skill named commit-crafter. Names should be specific:
processing-pdfs beats helper, utils, or tools.
The description is not a summary — it's a trigger¶
The single most important field in the entire skill. The agent reads it (and only it) when deciding whether to activate your skill, so it must contain both what the skill does and when to use it, with the concrete keywords a user would actually type:
# ❌ Vague — will not trigger reliably
description: Helps with PDFs.
# ✅ What + when + trigger keywords
description: Extract text and tables from PDF files, fill forms, and merge
documents. Use when working with PDF documents or when the user mentions
PDFs, forms, or document extraction.
Chapter 4 is entirely about getting this right.
The body¶
After the frontmatter, write plain markdown. There are no format restrictions, but two budgets apply (from the spec's progressive disclosure guidance):
- Keep the SKILL.md under 500 lines (under ~5,000 tokens is the target).
- Move detail longer than that into
references/files.
The body is loaded whole when the skill activates — every line competes with the user's actual task for context. Recommended sections:
- Step-by-step instructions (imperative voice)
- Concrete input/output examples
- Common edge cases and what to do about them
Referencing other files¶
Reference files with relative paths from the skill root, and keep them one level deep — SKILL.md → file. Deep chains (file A pointing to file B pointing to file C) lead to partial reads and confused agents:
See [the reference guide](references/REFERENCE.md) for details.
Run the extraction script:
scripts/extract.py
When you link a reference, also say when to read it:
- If the target cloud is AWS, read [references/aws.md](references/aws.md)
before writing any commands.
Where skills live¶
Agents discover skills from a few conventional locations. The cross-tool
standard is a .agents/skills/ directory, supported alongside tool-specific
paths:
| Scope | Path | Seen by |
|---|---|---|
| Project | <repo>/.agents/skills/<name>/ |
Any agent, anyone working in the repo |
| User | ~/.agents/skills/<name>/ |
Any agent, all your projects |
| Tool-specific | ~/.claude/skills/, ~/.cursor/skills/, ~/.zcode/skills/, … |
That tool only (often before the standard paths) |
Choosing the scope:
- Project skills (deploy checklist, team commit format, service-specific runbooks) go in the repo so they're versioned and shared with teammates through git.
- User skills (personal writing voice, your own git habits) go in your home directory and follow you across projects.
Overriding an installed skill
When the same skill name exists in multiple locations, tool-specific paths usually win. That's a feature: copy a marketplace skill into your tool-specific directory to override it locally without forking it.
Validating a skill¶
The reference validator from the spec's reference implementation checks frontmatter, naming, and structure:
For everything the validator can't check — trigger quality, body length, script behavior — chapter 10 gives you a testing harness.
Chapter 3 · Quickstart — build and install your first working skill.