Founding Lifetime — $169 once, yours forever. Opens when online payment is available.

Best Agent Skills
Guides5 min read

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, boilerplate

The 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:

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:

  1. Imperative voice. "Fetch the homepage" beats "the homepage should be fetched." Agents follow commands better than descriptions.
  2. Numbered steps for sequence, bullets for options. The structure is the instruction.
  3. Specify the output format. Vague skills produce vague output. Show the exact headings and shape you want.
  4. State boundaries explicitly. What the skill must NOT do is as important as what it should — especially destructive actions.
  5. Link, don't inline. Long checklists, JSON schemas, and few-shot examples go in references/ and get one line: "Score against references/checklist.md." This keeps SKILL.md short (context is expensive) while keeping detail one hop away.

Scripts, references, assets

The 7 mistakes that make skills fail silently

  1. Vague description. "Helps with websites" never triggers. Write the user's actual words.
  2. The 500-line SKILL.md. The agent skims or truncates it. Move bulk to references/.
  3. No output format. You get a different shape every run. Specify headings, scale, length.
  4. Missing boundaries. The skill that "optimizes the database" without saying "never drop tables" is a liability.
  5. Assuming tools exist. If your skill needs lighthouse or gh, say so in a "Prerequisites" section — or better, check and install in a script.
  6. One skill doing five jobs. Split it. A skill should do one thing well; the agent composes skills.
  7. Never testing the trigger. You wrote a great skill nobody's phrasing matches. Test with real user language (below).

Testing checklist

  1. Install to ~/.claude/skills/ and start a fresh session (agents scan at startup).
  2. Prompt the way a real user would — not the way the skill phrases it.
  3. Watch for: does it trigger? Does it follow every step in order? Where does it improvise? Improvisation = your instruction was vague there.
  4. Iterate on the description first (trigger problems), then the steps (execution problems).
  5. 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

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