Skip to content
AI Skill Index

How to create an agent skill: SKILL.md step by step

From an empty folder to a skill Claude loads on its own: the SKILL.md rules, a description that triggers, a worked example and how to test it.

Editorial·13 min read·
Sign in to save

To create an agent skill, make a folder named after the skill and put a file called SKILL.md in it. The file opens with two fields, a name and a description that says what the skill does and when to use it. The instructions follow in Markdown. Save the folder where your agent looks for skills, then check that it loads when you ask for the task in your own words.

This guide takes you through those steps for Claude, with one worked example. The rules come from the Agent Skills specification and from Anthropic's documentation for the Claude API and apps and for Claude Code, checked on November 21, 2026. Where the sources disagree, the guide says so.

What you are building

An agent skill is a folder of instructions that an AI agent loads when a task calls for it. At startup the agent reads only the name and description of each installed skill. When a request matches a description, it reads the rest of SKILL.md, and it opens the other files in the folder only when the instructions point to them. What is an agent skill, and why now? explains the idea and which tasks are worth packaging as one.

Step 1: create the folder

The specification defines a skill as a directory that holds at least a SKILL.md file. It names three optional subfolders:

writing-standup-updates/
├── SKILL.md          # required: front matter and instructions
├── scripts/          # optional: code the agent can run
├── references/       # optional: documentation it reads when needed
└── assets/           # optional: templates, images, data files

Give the folder the name the skill will have. The specification says the name field "must match the parent directory name". In Claude Code the folder name is also the command you type, so writing-standup-updates/ gives you /writing-standup-updates.

Step 2: write the front matter

SKILL.md starts with YAML front matter between two --- lines, and the instructions follow in Markdown. The specification requires two fields.

The name field, according to the specification:

  • Is 1 to 64 characters long.
  • Holds only lowercase letters a-z, digits 0-9 and hyphens.
  • Doesn't start or end with a hyphen, and doesn't contain two hyphens in a row (--).
  • Matches the folder name.

Anthropic's Agent Skills overview adds two rules for Claude. The name can't contain XML tags, and it can't contain the reserved words anthropic or claude. A name such as claude-helper passes the specification and breaks Anthropic's rules.

The description field:

  • Is required, can't be empty and holds at most 1,024 characters. The specification and Anthropic's overview give the same limit.
  • Can't contain XML tags, according to Anthropic's overview. The specification doesn't mention XML tags.
  • Says what the skill does and when to use it. Both sources ask for this.

The specification lists four optional fields. license names a license or a bundled license file. compatibility states environment requirements in up to 500 characters, and the specification notes that most skills don't need it. metadata is a map of string keys to string values. allowed-tools is a space-separated list of tools that are pre-approved to run, and the specification marks it as experimental.

Claude Code reads more fields than these, such as when_to_use, argument-hint, disable-model-invocation and paths. Its skills documentation says a skill uploaded to claude.ai or through the Skills API may use only the six fields of the specification. Any other field makes the upload fail with an error instead of being ignored.

Where the sources disagree

  • Claude Code makes every field optional. Without a name it uses the folder name, and without a description it uses the first line of the instructions that isn't empty. The specification requires both fields, and so does Anthropic's overview.
  • Anthropic's help article How to create custom skills, written for claude.ai, gives the description a maximum of 200 characters. Its example name is "Brand Guidelines", with capitals and a space, and it calls the file skill.md. The specification and Anthropic's API documentation allow 1,024 characters and only lowercase letters, digits and hyphens, in a file named SKILL.md. A lowercase, hyphenated name and a description of 200 characters or fewer meet both sets of rules.

Step 3: write a description that triggers

The description decides whether the skill is used at all. Anthropic's overview says Claude loads the name and description of every skill at startup, and that the description "is what Claude matches your request against when determining whether to trigger the Skill". Anthropic's skill authoring best practices say Claude uses it to pick the right skill from "potentially 100+ available Skills".

What the sources ask of a description:

  • Say what the skill does and when to use it. One example from the best practices is "Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction."
  • Include the words a request would contain. The specification says the description "should include specific keywords that help agents identify relevant tasks".
  • Write in the third person. The best practices explain that the description is injected into the system prompt, and that "I can help you" or "You can use this" can cause discovery problems.
  • Be specific. "Helps with documents" and "Processes data" are two of the best practices' examples of descriptions to avoid.
  • In Claude Code, put the main use case first. Its skill listing cuts the description, together with the optional when_to_use field, at 1,536 characters.

Writing a skill that actually gets used goes further into the description as a trigger and into how narrow a skill should be.

Step 4: write the instructions

Everything after the front matter is the body. The specification sets "no format restrictions" on it and recommends three kinds of content: step-by-step instructions, examples of inputs and outputs, and common edge cases.

Anthropic's best practices add:

  • Keep it short. Once the skill triggers, every token of the body competes with the conversation for context. The best practices start from the assumption that "Claude is already very smart" and ask of each paragraph, "Does this paragraph justify its token cost?"
  • Keep SKILL.md under 500 lines, and move detail into separate files as you get close. The specification gives the same limit.
  • Use one term for one thing throughout, give concrete examples, and leave out information that will go out of date.

The Claude Code docs add a point about long sessions. After Claude Code compacts a conversation, it re-attaches each skill it invoked but keeps only the first 5,000 tokens of it. Put the instructions that matter most near the top.

Step 5: add reference files and scripts if you need them

Skills load in stages, which the specification calls progressive disclosure. Anthropic's overview gives the cost of each stage:

What Claude loadsWhenCost, per Anthropic's overview
Name and descriptionAt startup, for every skillAbout 100 tokens per skill
The body of SKILL.mdWhen the skill triggersUnder 5,000 tokens
Other files in the folderWhen a task needs themNothing until they are read

That makes reference files the place for detail that only some tasks need. The rules for them:

  • Link each file from SKILL.md with a path relative to the skill folder, such as references/format.md, and say what it holds so Claude knows when to read it. The specification and the Claude Code docs both ask for this.
  • Keep references one level deep. A reference file shouldn't send Claude to another one. The best practices warn that Claude may preview a nested file with a command such as head -100 and miss the rest.
  • Give a reference file longer than 100 lines a table of contents at the top, according to the best practices.
  • Use forward slashes in paths, even on Windows. The best practices say Windows-style paths cause errors on Unix systems.

Scripts work differently. When Claude runs a bundled script, the script's code doesn't enter the context, only its output does, according to Anthropic's overview. The specification asks that scripts be self-contained or document their dependencies, give helpful error messages and handle edge cases. Where a script can run depends on the product. On the Claude API, skills run in a container with no network access, and packages can't be installed at runtime. In claude.ai, network access depends on user and admin settings.

A worked example

This skill is invented for this guide. It writes a daily standup update:

---
name: writing-standup-updates
description: Writes a daily standup update from the user's notes or recent commits, in three parts, done, next and blocked. Use when the user asks for a standup update, a daily status or what they did yesterday.
---

# Writing standup updates

## Steps

1. Collect what the user did since the last update. Use the notes they give you. If they point you at a git repository instead, read the commit messages from the last working day.
2. Sort each item under Done, Next or Blocked.
3. Write one line per item, and keep the whole update under 120 words.
4. Follow the template in [references/format.md](references/format.md).

## Rules

- For each blocker, name what is blocked and who can unblock it. "Waiting on review" is not enough. Say whose review.
- Leave out items nobody on the team can act on.
- If nothing is blocked, write "Blocked: none" so nobody has to ask.

The folder holds writing-standup-updates/SKILL.md and writing-standup-updates/references/format.md. The name follows the gerund form the best practices suggest, a verb ending in "-ing", and matches the folder. The description is in the third person, names the task and lists the requests that should trigger it. It is 198 characters long, inside the 200 that the claude.ai help article allows. The front matter passes every check of the SKILL.md generator.

Step 6: save the folder where Claude looks for it

In Claude Code, the skills documentation lists two locations you write to yourself:

  • ~/.claude/skills/<skill-name>/SKILL.md for a personal skill. It loads in all your projects on that machine.
  • .claude/skills/<skill-name>/SKILL.md inside a repository for a project skill. It loads in sessions in that repository, and committing it shares it with everyone who works there.

Plugins and managed settings for an organization are two more ways to share a skill in Claude Code. Don't name a skill folder synced. Claude Code keeps that name for skills downloaded from claude.ai and skips a skill of your own with that name.

In Claude on claude.ai, you upload a skill as a zip file. The help article on creating custom skills asks for the skill folder at the root of the zip, so writing-standup-updates.zip unpacks to writing-standup-updates/SKILL.md, not to a loose SKILL.md. Anthropic's overview lists custom skills on the Pro, Max, Ultra, Team and Enterprise plans with code execution turned on. The help article says skills are available on those plans and on Free.

On the Claude API, you upload a skill through the Skills API (the /v1/skills endpoints), as a zip or as separate files. Anthropic's guide to skills in the API requires SKILL.md at the root of the upload or at the top of a single enclosing folder, and a total size under 30 MB uncompressed. An uploaded skill is available to the whole workspace. A request uses it by listing the skill's type and skill_id in container.skills, together with the code execution tool.

A custom skill doesn't sync between these places. Anthropic's overview says a skill uploaded to claude.ai isn't available through the API, a skill uploaded through the API isn't available on claude.ai, and Claude Code skills are separate from both. The Claude Code docs describe one exception. In Cowork, in cloud sessions and in terminal sessions where you sign in with a claude.ai account, Claude Code loads the skills enabled for that account. How to install agent skills has the steps for each tool.

Step 7: test that it triggers

In Claude Code, the skills documentation suggests these checks:

  1. Start a new session and ask for the task the way you normally would, without naming the skill. For the example above, that is a request such as "Write my standup from these notes".
  2. If it doesn't load, ask What skills are available? to see whether Claude Code found the skill. Check that the description holds the words you used, then invoke the skill directly with /writing-standup-updates.
  3. If the command works but Claude never picks the skill on its own, check the front matter. When the YAML doesn't parse, Claude Code loads the body with empty metadata, so the command runs but there is no description to match. Start Claude Code with claude --debug to see the parse error, or run claude plugin validate ~/.claude/skills, which needs Claude Code v2.1.233 or later. Claude Code also ignores the front matter unless the opening --- is the first line of the file.
  4. Test the opposite case too. Ask for nearby tasks the skill shouldn't handle. If it loads when you don't want it, make the description more specific, or set disable-model-invocation: true so it runs only when you type its command.

A skill that triggers can still do the job badly. The Claude Code docs recommend a baseline comparison: run a few realistic prompts, each in a fresh session, once with the skill and once with it turned off, and compare the results. Anthropic's best practices ask for at least three evaluation scenarios, ideally written before most of the skill, and for tests with every model you plan to use. They also say there is no built-in way to run such evaluations, while the Claude Code docs name two tools that automate the comparison there: the skill-creator plugin, and claude plugin eval for skills that ship in a plugin.

On claude.ai, the help article's steps are to turn the skill on in Customize > Skills, try several prompts that should trigger it, and read Claude's thinking to confirm it loaded the skill. If Claude doesn't use it, rework the description.

You can check the front matter before any of this. The SKILL.md generator checks the name and description against the rules above in your browser, and the specification points to its reference library, which runs as skills-ref validate ./my-skill.

Common mistakes

Each of these breaks a rule or a recommendation from the sources above:

  • A vague description such as "Helps with documents", which gives Claude nothing to match.
  • A description in the first or second person, such as "I can help you" or "You can use this".
  • Capitals, spaces, -- or a hyphen at the start or end of name, or a name that contains claude or anthropic.
  • A folder name that doesn't match name.
  • Anything above the opening ---, which makes Claude Code read the whole file as instructions.
  • Claude Code fields such as argument-hint in a skill you upload to claude.ai or the API. The upload fails with "Unexpected key(s) in SKILL.md frontmatter".
  • A zip with the files at its root instead of the skill folder.
  • Reference files that point to further reference files.
  • Backslashes in file paths.
  • A SKILL.md of more than 500 lines, where reference files would hold the detail.

Start with the generator

The SKILL.md generator writes the file from a name, a description and your instructions, and flags anything that breaks the rules in this guide. Before you write a skill, look through the skills on this site. Someone may already have written the one you need.

ShareXLinkedIn

Cookies

We use only the cookies this site needs to work. Optional analytics helps us see which content is worth writing more of — nothing loads until you say yes.

Read the privacy policy