Write your first skill
This guide assumes you already know how to do one thing with your agent. We turn it into a skill: a folder the agent will load by itself the next time the topic come…

This guide assumes you already know how to do one thing with your agent. We turn it into a skill: a folder the agent will load by itself the next time the topic comes up.
0. The principle: never start from a blank page
Succeed at the task by hand with your agent first, then extract the method from the conversation.
The session already holds the useful steps, the errors hit, the fixes and the expected output format. When the task is done, ask it:
Summarize the method we just used: the steps in order, the errors we avoided or fixed, and the expected output format. Separate what needs judgment from what is purely mechanical.Three questions before creating anything:
- Does the agent need it, or is it already good at this?
- Does it get a better result when it uses it?
- Do I want to launch it myself?
A skill that is never used is worth nothing. Three right skills beat a catalogue that gets in the way.
1. The three-level structure
A skill is a folder:
my-skill/
├── SKILL.md the method: what the agent reads when the topic arrives
├── references/ the details, opened only when a step requires them
└── scripts/ repetitive operations, run instead of reinventedThe three load in cascade: name and description are used to choose, SKILL.md gives the method, references and scripts bring the detail at the useful moment.
The SKILL.md must say when to open each file in references/. A link alone is not enough: without that hint, the agent does not know when to go there.
2. The frontmatter: two fields, and they matter
---
name: my-skill
description: "What it does and when to use it, in one sentence."
---name: the folder name. That is what becomes the command.description: the only thing permanently exposed to the model. It is truncated beyond 1,536 characters, and every long description costs context on all your tasks, not only the ones about that skill. Stay short and precise: its only job is to allow the right choice.
3. Keep only what changes behaviour
The test: remove an instruction. If the result does not change, it did not belong there.
Delete repetitions, general explanations, redundant examples and reminders of what the model already knows how to do. A short skill is not better by nature: it is better when it keeps the constraints that make a difference in your real context.
4. Pick the right degree of freedom
| Fragility of the task | What you write |
|---|---|
| It needs judgment: review, diagnosis, writing | A goal and principles. The agent chooses the method. |
| The shape must stay stable: output format, report | A template or a parameterised procedure. |
| A mistake is costly: money, deletion, deployment | A precise command or script, executed as is |
The criterion is simple: what is the consequence of another way of doing it?
5. Invocation: automatic or manual?
By default, the skill description is exposed to the model, which can invoke it on its own. That is what you want for a capability you want applied: diagnosis, review, verification.
For a workflow you want to launch yourself (commit, publishing, content recovery), disable spontaneous invocation:
- Claude Code:
disable-model-invocation: truein the skill frontmatter. - Codex:
policy.allow_implicit_invocation: falsein the skill'sagents/openai.yamlfile. It is not the Claude field, and it does not work the other way around.
A workflow launched at random by the model costs context and leaves your scope. Reserve auto-invocation for genuinely cross-cutting capabilities.
6. Install it
Exact path by tool and scope: guides/01-where-to-put-files.en.md. In short, .claude/skills/<name>/ for Claude Code, .agents/skills/<name>/ for Codex, per project or in your account.
Keep one single reference location: two copies of the same skill silently mask each other depending on the tool's discovery order.
7. Audit, then archive
Every few weeks, put your skills through the questions:
- Does the agent invoke it?
- Is the result good when it uses it?
- Do you launch it explicitly yourself?
A skill never used nor launched, or two descriptions that look too alike: move it to an archive folder outside the discovery path. You do not delete, you take it out of the catalogue while keeping the option to come back.
Same reflex after an installation: check what the tool added, where it discovered it, and whether that skill should be global, project-local, or manual.
Classic mistakes
- Several copies of the same skill: one masks the other with no error. One source only.
- A description used as documentation: documentation lives in
SKILL.mdor inreferences/. - A skill that redoes what the model already knows: try without it first. Create it only when it fixes a real observed difficulty.
- Rules instead of tools: for an expensive prohibition (permanent deletion, sending), a tool control that blocks the action beats one more sentence to follow.