Writing your own agent skill in one afternoon
A skill is a Markdown file with a name and a description. Here is how I write one, what makes the agent actually use it, and the mistakes that made my first skills useless.
Gustam Rheza
After using other people's skills for a while, I wanted my own. Every project has rules that live only in my head: how this repo runs migrations, which components to reuse, what "done" means. Writing them down once as a skill means I stop repeating them to the agent.
It turned out to be easier than I expected. This is what I learned.
What a skill is
A skill is a folder. The only required file is SKILL.md, which starts with a short block of metadata:
- name: a short identifier, like
release-checklist - description: one or two sentences that say what the skill does and when to use it
Below that block is plain Markdown: the instructions themselves. The folder can also hold reference files, templates or scripts that the instructions point to.
The important idea is that the agent does not read everything up front. It sees only the names and descriptions of the available skills. When a task matches a description, it loads the full instructions. When the instructions mention a reference file, it reads that file only if it needs it. This keeps the context small even with dozens of skills installed.
The description does most of the work
My first skill never ran. The instructions were good, but the description said "Helpers for this project". The agent had no way to know when that applied.
A good description names the trigger. Compare:
- "Helpers for this project"
- "Use when creating or running a database migration in this repo, or when the user mentions migrate, schema change or a new field"
The second one tells the agent exactly when to load the skill. I now write the description last, after I know what the skill covers, and I include the words a person would actually type.
Write instructions like a checklist, not an essay
The body of a skill is read by a model in the middle of a task. Long explanations get skimmed. What works:
- Short, numbered steps for any process with an order.
- Rules with a reason, so the agent can handle cases you did not foresee. "Back up the production branch before a migration, because a failed migration cannot be undone" is better than "Always back up".
- Concrete examples of good and bad output.
- A clear finish line: what to check before saying the work is done.
If a section grows past a page, I move it into a reference file and link to it from the main file.
Scripts for anything that must be exact
Some steps should not be left to the model's judgement. Counting font sizes on a page, checking contrast ratios or validating a config file are better done by code. A skill can ship a small script and tell the agent to run it, then act on the result.
This is the difference between "make sure the contrast is fine" and "run this script, fix every line it reports, and run it again until it is empty".
Test it on a real task
The way to know if a skill works is to give the agent a real task without mentioning the skill, and see whether it loads it and follows it. If it does not load, fix the description. If it loads but ignores a step, that step is probably buried or unclear.
I keep a few skills in each repository, next to the code they describe, so they change in the same commits as the code. Personal skills, like my writing style, live in my home folder and follow me between projects.
Start small
You do not need a framework or a library. Pick one thing you explain to your agent every week, write it down in ten lines, give it a sharp description, and try it on your next task. You will rewrite it twice. That is normal, and it is still faster than explaining the same thing again.