How to Write a SKILL.md: The Complete Guide (With Template)
How to write a SKILL.md file: frontmatter spec, body structure, scripts and references, a copy-paste template, and the 7 mistakes that make skills fail silently.
A skill is the cheapest high-leverage artifact in the agent ecosystem: one markdown file that turns "the agent kind of knows how to do this" into "the agent does it our way, every time." This guide covers the format spec, a copy-paste template, and the mistakes that make skills fail silently.
The anatomy of a skill
A skill is a folder. The only required file is SKILL.md:
my-skill/
├── SKILL.md # required: frontmatter + instructions
├── scripts/ # optional: helper scripts the agent can run
├── references/ # optional: long docs, schemas, examples
└── assets/ # optional: templates, images, boilerplateThe agent discovers the skill by scanning for SKILL.md files, reads the description in the frontmatter to decide relevance, and loads the full file when your task matches.
The frontmatter spec
---
name: seo-site-audit
description: Audit a website for on-page SEO — crawl key pages, score 40+ checks, and produce a prioritized fix list. Use when the user asks for an SEO audit, site review, or "why isn't this ranking".
---Rules that matter:
- `name`: lowercase, hyphenated, unique. This is the skill's ID — the agent and other tools reference it by this string.
- `description`: the single most important line you'll write. It's a trigger, not a summary. Write it as: what it does + when to use it, including the actual phrases users say ("SEO audit", "why isn't this ranking"). If the description doesn't match the user's vocabulary, the skill never loads — the most common silent failure.
- Keep frontmatter minimal.
nameanddescriptionare the contract; some agents support extras (version,author,license) but they're optional.
The body: write a playbook, not an essay
The body is markdown the agent follows step by step. Structure it like a runbook:
---
name: seo-site-audit
description: Audit a website for on-page SEO...
---
# SEO Site Audit
## When to use this
[One paragraph: the situations this covers and doesn't cover.]
## Workflow
1. **Crawl.** Fetch the homepage + linked pages (max 50).
2. **Check.** Score each page against references/checklist.md.
3. **Report.** Output a prioritized fix list: critical → nice-to-have.
## Output format
[Exact structure of the deliverable — headings, scoring scale, length.]
## Boundaries
- Don't touch production data.
- Ask before running destructive checks.Principles:
- Imperative voice. "Fetch the homepage" beats "the homepage should be fetched." Agents follow commands better than descriptions.
- Numbered steps for sequence, bullets for options. The structure is the instruction.
- Specify the output format. Vague skills produce vague output. Show the exact headings and shape you want.
- State boundaries explicitly. What the skill must NOT do is as important as what it should — especially destructive actions.
- Link, don't inline. Long checklists, JSON schemas, and few-shot examples go in
references/and get one line: "Score againstreferences/checklist.md." This keeps SKILL.md short (context is expensive) while keeping detail one hop away.
Scripts, references, assets
- `scripts/`: deterministic helpers — a Python script that parses a sitemap, a shell script that runs Lighthouse. The skill says when to run them; the script handles the how reliably. Make them executable and keep dependencies minimal.
- `references/`: long-form material the agent reads on demand — API docs, brand guidelines, 200-line checklists. One line in SKILL.md points at each.
- `assets/`: templates and boilerplate the agent copies or fills in — slide masters, report templates, code scaffolds.
The 7 mistakes that make skills fail silently
- Vague description. "Helps with websites" never triggers. Write the user's actual words.
- The 500-line SKILL.md. The agent skims or truncates it. Move bulk to
references/. - No output format. You get a different shape every run. Specify headings, scale, length.
- Missing boundaries. The skill that "optimizes the database" without saying "never drop tables" is a liability.
- Assuming tools exist. If your skill needs
lighthouseorgh, say so in a "Prerequisites" section — or better, check and install in a script. - One skill doing five jobs. Split it. A skill should do one thing well; the agent composes skills.
- Never testing the trigger. You wrote a great skill nobody's phrasing matches. Test with real user language (below).
Testing checklist
- Install to
~/.claude/skills/and start a fresh session (agents scan at startup). - Prompt the way a real user would — not the way the skill phrases it.
- Watch for: does it trigger? Does it follow every step in order? Where does it improvise? Improvisation = your instruction was vague there.
- Iterate on the
descriptionfirst (trigger problems), then the steps (execution problems). - Ask a colleague to try it cold. If they can't trigger it without coaching, neither will future-you.
Copy-paste template
---
name: my-skill-name
description: <What it does>. Use when the user asks for <trigger phrases, in user language>.
---
# <Skill Title>
## When to use this
<1 paragraph: situations covered AND not covered.>
## Prerequisites
<Tools/accounts needed. "None" if truly none.>
## Workflow
1. **<Step>.** <Imperative instruction.>
2. **<Step>.** <Imperative instruction.>
## Output format
<Exact structure: headings, scoring, length.>
## Boundaries
- <What the skill must never do.>
## References
- `references/<file>.md` — <what's in it>What next
- Installing: how to install skills in Claude Code
- Distributing: publish the folder to GitHub, or submit it to a curated directory so others can discover it
- Composing: understand when a skill beats an MCP server — and when to use both
FAQ
What is the SKILL.md format?
SKILL.md is a markdown file with YAML frontmatter (name and description) followed by instructions. The agent reads the description to decide when the skill is relevant, then follows the body as a playbook. A skill folder can also include scripts/, references/, and assets/ alongside SKILL.md.
What should go in a skill's frontmatter?
At minimum: name (lowercase-hyphenated, max ~64 chars) and description (what the skill does and when to use it, phrased as a trigger). The description is the most important line in the whole skill — it determines whether the agent ever loads it.
How long should a SKILL.md be?
Aim for under 100 lines for the core file. Put long checklists, schemas, and examples in references/ and link to them. Agents load the full SKILL.md into context, so brevity directly saves tokens and improves follow-through.
How do I test a skill?
Install it in ~/.claude/skills/, start a fresh agent session, and give it a task phrased the way a real user would. Watch whether the skill triggers, whether the agent follows each step, and where it improvises — improvisation points to instructions that need tightening.
Put it into practice
Browse the catalog — every listing shows compatibility, previews, and install steps where a package exists.
Browse skills