All posts

· 9 min read

How to build an AI Skill (and stop pasting the same prompt)

A skill is a reusable recipe your AI agent loads only when it needs it. Learn its anatomy, build a security checklist step by step, and see how to test it and move it between tools.

On this page
  1. Agent vs skill: who and how
  2. Anatomy of a skill
  3. The description is the trigger
  4. Progressive disclosure
  5. Building security-checklist
  6. Testing it
  7. When it does not trigger
  8. Portability: one folder, several tools
  9. Beginner mistakes
  10. Wrap-up

Every week you paste the same prompt: “review this code, look for injection, secrets in the repo, missing input validation and authorization problems, and give me findings with file and line.” You copy it from a note, tweak it, and hope you did not drop a line. Your review criteria live in a stray note and in your memory, and memory fails on exactly the day it matters.

A skill fixes that, and it is simpler than it sounds: a folder with a text file in it.

This post is the inside view. In the video where we built the hackernews and mensaje-commit skills we covered the hands-on part in ten minutes, and the concepts are in 5 things you should know about AI Skills. Here we go through the anatomy, why the description decides everything, and how to test a skill and move it between tools.

Agent vs skill: who and how

In the post about the security agent that reviews your code before every commit we built an agent. An agent is who does the work: it has a role, instructions, tools and permissions.

A skill is how one specific task gets done: a reusable recipe the agent loads only when the task calls for it. The agent is the cook. The skill is the recipe it pulls off the shelf when someone orders that dish.

Why not put everything in the agent? Because context is limited and it costs something. If the agent loads every recipe in every conversation, it spends attention on things that do not matter right now. With skills, only the name and description stay in context all the time. Everything else is read on demand.

Anatomy of a skill

Under the open Agent Skills standard, a skill is a folder with a SKILL.md file:

security-checklist/
├── SKILL.md          # required: metadata + instructions
├── scripts/          # optional: executable code
├── references/       # optional: supporting docs
└── assets/           # optional: templates and resources

SKILL.md starts with YAML frontmatter. The specification requires two fields:

  • name: up to 64 characters, lowercase letters, numbers and hyphens only (no leading or trailing hyphen, no double hyphens). It must match the folder name.
  • description: up to 1024 characters. It must say what the skill does and when to use it.

After the frontmatter comes a Markdown body. There is no mandatory format: write whatever helps the agent do the job.

The description is the trigger

This is the most underrated part. At startup the agent reads only the name and description of each skill. From that alone it decides whether the skill fits your request. If the description does not match what you asked for, the agent will not open the body on its own. Your skill can be perfect and still not exist as far as the agent is concerned.

The spec itself shows the contrast. The poor one:

description: Helps with PDFs.

The good one:

description: Extracts text and tables from PDF files, fills PDF forms, and merges multiple PDFs. Use when working with PDF documents or when the user mentions PDFs, forms, or document extraction.

The second says what it does and when to fire, using words a user would actually type.

Progressive disclosure

The standard describes three stages:

  1. Discovery: at startup only name and description are loaded.
  2. Activation: when the task matches the description, the full SKILL.md is read.
  3. Execution: the agent follows the instructions and, only if needed, opens files in references/ or runs scripts.

That is why the advice is to keep SKILL.md short (the spec suggests under 500 lines) and push detail into separate files.

Building security-checklist

Let’s turn the review prompt from the opening into a skill: a short checklist, inspired by OWASP, with four areas: injection, secrets, input validation and authorization.

Create a security-checklist/ folder and put this SKILL.md inside:

---
name: security-checklist
description: Reviews code against a short OWASP-inspired security checklist (injection, secrets, input validation, authorization) and returns findings with file, line and severity. Use when the user asks for a security review, audits a change, reviews a pull request, or looks for vulnerabilities.
---

# Security checklist

Review only the code you were given. Do not modify files.
For each item, find concrete evidence in the code before reporting.

## 1. Injection
- SQL queries built with string concatenation or interpolation.
- Shell commands built from external data.
- HTML or templates that insert input without escaping.
Recommend parameterized queries and context-aware escaping.

## 2. Secrets
- Keys, tokens or passwords in source code, in versioned config files, or in logs.
- `.env` files that are not in `.gitignore`.
Recommend environment variables or a secrets manager. Never repeat the secret value in your answer.

## 3. Input validation
- Data arriving over HTTP, CLI or files and used without checking type, size or format.
- Validation done only on the client.
Recommend server-side validation, with an allow-list when possible.

## 4. Authorization
- Endpoints with no identity or permission check.
- Resource access by ID without checking it belongs to the user.
Recommend checking permission on every request, server side.

## Output format
A list of findings. Each one with: file and line, category, severity (high, medium, low), why it is a problem, and the suggested fix.
If a category has no findings, say so explicitly. If you could not verify something, state what was missing.

Three decisions worth pointing out.

The description carries phrases people say. “Security review”, “pull request”, “vulnerabilities”. If your team says “audit”, it goes in there.

The body says what to look for, not what things are. Each item describes evidence in the code, not the theory of injection. The model already knows that. What it does not know is your criteria and your format.

The output format is part of the recipe. It is what makes results comparable week after week.

If the checklist grows tomorrow (per-language rules, say), do not stuff them in here. Create references/dotnet.md and point to it from SKILL.md: “if the project is .NET, read references/dotnet.md.” It loads only when it applies.

Testing it

An untested skill is a guess. Three checks, from easiest to hardest.

1. Does the tool see it? In Claude Code, the docs suggest asking “What skills are available?” to confirm it shows up; if you just created it and it is missing, run /reload-skills. In Codex CLI, the docs say to run /skills or type $ to mention one. If it is missing, the problem is location or frontmatter, not the description. In Claude Code, the frontmatter must start on the first line of the file.

2. Does it trigger on its own? Ask for the task without naming the skill: “review the security of this endpoint.” If the agent follows your checklist and your output format, the description works.

3. Does it trigger when it should not? Ask something close but different: “explain what SQL injection is.” A skill that fires for everything is as annoying as one that never fires.

When it does not trigger

It is almost always the description. Fixes, in order:

  • Add the words you use when you ask for the task, not the ones you would put in a manual.
  • Say “Use when…” with concrete situations.
  • Put the main use case first. The Claude Code docs warn that the combined description and when_to_use text is truncated at 1,536 characters in the skill listing.
  • As a last resort, call it by name. In Codex you mention it with $; in Claude Code the name becomes a / command.

If you are not sure why it missed, do not guess: change one thing at a time and repeat the same request.

Portability: one folder, several tools

The format was developed by Anthropic and released as an open standard. According to agentskills.io, it is supported by “a large number of AI tools and agentic clients”; the list is in its Client Showcase. Here are only the two I confirmed in their official docs:

ToolPersonal skillsProject skills
Claude Code~/.claude/skills/<name>/SKILL.md.claude/skills/<name>/SKILL.md
Codex$HOME/.agents/skills.agents/skills (in the working directory and each parent up to the repo root)

Two details. The Claude Code docs list more frontmatter fields than the base spec (for example disable-model-invocation) and say it ignores unknown fields without an error; the same page warns that packaging or uploading that skill outside Claude Code fails on a field the spec does not define. Codex adds its own settings in agents/openai.yaml. The core, a folder plus a SKILL.md with name and description, is what travels. The optional extras may not.

The two tools do not read the same path: the Claude Code docs do not mention .agents/skills. What both docs do say is that they follow symlinks in their skill folders. My advice: write the skill with only what the spec requires, keep it once in your repo, and link it from the other location:

mkdir -p .agents/skills/security-checklist .claude/skills
# SKILL.md lives in .agents/skills/security-checklist/ (Codex reads it there)
ln -s ../../.agents/skills/security-checklist .claude/skills/security-checklist

One copy, no two versions drifting apart.

Beginner mistakes

The giant skill that does everything. A “dev-helper” with review, deploy and commit style. Its description has to be vague to cover it all, and vague means it never triggers well. One skill, one task.

A vague description. We covered it: “Helps with security” tells the agent nothing about when to load it.

Putting secrets in. A skill is a folder you will version, copy and share. No tokens, no internal URLs, no customer data. If it needs a credential, have it read one from the environment.

Duplicating what is already in CLAUDE.md or AGENTS.md. Those files hold project rules that always apply: conventions, commands, constraints. A skill is a procedure that applies sometimes. Copy the same thing into both and you will have two versions that drift apart.

Wrap-up

If you have pasted a prompt more than twice, it is probably a skill already. Start with one folder, one SKILL.md, and a description that sounds like how you actually ask for things.

Which skill would you build first? Tell me in the comments of the video on building skills, by DM on Instagram or in the Discord community, and if it is a good one we will build it in a future episode.