SKILL.md

skills/writing-skills/SKILL.md · view on GitHub (opens in a new tab)

A skill is a directory containing a SKILL.md file. Claude loads it automatically when the request matches its description, or the user invokes it directly with /<skill-name>. Use this guide whenever creating or revising a skill.

This SKILL.md is the workflow and the rules you need every time. Load the reference files only when a step points you there:

Is a skill the right tool?

Create a skill when:

Do not create a skill for a one-off task, a single fact (use CLAUDE.md or memory), or something Claude already does well unprompted. The default assumption is that Claude is already smart — only add what it does not already have.

Workflow

Work through these steps in order. Each links to detail only when you need it.

1. Identify the gap (evaluation-first)

Before writing, run the task without a skill and watch where Claude struggles or where you repeatedly supply the same context. That gap — not an imagined requirement — is what the skill must close. Note 2-3 concrete scenarios you want it to handle; they are your test cases for step 7.

2. Choose the type and who invokes it

TypeContentInvocation
Knowledge / referenceConventions, patterns, domain facts Claude applies to current workUsually model-invoked; runs inline.
Workflow / taskStep-by-step actions (deploy, commit, generate)Often user-only via /name; add disable-model-invocation: true so Claude never fires it on its own.

Two independent toggles control invocation (see frontmatter reference for the table):

If the skill should run in isolation with its own context, consider context: fork — but only for skills that contain an actual task, not pure guidelines.

3. Pick the location and name

LocationPathScope
Personal~/.claude/skills/<name>/SKILL.mdAll your projects
Project.claude/skills/<name>/SKILL.mdThis repo (commit it to share)
Plugin<plugin>/skills/<name>/SKILL.mdWhere the plugin is enabled

The directory name becomes the command (~/.claude/skills/deploy-staging//deploy-staging). The frontmatter name is only the display label — it does not change what the user types (except for a plugin-root SKILL.md). Keep the directory name and name in sync to avoid confusion.

Naming rules: lowercase letters, numbers, hyphens only; max 64 chars; no XML tags; may not contain the reserved words “anthropic” or “claude”. Prefer gerund form (processing-pdfs, writing-documentation) or a clear action (deploy, fix-issue). Avoid vague names (helper, utils, tools).

4. Write the frontmatter — the description is the highest-leverage line

Only description is recommended; everything else is optional. The description is loaded into the system prompt at startup and is how Claude (and the user) decide when to use the skill, so it must earn its place.

Rules for a good description:

# Good
description: Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDFs or when the user mentions forms or document extraction.
# Bad — vague, no triggers, wrong person
description: Helps with documents
description: I can process your PDFs for you

For the complete field list (allowed-tools, argument-hint, arguments, model, effort, paths, context, agent, when_to_use, …), see reference/frontmatter.md.

5. Write the body — concise, imperative, structured

The body loads when the skill is invoked and then stays in context for the rest of the session (Claude does not re-read the file). Every line is a recurring token cost, so treat the context window as a public good.

6. Split detail into supporting files (progressive disclosure)

Keep SKILL.md under 500 lines. When it grows past that — or covers multiple independent domains — move detail into sibling files that Claude reads only when needed.

7. Test both paths and iterate

Troubleshooting

Pre-ship checklist

The full annotated version of this checklist, with examples for each item, is in reference/best-practices.md.