Claude Code skills: how they work and how to write one
How Claude Code skills work, checked against Anthropic's docs on Nov 20, 2026: what a skill is, where SKILL.md lives, the frontmatter fields, how Claude decides to load one, skills vs CLAUDE.md, subagents and hooks, installing skills from plugins, an example skill and security notes.
Last checked: 2026-11-20, against Anthropic's Claude Code docs: Extend Claude with skills, Extend Claude Code (the feature overview), Install and manage plugins, and Plugin security and trust. The newest Claude Code release that day was 2.1.329. The example skill is ours, not Anthropic's; it only reads your git log and prints text.
Short answer: a skill is a folder with a SKILL.md file. YAML frontmatter at the top says what it does and when to use it, and the Markdown below is the instructions. By default Claude sees only each skill's name and description until it uses one, and you can run a skill yourself by typing /skill-name unless its frontmatter sets user-invocable: false.
What is a Claude Code skill?
A skill is a reusable set of instructions, knowledge or a workflow that Claude loads when your request matches it, or when you invoke it with /name. Anthropic suggests making one when you keep pasting the same checklist into chat, or when part of CLAUDE.md has grown into a procedure rather than a fact.
Claude Code skills follow the open Agent Skills standard (agentskills.io) and add extras such as invocation control, running in a subagent and dynamic context injection. Custom commands have been merged into skills: files in .claude/commands/ still work, but when a skill and a command share a name, the skill wins.
Where does SKILL.md live?
In a folder named after the skill, under one of the skills directories below. The folder name, or the frontmatter name when you set one, becomes the command you type.
| Location | Path | Loads in |
|---|---|---|
| Personal | ~/.claude/skills/<skill-name>/SKILL.md | All your projects on this machine, but not Cowork or cloud sessions |
| Project | .claude/skills/<skill-name>/SKILL.md | Sessions in this repository, but not cloud threads in a project; commit it to share |
| Nested | <subdir>/.claude/skills/<skill-name>/SKILL.md | Sessions started in or below that folder, or once Claude works on files there |
| Additional directory | .claude/skills/<skill-name>/SKILL.md in a directory passed with --add-dir | That session |
| Plugin | <plugin>/skills/<skill-name>/SKILL.md | Wherever the plugin is enabled, as /plugin-name:skill-name |
| Enterprise | .claude/skills/ in the managed settings directory | All users where the organization deploys it |
- Same name in several places: enterprise beats personal, and personal beats project. A plugin skill and a same-named skill elsewhere both load, because plugin skills are namespaced as /plugin-name:skill-name.
- Claude Code watches the skills folders (except in bare mode), so new or edited SKILL.md files apply in the running session. If one does not appear, run /reload-skills. In a skill folder that is also a plugin, changes to hooks/, agents/ or .mcp.json need /reload-plugins.
- A skill folder can hold supporting files such as reference.md or scripts/. Link them from SKILL.md so Claude knows when to read them, and keep SKILL.md itself under 500 lines.
Which frontmatter fields can you set?
All fields are optional; description is the one Anthropic recommends, because Claude uses it to decide when to load the skill. Field names must match exactly: Claude Code ignores an unknown field without an error, and if the YAML does not parse, the skill loads with no fields set.
| Field | What it does |
|---|---|
| name | Command name in the / menu; defaults to the folder name |
| description | What the skill does and when to use it; combined with when_to_use, cut at 1,536 characters in the listing |
| when_to_use | Extra trigger phrases, appended to the description |
| argument-hint, arguments | Autocomplete hint, and named arguments for $name substitution ($ARGUMENTS holds everything typed) |
| disable-model-invocation | true: only you can run it; its description leaves Claude's context |
| user-invocable | false: hidden from the / menu; only Claude can use it |
| allowed-tools | Tools Claude may use without asking during the turn that invokes the skill |
| disallowed-tools | Tools removed while the skill is active |
| model, effort | Model and effort level for the rest of the current turn |
| context, agent, background | context: fork runs the skill in a subagent of the type in agent, in the background unless background: false |
| hooks | Hooks registered when the skill is invoked |
| paths | Glob patterns: the skill activates only for matching files |
| shell | bash (default) or powershell for injected commands |
| metadata, license, compatibility | Accepted but not acted on by Claude Code |
If you also upload the skill to claude.ai or the Skills API, only six fields are allowed there: name, description, license, compatibility, metadata and allowed-tools. Any other field fails the upload with an error.
How does Claude decide to load a skill?
It matches your request against the skill descriptions. At session start Claude Code puts a listing in context with every skill's name and as many descriptions as fit; the full SKILL.md only loads when Claude or you invoke the skill, so a long skill costs little until it is used.
- The listing gets about 1% of the model's context window. With many skills, descriptions of the ones you use least are dropped first, which can stop them triggering. Put the key use case first in the description.
- Typing /deploy at the start of a message runs the skill. Writing /deploy later in a sentence only gives Claude permission to run it.
- Once invoked, the skill's content stays in the conversation and is not re-read. After compaction, Claude Code re-attaches the first 5,000 tokens of each recent skill, within 25,000 tokens in total. It fills that budget from the most recently invoked skill, so older ones can drop out if you invoked many.
- An allowed-tools grant ends when you send your next message, even though the instructions stay.
- Not triggering? Add the words people actually say to the description, ask Claude What skills are available?, or run /skill-doctor (v2.1.252 or later) to see each skill's context cost and use.
Skills vs CLAUDE.md, subagents and hooks
Put what Claude should always know in CLAUDE.md, reference material or repeatable workflows in a skill, self-contained work whose details you do not need in a subagent, and anything that must happen every time in a hook.
| Feature | When it loads | Context cost |
|---|---|---|
| CLAUDE.md | Every session start, in full | Every request |
| Skill | Description at start, full content when used | Low: descriptions every request |
| Subagent | When spawned, in its own fresh context | Isolated from the main session |
| Hook | On its trigger event; runs outside the model | Zero unless it returns context |
They combine: a subagent can preload skills through its skills field, and a skill can run in a subagent with context: fork. Anthropic's rule of thumb is to keep CLAUDE.md under 200 lines and move reference content into skills, or split it into .claude/rules/ files.
How do you install skills from plugins and marketplaces?
Install a plugin that bundles them. In a session, /plugin install <plugin>@<marketplace> does not install right away: it opens the plugin's details so you can review it and pick a scope. From your shell, claude plugin install installs without a session, at user scope unless you pass --scope. Anthropic's official marketplace is claude-plugins-official; any other marketplace has to be added first.
# In a Claude Code session (example from Anthropic's docs)
/plugin install commit-commands@claude-plugins-official
# A plugin from another marketplace: add the marketplace first
/plugin marketplace add <owner>/<repo>
/plugin install <plugin>@<marketplace>
# From your shell, for scripts (user scope by default)
claude plugin install <plugin>@<marketplace> --scope project- Scopes: user (every project), project (everyone in the repository) or local (you, this repository only).
- The plugin's skills appear as /<plugin>:<skill>. For official-marketplace plugins, the details pane estimates the context cost per turn and when invoked, if you open it by naming the marketplace (as the install command does) or from the Marketplaces tab.
- Auto-update is on by default for claude-plugins-official and the other official Anthropic marketplace names except knowledge-work-plugins and first-party-plugins, plus marketplaces added from claude.ai. It is off for every other marketplace, including community and third-party ones.
- Remove a plugin's skills with /plugin uninstall <plugin>@<marketplace>, or by disabling the plugin in /plugin.
Example skill (ours): draft release notes from git
This skill turns your recent commits into a release-notes draft. Save it as .claude/skills/release-notes/SKILL.md in a git repository, then ask Claude to draft release notes, or type /release-notes.
---
name: release-notes
description: Drafts release notes from recent git commits. Use when the user asks for release notes, a changelog entry or a summary of what shipped.
allowed-tools: Bash(git log *)
---
## Recent commits
!`git log --oneline -30`
## Instructions
Group the commits above under Added, Changed and Fixed, one line each,
written for users rather than developers. Skip merge commits and
version bumps. Print the draft in the chat only: do not create, edit
or commit any file. If the list is empty, say there is nothing to report.The !`git log --oneline -30` line is dynamic context injection: Claude Code runs the command and puts its output in place of the line before Claude reads the skill. Injected commands never prompt; Claude Code checks each against your permission rules. A command matched by a deny or ask rule aborts the invocation, and outside auto mode so does any command that is not allowed, so allowed-tools pre-approves Bash(git log *) for that turn. A failed command also aborts the whole invocation: git log fails outside a repository or in one with no commits, so the skill will not load there. Our instructions only read history and print a draft; they tell Claude not to create, edit or commit files.
What security checks matter for skills?
Treat a skill like code you are about to run. Its text becomes instructions Claude follows, its injected commands run in your shell, and a plugin that ships skills can also ship hooks and MCP servers that run with your user privileges.
- Read SKILL.md and any scripts before installing. Anthropic's plugin security page says a marketplace's name tells you who publishes the catalog, not what each plugin does.
- Check allowed-tools in skills committed to a repository: Claude Code applies a project skill's allowed-tools even in a claude -p run in a folder you have never trusted.
- To stop skills from user, project, plugin and additional-directory sources running injected commands, set "disableSkillShellExecution": true in settings; bundled and managed skills are not affected. Skills synced from claude.ai never run injected commands in the terminal or VS Code (v2.1.228 or later).
- Auto-update can change files you reviewed; turn it off per marketplace in /plugin if you want to re-check each version.
- Limit which skills Claude may call with permission rules: deny Skill to turn them all off, or Skill(deploy *) to block one. Give a skill with side effects disable-model-invocation: true so only you can start it.
Frequently asked questions
- Do I need a plugin to use skills? No. A SKILL.md in ~/.claude/skills/ or .claude/skills/ is enough; plugins are for sharing and installing bundles.
- Do I need to restart after adding a skill? No. Claude Code picks up new and edited skills during the session; run /reload-skills if one is missing.
- Are my old .claude/commands/ files still supported? Yes. They accept the same frontmatter except name and paths. Move one to .claude/skills/<name>/SKILL.md to add supporting files.
- Why does Claude ignore my skill? Usually the description lacks the words you use, or many skills pushed its description out of the listing. Invoke it directly with /name to confirm it loads.
- Can I reuse a skill on claude.ai or the API? Yes, if its frontmatter sticks to the six spec fields; Claude Code-only features such as dynamic context injection do not work there.
Related on claudefox
- Claude Code hooks and subagents: a practical guide
- CLAUDE.md: what to put in it, where it lives, and examples
- Best Claude Code MCP servers and skills (Nov 2026): 25 picks by job
- How to install Claude Code on Mac, Windows and Linux
- Claude Code not working? Fixes for common errors
- Claude Code version history: all 47 releases since Sep 18, 2026
Source: Extend Claude with skills (Claude Code docs), Extend Claude Code: features compared (Claude Code docs), Install and manage plugins (Claude Code docs), Plugin security and trust (Claude Code docs), Claude Code changelog