AI Agent Skills

Write Your First Claude Skill: SKILL.md Anatomy, Step by Step

22 October 2026 · Updated 28 November 2026 · 13 min read · by Yang Kai

Build a working Claude Code skill from scratch — a blog-outline skill you can use today — and learn the SKILL.md anatomy that makes skills trigger reliably.

Complete example SKILL.md for a blog-outline skill

Contents
  1. What you need before you start
  2. The anatomy of a SKILL.md
  3. Step 1: Pick a task you have already repeated
  4. Step 2: Create the folder and file
  5. Step 3: Write the frontmatter
  6. Step 4: Write the body — the complete example
  7. Inputs
  8. Steps
  9. Output format
  10. Rules
  11. Step 5: Test it like you mean it
  12. Step 6: Grow it from evidence, not length
  13. Troubleshooting: the five failures beginners hit
  14. How we researched this
  15. The verdict

You have pasted the same instructions into Claude Code for the fourth time this week. Same structure, same rules, same reminders — and the output still drifts whenever you forget one line of the paste.

A skill ends that loop. It is a folder with one file, SKILL.md, that Claude Code loads only when a request matches it, and then follows as a procedure.

This guide builds one complete, working skill — a blog-outline skill — end to end: the anatomy, the frontmatter rules, the six build steps, how to test triggering, and the fixes for the failures beginners actually hit.

Every limit and loading rule below comes from Anthropic’s official Agent Skills and Claude Code documentation, checked in November 2026.

The whole process, in five lines:

  1. Pick a procedure you have already repeated at least three times.
  2. Create ~/.claude/skills/<name>/SKILL.md.
  3. Write a description that says what the skill does and when to use it.
  4. Write the body as numbered steps with explicit inputs and outputs.
  5. Test it in a fresh session, using the words you naturally use.

What you need before you start

The anatomy of a SKILL.md

A skill is a folder containing one required file, SKILL.md, plus optional supporting files — templates, checklists, scripts — that the body points to when needed.

The file has two parts. The frontmatter decides when the skill loads. The body says what to do once it has. That split drives the loading model, which is the whole economic argument for skills:

Level What loads When Size guide
Metadata The name and description of every installed skill At session start, always About 100 tokens per skill
Body The full SKILL.md instructions Only when a request matches the description Keep under 5,000 tokens
Bundled files Scripts, references, templates in the folder Only when the body tells Claude to read them No fixed cap — keep them focused

Compare that with putting the same procedure in CLAUDE.md, where you pay for it on every request — including the sessions where you are fixing a CSS bug and the outlining procedure is dead weight. The boundary between the two is covered in Claude Code Skills, Explained.

The frontmatter fields that matter

Field Rules (per the official spec)
name Maximum 64 characters; lowercase letters, numbers and hyphens only; must match the folder name; cannot contain the reserved words “anthropic” or “claude”. Gerund forms read well: processing-pdfs, drafting-release-notes.
description Maximum 1,024 characters. Must state what the skill does and when to use it, in the third person. This is the trigger — the field everything else depends on.
when_to_use A Claude Code extra for additional trigger context. In the skill listing, description + when_to_use are truncated at 1,536 characters combined, so put the main use case first.
allowed-tools Optional. Restricts which tools Claude may use while the skill is active — worth setting for skills that should read but never write.

Watch out: the opening --- must be the very first line of the file. A blank line or a title above it and the frontmatter is read as plain text — the skill has no name and no description, and never triggers.

What else can live in the folder

SKILL.md is the only required file, but the folder can hold more:

Reference bundled files from the body by relative path, one level of linking deep: a reference file that points to a second reference file tends to get read partially or not at all. The full pattern, including how scripts change the cost maths, is covered in skills with scripts and reference files.

Step 1: Pick a task you have already repeated

Do not invent a skill for a task you might do someday. The best first skill is a procedure you can already recite, because you will write the steps accurately and notice immediately if the output drifts from how you do it by hand.

Outlining articles is the example here. Yours might be writing commit messages in your team’s format, reviewing a pull request against a checklist, or drafting release notes. If you have pasted the instructions three times, the task qualifies. If you are unsure which of your prompts deserves to become a skill, the sorting worksheet in converting repeated prompts into skills makes that call systematically.

Step 2: Create the folder and file

Where the folder lives decides which sessions see the skill:

Scope Path Available in
Personal ~/.claude/skills/<name>/SKILL.md All your projects on this machine
Project .claude/skills/<name>/SKILL.md That repository only — commit it and your team gets it too
Plugin <plugin>/skills/<name>/SKILL.md Wherever the plugin is enabled, invoked as /plugin-name:skill-name
Enterprise .claude/skills/ inside the managed settings directory Every user your organisation deploys it to

If the same name exists at several levels, the higher one wins: enterprise over personal, personal over project. Remember that ordering — it explains a classic debugging dead end later.

For a personal skill:

mkdir -p ~/.claude/skills/blog-outline
touch ~/.claude/skills/blog-outline/SKILL.md

The file name is case-sensitive: SKILL.md, not skill.md. A surprising share of “broken skills” are filing errors of exactly this kind.

Step 3: Write the frontmatter

The description carries the whole triggering decision, so give it three parts, in this order:

  1. The job, named as users name it. “Create a structured outline for a blog article” — verb, object, in request language.
  2. The trigger situations. “Use when the user asks for an article outline, a post structure, headings for a draft…”
  3. The boundary. “Do not use for finished-draft editing or social posts.” One exclusion sentence prevents most misfires.

This field earns its own article — SKILL.md descriptions that trigger reliably — because most dead skills die here, not in the body.

Step 4: Write the body — the complete example

Here is the full, working SKILL.md for the blog-outline skill. Copy it, then adjust the rules to match how you outline — the structure matters more than these specific preferences.

---
name: blog-outline
description: Create a structured outline for a blog article from a topic or
  draft title. Use when the user asks for an article outline, a post
  structure, headings for a draft, or help planning a blog post before
  writing. Do not use for finished-draft editing or social posts.
---

# Blog Outline

Turn a topic into an outline a writer can draft from without
making structural decisions mid-draft.

## Inputs
- Topic or working title (required — ask if missing)
- Target reader and their problem (ask if not stated)
- One primary keyword or search query the post should answer

## Steps
1. Restate the reader's problem in one sentence. If you cannot,
   ask one clarifying question before outlining.
2. List the 3–5 questions the reader is actually asking about
   this topic, in the order they would ask them.
3. Turn those questions into ## headings. Each heading must
   promise an answer, not a theme. "Pricing" is a theme;
   "What it costs, and what the free tier excludes" is a promise.
4. Under each heading, add 2–4 bullet notes: the point to make,
   the evidence or example to use, and any worked example to include
   (table, checklist, template, code sample).
5. Mark exactly one section as the worked-example section — every post
   needs one thing the reader can copy or use.
6. Close with a "What to do next" heading naming one action.

## Output format
- Title options: 3 variants, each under 60 characters
- One-sentence reader problem
- The outline (headings + bullets)
- Word budget per section, totalling 900–1,400 words

## Rules
- No section may exist only to "provide context" — fold background
  into the section that needs it.
- If the topic needs facts you do not have, flag them as
  [RESEARCH NEEDED] in the outline instead of inventing them.
- Do not write the article. Outline only, unless asked otherwise.

Notice three things about this file. The description names both when to use the skill and when not to — that negative clause stops the outlining skill from hijacking an editing request.

The steps are ordered and checkable; anyone can point at step 4 and say whether it happened. And the rules section encodes mistakes made by hand, like inventing facts during outlining. Your rules section should encode yours.

Step 5: Test it like you mean it

Start a fresh session and ask for an outline the way you would naturally phrase it — “outline a post about X” — without mentioning the skill by name.

If it triggers and follows the steps, you are done. Run the negative test too: ask for an edit to a finished draft and confirm the outlining skill stays out of the way. A skill that behaves correctly in both directions is one you can trust and forget about, which is the goal.

You also have a control test available. Typing /blog-outline invokes the skill directly, bypassing the description match entirely. If the direct invocation works but natural phrasing does not, the file and the body are fine — the description is the problem. That single test splits most failures in half, and the full diagnostic order is in the debugging checklist for skills that won’t trigger.

Step 6: Grow it from evidence, not length

Once one skill works, restraint matters more than volume. A small set of skills used weekly beats a large set half-remembered. When this one has a month of use behind it, three upgrades typically earn their place, in this order:

What is not on this list: more instructions. Skills improve by evidence — constraints observed, examples chosen, failures recorded — not by accretion.

Troubleshooting: the five failures beginners hit

Symptom Likely cause Fix
Skill never loads Description written in the skill’s internal language, not request language Rewrite the description with the verbs and nouns you actually type
Skill fires on the wrong tasks No boundary clause Add one “Do not use for…” sentence naming the near-miss job
Skill is ignored entirely File named skill.md, folder nested one level too deep, or --- not on line 1 Check the path and the first line before touching content
Skill loads but skips steps Body is vague prose instead of checkable steps Number the steps; make inputs and output shape explicit; move skipped steps earlier
Edits have no effect A same-name skill at a higher-priority scope is the one loading Check enterprise and personal folders for a duplicate before rewriting

Before installing anyone else’s skill as a shortcut around these problems, run it through the safe-install audit — a borrowed skill with a greedy description creates the same failures, plus a security question.

How we researched this

This guide is desk research, not a lab report. The anatomy, limits and loading model are taken from Anthropic’s official Agent Skills specification and Claude Code skills documentation, checked in November 2026: the 64-character name cap, the 1,024-character description cap, the ~100-token metadata load, the under-5,000-token body guidance, and the 1,536-character listing truncation. The blog-outline skill is a constructed teaching example, presented so you can copy and adapt it — not a claim about anyone’s production library.

FAQ

What is a SKILL.md file? It is the entry point of a skill: YAML frontmatter with a name and a trigger description, followed by the instructions themselves. Claude Code reads the description at every session start and loads the full file only when a task matches it.

Where do skill files live on disk? Personal skills go in ~/.claude/skills/, project skills in .claude/skills/ inside the repo, and further copies can arrive via plugins or an organisation’s managed settings. Project skills are the ones to commit, so a teammate’s agent behaves the same way yours does.

Can I run a skill manually instead of waiting for it to trigger? Yes. Type / followed by the skill name — /blog-outline — and Claude Code loads it directly. This is also the fastest diagnostic: if manual invocation works but automatic triggering does not, your description needs the fix, not the body.

Why is my skill not triggering? Almost always the description. If it describes what the skill is instead of when to use it, the request cannot match it. Rewrite the description as trigger conditions — the words a user would actually say — before you touch the instructions.

How long should a skill be? As short as still works. Keep the body under 5,000 tokens; most good skills fit on one or two screens. Past that, split reference material into separate files the skill points to, so the part that loads on trigger stays lean.

The verdict

A first skill is a small thing built correctly: one repeated task, a description written in request language with a stated boundary, and a body of numbered steps you can check. Build that, test it in both directions, and let it grow from failure notes rather than ambition.

From here, browse the skills directory to see how finished skills are packaged, and when your library starts to grow, writing advanced Claude Skills covers progressive disclosure and the patterns that keep a larger set from fighting itself. If your procedure needs tools or external systems rather than instructions alone, that is a different mechanism — see MCP servers worth installing — and worth keeping distinct.

Category: AI Agent Skills · Tags: #claude-code #skills #skill-md #ai-coding #content

Next step: this article is part of AI Skills, which covers the full topic from first setup to advanced use.

Related guides

AI Agent Skills

Why Your Claude Skill Isn't Triggering: A Debugging Checklist in the Right Order

A skill that never loads has one of six causes: the description doesn't match how you ask, it isn't installed where Claude looks, a same-name copy loads instead, another skill outcompetes it, the request never mentions the job, or the skill loads and silently does nothing. Diagnose in that order.

12 min read

AI Agent Skills

Claude Skills for Writing and Content Work: The Jobs Worth Automating

The writing jobs that repay being turned into Claude skills — outlining, style-rule editing, SEO briefs, repurposing, and consistency checks — what each skill contains, and the writing jobs that should stay manual because the skill version quietly lowers quality.

14 min read