← Writing

Claude Code skills: how to build one that actually does its job

A downloaded skill runs in Claude Code with your own authority. This is how I build mine: from a problem of my own, terse, and measured with an eval that runs three times.

A downloaded skill runs in Claude Code with your own authority. It reads your files, edits them and runs commands with your permissions, and to the harness its instructions look exactly like yours. Even so, people download skills far too casually, in my view.

TL;DR Before you download a skill, write your own for a problem you keep running into: a minimal description, a short body, references kept apart, and an eval that runs it three times before you trust it.

In this article I build a skill from scratch inside Craft, the plugin I work with in Claude Code. It is called test-my-knowledge, and it checks whether I understand what I am about to approve. I design it from my own problem, measure it with an eval, and at the end I try it on myself. It asked me three questions and found a gap in my mental model with each one.

What a skill is and what it takes up in your context

An LLM is a machine that predicts the next piece of text. It does it remarkably well, which is why it sometimes feels human. It does not know your project or how you work: it only knows what you give it.

What you give it is the context: the instructions, your CLAUDE.md, your conversation and a lot more, which you can inspect with /context in Claude Code, both in Desktop and in the terminal. The context is finite and everything in it competes for the model's attention. What is extra dilutes, and what clashes confuses. And it is sent on every turn of the loop, so any new instruction has to earn its place.

Around the model sits the harness. The model asks for tools (read files, edit files, run commands, reach the internet) and the harness runs them with your permissions, turn after turn.

A skill is a folder of instructions the model reads when it needs them, because its description is always present. A repeatable recipe you can invoke. It takes up the context in three layers:

Anatomy of a Claude Code skill: the description is always in context, the body loads on demand when the model sees a use for it, and references load only when needed

  • The description is always available to the model, except in skills only you can launch, as you will see below. The terser the better, because it takes up context on every turn.
  • The body loads on demand, when the model sees that the description fits what it is doing.
  • References load only when needed. This is my method: whatever is used on demand goes into references, so the body can load without them.

If you want to see when each piece of Claude Code enters the context, it is all in when each feature loads.

A downloaded skill comes in with your authority

To the harness, instructions you download without fully understanding them are indistinguishable from your own. They carry your blessing simply because you downloaded them. A third party skill can arrive bloated, clash with your CLAUDE.md, or bring scripts that run with your permissions without you knowing.

I see two problems in the skills people write. They are extremely verbose, with a lot of fat. And with that much fat come contradictory instructions the model will probably not flag, but that still create friction.

My opinion: the best skill comes from your own problem. It is a bit naive to expect a skill written by someone who does not know you to fit like a glove when the problem is about how you work, your projects and your goals. What I have seen is that they solve 20% and create friction in the other 80. If you already have plenty installed, /skill-doctor shows you the ones you never use.

Anthropic has a dense guide on the subject, Skill authoring best practices. If Claude is your harness, that is what I would read; here are the 5 rules Anthropic publishes for writing skills.

The problem: approving something you do not understand

Craft already has status, which tells me where I am in the method (Shape, Plan, Try, back to Plan from Implement), and wtf, which explains Claude's last message more simply. Nothing asked me: are you sure you understand what you are about to approve and build on?

When I am about to approve something, I often feel that something is slipping past me. Some uncertainty is unavoidable, but sometimes I want to be sure I understand how it all fits together. That is the problem, and it is mine.

My rules for writing a skill

The descriptions of my skills are extremely terse, without losing adherence. I have evals that check description adherence at different lengths, and I settled on a sweet spot: the bare minimum to say what the skill does, because in the ones the model can launch it is always in memory.

The body, as terse as possible, in plain prose, not in the coded language of the agent of the day. Less is better. Whatever more than one skill reuses, or a single skill uses on demand, goes into its own reference file.

It is simple, but when you delegate everything to an agent it is much easier to end up doing the opposite. Add downloading skills without even reading them, and it gets dangerous. And if a skill only makes sense in one part of the repository, it can live in that folder.

Shaping it: start with the bare minimum

I opened a new session in the Craft repository and started with shape. This is what I dictated to Claude:

  • The question: do you really understand what you are about to approve?
  • The input: the dirty working tree. Later it could take a slug or a commit, but for now that is enough.
  • The sources: the shape, the slices and whatever is being decided.
  • The questions: what it touches, what it breaks, how it works and what follows from it. Domain and architecture before code.
  • The format: three questions at most, one at a time, in free text, with an optional whiteboard when the concept is very visual. It corrects, it ends, and it writes nothing.
  • The eval: the history carries test-my-knowledge and the first question, and the prompt is my wrong answer.

Claude immediately suggested accepting a slug or a commit. I had already thought of that, but I do not need it yet. Start with the bare minimum and add when it hurts, which is exactly the opposite of what your instinct asks for. The skill sets disable-model-invocation: true, so the model cannot launch it on its own and its description does not even take up context: only I launch it, by typing its name, like any custom slash command.

---
name: test-my-knowledge
description: Test whether you understand the work before you approve it.
disable-model-invocation: true
---

Shaping surfaced something I did not know. A real session stores the command and then the expanded skill body, with an isMeta property. If the eval's history only carries the command, the eval tests the base model, not the skill. I asked for a Visualize diagram because I did not get it.

Shape's instructions told it to keep moving, and it did not consider my doubt serious enough to stop. I did, so I stopped it: it could not go on until it explained what isMeta means. Never let a chance to learn another piece of the puzzle slip by. Claude explained it and I checked my understanding in my own words; it is not in the skills documentation, so take it as what I understood: isMeta is a visibility and authorship mark. It flags harness orchestration messages, such as reading a skill's content, that are part of the loop but are not drawn as conversation between the model and the human.

A subagent tried to tear the shape down looking for blind spots, and before the plan Claude flagged one of mine: the documents of new work are untracked and do not show up in git diff. The skill reads them as files, from git status with untracked files. Without something like Craft I would have noticed with everything already built.

The eval: measure before you trust

In the plan, the eval came first, to clear the uncertainty as early as possible. The definition Claude gave me: a repeatable experiment that measures whether a system with a model inside behaves as it should. You give it a fixed situation, let it act as in real use, and grade the result against criteria written in advance in the graders. What it proves is probabilistic.

The pieces of a Claude Code skill eval: fixture, history and prompt feed the agent; the graders are invisible to it; deterministic graders check it edits, writes and commits nothing, and an LLM judge decides PASS or FAIL; the verdict comes from three runs

  • The fixture is the stage: a repository with a logout change in progress.
  • The history is the staged prior conversation. It carries the command and the skill body with isMeta set to true, and the first question: when a session ends with endSession, what happens to the token that opened it?
  • The prompt is the turn being graded, the staged human's answer. It is wrong:
No pasa nada con el token. Sigue siendo válido hasta que caduca a los 15 minutos; endSession solo marca la sesión como terminada.

That is Spanish for "Nothing happens to the token; it stays valid until it expires after 15 minutes, and endSession only marks the session as ended."

The agent never sees the graders. If it knew how it was being scored, it would play to it, and that is bias. There are two kinds. Some are deterministic: did it use this tool or not? This one demands zero edits, and there are matching ones for Write, for git commit or git push and for shell writes.

---
type: tool_used
tool: Edit
min: 0
max: 0
arm: both
weight: 0.5
---

The other is an LLM judge, probabilistic, with its PASS or FAIL criterion inside the grader itself: it passes if it says the answer is wrong because endSession revokes the token, backs that with a file:line, and does not accept it. The verdict comes from three runs or more. The check for an eval is running it, several times. To go further, see how to compare your plugin against a baseline without it; and if you would rather have Claude guide you, skill-creator creates and tests skills.

Slimming the skill down and measuring again

While I was building it, test-my-knowledge was not on Craft's remote yet, so I launched Claude with --plugin-dir on the working tree, to test it without uninstalling anything.

claude --plugin-dir ./plugin

Before using it, I read it. It was extremely verbose. Every paragraph was inflated, and I asked for a 20 to 30% cut that said the same thing. That is not improvising: I have done it hundreds of times, and I know that however many instructions it has, the model tends to add more than it needs.

Any change to the orchestration means running the eval again. It passed 3 out of 3.

The live test: three questions, three gaps

I launched it with the tree dirty and it asked me three questions, one at a time.

How test-my-knowledge works: it reads the shape, the slices and the working tree diff; asks up to three questions, one per turn, in free text; corrects each answer with file:line; ends with what you understand and what escapes you, and writes nothing

The first was about disable-model-invocation and detached mode. I answered very sure of myself and got detached mode wrong: that flag does not stop you from launching it by typing the command. My mental model was challenged live.

The second: tomorrow you change one sentence of the skill and nothing else. What does the eval's history hold under isMeta now? The old copy. The eval goes green while it grades the old rules, and nothing warns you. Copying the skill body solved getting it loaded in the graded turn, and the price is the coupling. That one hit me where it really hurts.

The third was about the eval's sandbox and git status with untracked files. There was a rule I did not understand, and I could not say why the design accepts the eval taking either path.

I thought about cutting it from the video and did not. We often criticise models for how sure they sound, but human mental models have gaps too, and it is good to have them put right in front of you. The final summary does not stop me from working: two lists, what I understand and what escapes me, and one line. Whether to approve is your call.

The best skill comes from your problem

Test-my-knowledge solves a problem that is easy to think you do not have when you feel very sure of yourself, as I did. It is a genuinely useful piece, and it came from something that happens to me, not from a download.

Be careful what you download. Write your own: a minimal description, a short body, references kept apart, and an eval that runs it three times before you trust it.

Found this useful? See more of wmedia.es in your Google results.

Add wmedia.es as a preferred source on Google
Free guide

The 51 essentials, as a guide.

One page per tip. Five chapters. What I actually use daily in production. No theory, no fluff.

  • 1. Getting started 10 tips
  • 2. Awareness 3 tips
  • 3. Mastery 22 tips
  • 4. Autonomy 15 tips
  • 5. Comparison 1 tip
Are you a professional Web developer?

You'll receive the guide by email · Unsubscribe anytime

of 51
#

Wmedia · 51 tips
Free guide · 51 tips · 5 chapters

The 51 essentials, as a guide.

One page per tip. Five chapters. What I actually use daily in production. No theory, no fluff.

Are you a professional Web developer? · Unsubscribe anytime

Want the 51 Claude Code essentials as a guide?