Sub topic 9
Anatomy of a skill: folder, SKILL.md, and frontmatter
This chapter assumes you have used a coding agent, can read Markdown and simple YAML, and know the idea of a context window from earlier chapters. File names and frontmatter fields differ between products, so treat the examples as illustrative and check your tool's documentation.
What a skill is made of
A skill is a folder. The folder name usually matches the skill name. Inside it, one file is required: SKILL.md. Everything else is optional and exists to support that file.
changelog-entry/
├── SKILL.md
├── reference/
│ └── format.md
└── scripts/
└── check_format.pySKILL.mdis the entry point. The agent reads it when the skill is selected.reference/holds longer documents that the instructions point to.scripts/holds programs the agent can run instead of writing the logic itself.
Only SKILL.md is needed. A skill with no extra files is normal and often the best starting point.
The two parts of SKILL.md
SKILL.md has two parts. The first is YAML frontmatter, a block between two lines of ---. The second is the Markdown body.
---
name: changelog-entry
description: Writes a changelog entry in the project's format. Use when the user asks to add, draft, or update a changelog or release note.
---
# Changelog entry
1. Read the latest entries in CHANGELOG.md to match the format.
2. Group changes under Added, Changed, Fixed, or Removed.
3. Write one line per change, in the past tense, with the pull request number if known.
For the full format rules, see reference/format.md.The frontmatter is metadata for the agent. The body is the instructions the agent follows once it decides the skill applies.
Frontmatter fields
Two fields are common across tools that support skills.
| Field | Purpose | Typical constraints |
|---|---|---|
| `name` | Identifies the skill | Short, lowercase, hyphens, matches the folder name |
| `description` | Tells the agent what the skill does and when to use it | One or two sentences, stated in plain terms |
Some products accept more fields, such as allowed tools or version labels. Unknown fields may be ignored or may cause an error, so confirm against your tool's schema before adding any.
The description is the most important line in the file. The agent often sees only the name and description of every installed skill, and it uses them to decide which skill to load. The next chapter covers how to write it well. Notice that the example says both what the skill does ("Writes a changelog entry") and when to use it ("Use when the user asks to...").
How the pieces load
The agent does not read the whole folder at once. It loads content in stages, which keeps skills cheap until they are needed.
Because of this, keep the body short and move detail into reference files. Link to them by relative path, as the example does with reference/format.md.
Common errors
- A vague description. "Helps with docs" gives the agent no signal about when to load the skill, so it may never be selected.
- A name that does not match the folder. Some tools refuse to load the skill or show it under an unexpected name.
- Broken frontmatter. A missing closing
---, a tab used for indentation, or an unquoted colon inside the description can make the YAML invalid. Quote the value if it contains a colon. - Everything in SKILL.md. A very long body loads in full each time the skill is selected and uses up context.
- Wrong location. Skills are found only in folders the tool scans, often a project directory or a user-level directory. Check where your tool looks.
Exercise
A skill folder contains SKILL.md with the description "Useful for many tasks." The skill is never picked up, even for tasks it was written for. What is the most likely cause, and what is the fix?
Show answer
The description does not say what the skill does or when to use it, so the agent has nothing to match against the task. Rewrite it to state the action and the triggers, for example "Writes a changelog entry in the project's format. Use when the user asks to add, draft, or update a changelog or release note."
Exercise
Why might you place a long style guide in reference/format.md instead of in the body of SKILL.md?
Show answer
The body loads in full whenever the skill is selected, while a reference file is read only when the instructions point to it. Keeping the guide in a separate file saves context on tasks that do not need it.