If you use Claude Code every day, you already know the feeling. You paste the same checklist into chat for the tenth time this week — how you want commit messages written, how a migration should be reviewed, the exact steps for cutting a release. It works, but you are paying for those same words in every session, and the day you forget to paste them, the output quietly drifts.
Claude Code skills fix exactly that. A skill is a small folder of instructions that Claude loads on demand, so you write the workflow once and it follows it every time — without you remembering to ask. This guide shows you how to build your first one, with a complete working example you can copy into your own projects.
What Claude Code skills actually are
A skill is a folder that contains a SKILL.md file. That file has two parts: a YAML frontmatter block at the top, and a markdown body underneath. The frontmatter tells Claude what the skill is called and when to use it. The body tells Claude what to do once the skill loads.
The key idea is progressive disclosure, and it is the reason skills are cheap to keep around. Anthropic’s documentation describes three loading levels:
- Metadata, always loaded: only the skill’s name and description sit in context at startup, at roughly 100 tokens per skill.
- Instructions, loaded when triggered: the body of
SKILL.mdenters context only when your request matches the skill’s description — under 5,000 tokens. - Resources and code, loaded as needed: extra markdown files load only when read, and scripts run through bash with only their output entering context — the script code itself never does.
That is why you can install dozens of skills without a context penalty. Nothing costs you anything until it is actually used. It is also why skills beat stuffing everything into CLAUDE.md: content in CLAUDE.md loads in every session, while a skill’s body loads only when it is relevant.
Skills are also model-invoked. Unlike a slash command you type yourself, Claude decides on its own when a skill is relevant, by matching your request against the description you wrote. You can also invoke one directly by typing /skill-name at the prompt.
When to build a skill — and when not to
Claude’s own docs give a good rule of thumb: create a skill when you keep pasting the same instructions, checklist, or multi-step procedure into chat, or when a section of CLAUDE.md has grown from a fact into a procedure. Good candidates are repeatable workflows with a stable input, process, and output: writing commit messages, reviewing migrations, cutting releases, triaging a failing test suite.
Do not build a skill for a one-off task, for a fact Claude should simply know (that belongs in CLAUDE.md), or for something only you will do once. And never put secrets, credentials, or confidential material in a skill — skills are meant to be shared and committed to git.
The anatomy of a SKILL.md file
Every skill needs a SKILL.md with YAML frontmatter. Only two fields are required, and both have rules worth getting right the first time:
name: maximum 64 characters, lowercase letters, numbers, and hyphens only. It cannot contain the reserved wordsanthropicorclaude, and it cannot contain XML tags. In a personal or project skill, this name (or the folder name, if you omit it) is the command you type after/.description: non-empty, maximum 1,024 characters, no XML tags. It must say both what the skill does and when to use it.
The description is the single most important line you will write. Claude decides whether to load your skill based entirely on it. A description that says “helps with commits” will never fire reliably. One that says what, when, and on what trigger — “write a commit message from staged changes; use when the user asks to commit, or says ‘commit this'” — will.
Beyond the two required fields, Claude Code supports extra frontmatter for finer control. The ones you will reach for first are:
allowed-tools: tools Claude can use without asking permission during the turn that invokes the skill. The grant clears when you send your next message.disallowed-tools: tools removed from Claude’s pool while the skill is active — useful for autonomous skills that should never, say, ask you a question mid-run.disable-model-invocation: true: stops Claude loading the skill automatically, so it only runs when you type/name.context: fork: runs the skill in a forked subagent, optionally with anagenttype — handy for long, self-contained jobs like a deep review.paths: glob patterns that limit automatic activation to sessions working with matching files.argument-hintandarguments: declare the arguments a skill accepts, so you can reference them in the body as$ARGUMENTS,$0, or a named$name.
One portability warning: if you want the same skill to work in claude.ai uploads, the Skills API, or the package_skill.py packager, only six frontmatter fields are allowed there — name, description, license, compatibility, metadata, and allowed-tools. Anything else fails packaging with a hard error. Claude Code itself accepts every field, so frontmatter that sticks to the spec loads everywhere.
Where to put your skill
Where you save a skill decides which sessions load it:
| Location | Path | Loads in |
|---|---|---|
| Personal | ~/.claude/skills/skill-name/SKILL.md |
All your projects on this machine |
| Project | .claude/skills/skill-name/SKILL.md |
Sessions in this repository — commit it so your team gets it too |
| Plugin | plugin-name/skills/skill-name/SKILL.md |
Wherever the plugin is enabled, as /plugin-name:skill-name |
| Enterprise | Managed settings directory | All users on machines where your organisation deploys it |
Start with project scope for anything tied to one codebase, and personal scope for habits that follow you everywhere — your commit style, your review checklist. Two naming traps to avoid: never name a skill folder synced (Claude Code reserves it for skills downloaded from claude.ai), and never name one anthropic-skills outside a plugin, or it will not load at all.
Build your first skill: a commit-message skill
Enough theory. Here is a complete, working skill you can drop into a project today. It standardises commit messages so every commit reads the same way, whoever (or whatever) writes it.
Create the folder and file:
mkdir -p .claude/skills/commit-message
Then write .claude/skills/commit-message/SKILL.md:
---
name: commit-message
description: Write a Conventional Commits message from staged git changes. Use when the user asks to commit, write a commit message, or says "commit this".
allowed-tools: Bash(git diff:*), Bash(git status:*), Bash(git log:*)
---
# Commit Message
Write a commit message for the currently staged changes.
## Steps
1. Run `git status --short` and `git diff --cached --stat` to see what is staged. If nothing is staged, stop and say so — never commit unstaged work by surprise.
2. Run `git diff --cached` and read the actual change, not just the file names.
3. Run `git log --oneline -10` and match the existing style of this repository.
4. Draft the message in Conventional Commits format: a type (`feat`, `fix`, `docs`, `refactor`, `test`, `chore`), an optional scope, and a subject line under 72 characters in imperative mood ("add", not "added").
5. Add a body only if the change needs explaining: what changed and why, not how. Never mention the AI tool in the message.
6. Show the message and wait for approval before running `git commit`.
## Rules
- One logical change per commit. If the staged diff mixes unrelated changes, say so and suggest splitting it instead of writing one vague message.
- Never amend, force-push, or change history without being asked explicitly.
- Never commit secrets, `.env` files, or credentials. If one appears in the diff, stop and flag it.
Restart your Claude Code session, then type /commit-message after staging a change — or just ask Claude to commit something and watch the skill load on its own. The allowed-tools line means the read-only git commands run without a permission prompt during that turn; the grant clears as soon as you send your next message, so it never becomes a standing permission.
Notice what the example does not do. The body is short and procedural. It does not paste in the repository’s entire commit history, a style guide, or edge cases — that material belongs in a reference file the skill reads only when needed. If your skill’s body grows past a few hundred lines, split it: keep the workflow in SKILL.md and move the detail into REFERENCE.md or a scripts/ helper, and have the body point at them.
Five mistakes that make skills useless
Most skills fail for boring, fixable reasons. Watch for these:
- A vague description. “Helps with code review” fires never or fires everywhere. Name the trigger: the request, the file type, the moment in the workflow.
- Everything in the body. A 2,000-line
SKILL.mdcosts tokens every time it loads and gets skimmed, not followed. Workflow in the body, detail in reference files, determinism in scripts. - One mega-skill. A skill called “do everything well” is a second
CLAUDE.md. Small, single-purpose skills compose; big ones blur. - Secrets and machine-specific paths. Skills get committed and shared. Use
${CLAUDE_SKILL_DIR}and${CLAUDE_PROJECT_DIR}to reference bundled files and the project root instead of hardcoding paths. - Never testing it. A skill you have not triggered is a wish, not a tool. Test both paths: the automatic one (ask the matching question and confirm it loads) and the manual one (
/skill-name).
Test and debug your skill
After creating or editing a skill, restart the session — Claude Code does not re-read a skill file mid-session on later turns. Then check three things:
- It appears in the
/menu under the name you expect. If it is missing, check the folder and frontmatter names for refused characters (zero-width spaces, angle brackets, double spaces) — start Claude withclaude --debugand search the debug log for[names]to find what was refused. - It loads when you describe the matching task in plain language, without typing the slash command. If it does not, the description is the problem, not the body — rewrite the description first.
- It behaves on a real task, not a toy one. Run it against an actual staged diff, an actual migration, an actual release checklist, and fix whatever it gets wrong before you commit it.
For a skill that runs in the background or on a schedule, disable-model-invocation and context: fork are worth learning next: the first keeps a manual-only workflow out of automatic triggering, and the second gives a long job its own subagent context instead of crowding the main conversation.
Skills, slash commands, and plugins — how they fit together
If you already have Markdown files in .claude/commands/, those still work — that is the older format, and it supports the same frontmatter except name and paths. For new work, prefer a skill: it supports supporting files, scripts, and the full frontmatter table, and it follows the Agent Skills open standard, so the same skill can load in other tools that support the standard, including GitHub Copilot, Cursor, and Gemini CLI.
Plugins are the distribution layer on top. A plugin bundles skills (plus agents, hooks, and MCP servers) so a whole team can install one package and get the same workflows. And if you just want a quick tour of the format, Claude Code ships bundled skills you can study in place — /doctor for a setup checkup, /code-review, /debug, /verify, and /run among them. Run /doctor sometime: it even flags CLAUDE.md content that should probably have been a skill all along.
One security habit before you share skills
Anthropic’s own guidance is blunt: treat a skill like installing software. A skill can grant itself broad tool access through allowed-tools — and Claude Code applies a project skill’s allowed-tools even in a non-interactive run in a folder you have never trusted. Before you run Claude Code in a repository someone else set up, read the SKILL.md files checked into .claude/skills/, especially their frontmatter, and look for tool grants and network calls that do not match the skill’s stated purpose. The same applies in reverse: when you publish a skill, keep its tool grants minimal and obvious, so the next person can trust it at a glance.
Your first skill, this week
Pick the one workflow you paste into chat most often, write it as a skill with a sharp description, and commit it to one project. Test it twice — once by typing its name, once by describing the task and letting Claude find it. When it works, you will feel the difference immediately: the same quality, every time, with nothing to remember. That is the whole point of skills — not a cleverer prompt, but a workflow that stops depending on your memory.
All Claude Code behaviour in this post was verified against the official Claude Code skills documentation and the Agent Skills platform documentation on 30 October 2026.
Further Reading & References
- Extend Claude with skills — Claude Code Docs
- Agent Skills — Claude Platform Docs
- Agent Skills open standard
- Anthropic’s open-source skills repository
- How to Build Your Own Claude Code Skill — freeCodeCamp
- Agent Skills (Claude): how to create, install, and version
- Claude Agent Skills: A Complete Developer Guide
- What Are Claude Skills and How Do You Use Them?
- How to Use AGENTS.md in Any Repo — HowToShipIt
- Claude Code Hooks Explained — HowToShipIt
- Run Multiple AI Coding Agents in Parallel with Git Worktrees — HowToShipIt



