Sub topic 8
Agent skills: capabilities loaded on demand
This chapter assumes you have used an AI coding assistant, can read Markdown and simple YAML, and know the basic layout of a Git repository. File names and frontmatter fields differ between products, so treat the examples as illustrative and check your tool's documentation.
What a skill is
An agent skill is a folder of instructions that the agent can load when a task calls for it. The entry point is a file named SKILL.md. It starts with a short name and description, followed by the full instructions.
A skill differs from the other mechanisms in how it gets loaded:
- A persistent instruction file is read at the start of every session.
- A prompt file runs when you invoke it by name.
- A skill is chosen by the agent. It reads the skill's description, decides the task matches, and only then loads the rest.
This keeps your context window free. You can install many skills, and each one costs only a line or two until it is used.
A minimal skill
---
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 the part the agent always sees. The body is read only after the skill is selected. The last line points to a separate file, which the agent opens only if it needs the detail.
How loading works
The description does the selecting. If it is vague, the skill never triggers, or it triggers on the wrong tasks. The next chapters cover descriptions and the layers of disclosure in more detail.
Skill versus prompt file
A prompt file and a skill can hold nearly the same text. The difference is who decides to use it.
| Question | Prompt file | Skill |
|---|---|---|
| Who starts it? | You, by name | The agent, from the description |
| What is always in context? | Nothing | Name and description |
| Can it bundle files and scripts? | Usually not | Yes, in its folder |
| Best for | Tasks you trigger on purpose | Know-how the agent should reach for itself |
Common errors
- A description that says what but not when. "Changelog helper" gives the agent little to match against. Say what the skill does and which requests should trigger it.
- Putting everything in SKILL.md. A long body is loaded in full every time the skill triggers. Move rarely needed detail into reference files.
- A skill that duplicates project rules. If every task needs the instruction, put it in persistent project instructions instead.
- Several skills with overlapping descriptions. The agent may pick the wrong one or load both.
Exercise
A teammate has a 40-line checklist for preparing releases. They want the agent to use it whenever someone mentions cutting a release, without the checklist taking up space in every session. Should they use a persistent instruction file or a skill, and what must they get right for it to work?
Show answer
A skill. Only the name and description stay in context, and the 40-line body loads when a request matches. It works only if the description states both what the skill does and when to use it, for example "Use when the user asks to prepare, cut, or publish a release."