What Are Agent Skills? How to Write a SKILL.md
Agent Skills teach Claude, Codex, Cursor and Copilot new tricks with one Markdown file. How they load, how to write a SKILL.md, and how to test it.
If you use Claude Code, Codex, Cursor, Gemini CLI or GitHub Copilot, you can teach your AI a new trick by dropping a single Markdown file into a folder. That file is an Agent Skill: a reusable set of instructions the AI loads only when it needs them.
This guide explains what skills are, how they load, how to write a good SKILL.md, and how to test and share one, using a real, published skill as the worked example: Prompt Maid, which I built.
What is an Agent Skill?
A skill is a folder with a SKILL.md file inside it:
prompt-maid/
├── SKILL.md # required: metadata and instructions
└── profile.md # optional: any extra files the instructions refer to
SKILL.md has two parts:
- YAML frontmatter between
---lines, with the skill'snameand adescriptionof what it does and when to use it. - Markdown instructions that the AI follows once the skill is in use.
Skills can also bring along scripts, reference documents and templates in subfolders, conventionally scripts/, references/ and assets/. Many useful skills are just the one file.
Anthropic created the format for Claude and released it as an open standard, Agent Skills, in December 2025, with the specification at agentskills.io. Since then it has been adopted by OpenAI's Codex, Gemini CLI, GitHub Copilot, Cursor and many other tools, so one skill folder works across all of them.
How skills load: progressive disclosure
A skill doesn't sit in your AI's context all the time. Loading happens in stages:
- At startup, the tool reads only each skill's
nameanddescription. That's typically around 100 tokens per skill, so you can install dozens. - When a request matches the description, the AI loads the full
SKILL.mdbody. - Only if the instructions call for them, it reads the extra files or runs the scripts.
Prompt Maid shows what that means in practice: installed as a Claude Code plugin, it adds roughly 150 tokens to a session while idle, and roughly 2,700 when you actually use it.
This is why the description is the most important line you'll write. It's all the AI sees when deciding whether to use your skill.
The frontmatter
Here is Prompt Maid's:
---
name: prompt-maid
description: "Prompt tidier and enhancer for prompt engineering. Rewrites a rough prompt into a clear, specific one before it runs, so the first answer is accurate and no longer than needed, or enhances it into a detailed, agent-ready prompt. Handles the maid: commands (on, off, approve, auto, light, full, enhance, help). Use when a message starts with 'maid:', or when always mode was switched on with 'maid: on' earlier in this conversation. Do not use for any other message, including general requests to write or improve prompts."
license: MIT
---
The rules for the two required fields:
name: lowercase letters, numbers and hyphens only, no leading or trailing hyphen, at most 64 characters, and the same as the folder name.description: at most 1,024 characters. Say what the skill does and when to use it.
A few optional fields exist, such as license. Keep to what you need.
If you're unsure whether your frontmatter is valid YAML, paste it into the YAML converter: a stray quote or a colon in an unquoted string shows up as an error straight away.
Writing a description that triggers correctly
A skill that fires when it shouldn't is as annoying as one that never fires. A good description has three parts:
- What it does, in the words people will actually use: "Prompt tidier and enhancer for prompt engineering".
- When to use it, as concretely as possible: "Use when a message starts with 'maid:'".
- When not to use it, if there's an obvious near miss: "Do not use for… general requests to write or improve prompts".
Prompt Maid needs that third part because "improve my prompt" sounds like its job, but the skill is meant to run only on the maid: trigger.
Writing the instructions
The body is ordinary Markdown, written for the AI. Some lessons from writing one:
- Write instructions, not documentation. "Keep every fact as given: names, numbers, dates" beats a paragraph about why facts matter.
- Every line costs tokens, each time the skill runs. Prompt Maid's contributing guide makes this its one rule: a change that adds lines has to earn them.
- Define the defaults and the edge cases. What happens with no input? With a setting command that looks like a prompt (
maid: on Friday I need a packing list)? The model will guess if you don't say. - Show examples. A short example of input and output, wrapped in
<example>tags, teaches format faster than a description of it. - Say what to do, not only what to avoid. "Phrase it as what to do" applies to your skill's instructions as much as to prompts.
- Keep it short. Aim for a few hundred lines at most, and move long reference material into separate files the instructions point to.
Prompt Maid's whole skill is about 90 lines: commands, the tidying rules, the three depths, the reply formats and three examples.
Where skills live
Each tool looks in its own folders, for you (all projects) or for one project:
| Tool | For all your projects | For one project |
|---|---|---|
| Claude Code | ~/.claude/skills/ | .claude/skills/ |
| Codex | ~/.agents/skills/ | .agents/skills/ |
| Gemini CLI | ~/.gemini/skills/ | .gemini/skills/ |
| GitHub Copilot in VS Code | ~/.copilot/skills/ | .github/skills/ |
| Cursor | ~/.cursor/skills/ | .cursor/skills/ |
Gemini CLI, VS Code and Cursor also read ~/.agents/skills/. Project skills are a great way to share team conventions: commit the folder, and everyone who opens the repository gets the skill.
You can also install published skills straight from GitHub. The open-source skills installer detects the tools on your machine:
npx skills add awaitbrandon/prompt-maid -g
In the Claude apps, skills are added under Customize, either uploaded as a zip or installed through a plugin.
Testing a skill
Two kinds of checks are worth setting up.
1. Validate the format
The Agent Skills project publishes a reference validator:
python3 -m venv .venv
.venv/bin/pip install skills-ref
.venv/bin/agentskills validate skills/prompt-maid
It catches a name that doesn't match its folder, a missing description and similar mistakes. Prompt Maid runs it in CI on every push.
2. Check the behaviour
Format checks don't tell you whether the skill works. For that you need test prompts and graders. Claude Code can run these with claude plugin eval. Each case is a prompt plus a few small checks. Here is one of Prompt Maid's fourteen, which makes sure a prompt that starts like a setting isn't treated as one:
---
description: 'A message that only starts like a setting is a prompt to tidy.'
runs: 1
max_turns: 6
allowed_tools: [Read, Skill]
---
maid: on Friday I need a packing list for a 3 day hike in the rain
Its four graders check that the skill fired, that the reply contains a tidied prompt, that "Friday" survived, and that always mode was not switched on. A grader can be as small as a regular expression:
---
type: 'regex'
pattern: 'always mode'
match: 'not_contains'
flags: 'i'
---
Include cases where the skill must not fire. Prompt Maid has two: "can you improve this prompt for me", and a thank-you note for a maid who "comes on tuesdays", with no maid: prefix.
Run the evals on the smallest model you expect people to use, too. Prompt Maid passes all fourteen on a large model, but only six to eight per run on the smallest tier, and its README says so.
Sharing a skill as a Claude plugin
To make a skill installable with one command in Claude and Claude Code, add two small manifests in a .claude-plugin/ folder at the root of the repository:
plugin.jsonnames the plugin and describes it.marketplace.jsonlists the plugins the repository offers.
Users then add your repository as a marketplace and install from it:
claude plugin marketplace add awaitbrandon/prompt-maid
claude plugin install prompt-maid@prompt-maid
claude plugin validate . checks the manifests before you publish.
Install only skills you trust
A skill is instructions your AI follows with whatever permissions it has, and some skills include scripts it may run. Before installing one:
- Read the
SKILL.mdand skim any scripts. It takes a minute. - Prefer skills with a public repository, a licence and an issue tracker.
- Check any data files it reads. Prompt Maid's README warns about this for its own profile file: whatever is in it goes into your prompts.
Summary
- An Agent Skill is a folder with a
SKILL.md: YAML frontmatter (name,description) plus Markdown instructions. - Only the name and description load until the skill is needed, so the description decides when it fires.
- Write short, direct instructions with defaults, edge cases and examples.
- Validate the format with
agentskills validate, and test the behaviour with real prompts, including ones that must not trigger it.
The best way to learn is to read a real one. Prompt Maid's SKILL.md is short, MIT-licensed and annotated by its tests, so feel free to borrow its structure for your own.