Claude Code Skills, Explained for People Who Already Use CLAUDE.md
25 November 2026 · Updated 28 November 2026 · 13 min read · by Yang Kai
Claude Code Skills explained without the hype: when a rule should leave CLAUDE.md, how SKILL.md works, and a full Astro example you can adapt.
Complete sample SKILL.md for an Astro content-collection task
Contents
- The short version: CLAUDE.md vs a skill
- The one idea that makes skills click
- Anatomy of a skill that actually triggers
- A complete sample: Astro content collections
- Before you start
- Creating an entry
- Validate — do not skip
- Report back
- Where skills live decides where they load
- Invocation: who runs it, and with what arguments
- Supporting files and live context
- What belongs in a skill — and what does not
- Writing skills that survive real work
- Start with one skill, not ten
- Verdict
Claude Code Skills are reusable instruction packs — a SKILL.md the agent loads only when a task matches — and they exist to move occasional, detailed rules out of your always-loaded CLAUDE.md. If a rule applies to one kind of task in ten, it belongs in a skill; this explainer shows the mechanics, the frontmatter that controls them, and a full Astro example.
My CLAUDE.md did not fail all at once. It swelled. First the article checklist, then the image rules, then a long section on how I like product pages structured, then deployment notes I only need twice a month. Each addition felt sensible. Together they meant every quick question — “rename this variable” — was dragging a publishing manual into the conversation.
Skills were the release valve. If CLAUDE.md is the briefing you give at the start of every job, a skill is the procedure manual you hand over only when that specific job comes up.
This article is for the moment most builders hit a few weeks in: CLAUDE.md learned first, then the creeping sense that the setup feels heavy. The mechanics below — loading levels, discovery paths, frontmatter fields — are taken from Anthropic’s Claude Code skills documentation and the Agent Skills specification, checked in November 2026.
The short version: CLAUDE.md vs a skill
| CLAUDE.md | Skill | |
|---|---|---|
| When it loads | Every session, in full | Name and description always; body only when triggered |
| Cost while unused | Its full length, on every request | Roughly 100 tokens of metadata |
| Best for | Facts and rules that must always apply | Procedures for specific, recurring tasks |
| Invoked by | Nobody — it is just there | Claude automatically, or you with /skill-name |
| Lives in | Project root, ~/.claude/, .claude/ |
.claude/skills/<name>/SKILL.md or ~/.claude/skills/<name>/SKILL.md |
The one idea that makes skills click
A skill is a folder with a SKILL.md file inside, and it loads in stages — a design Anthropic calls progressive disclosure:
| Level | What loads | When | Typical cost |
|---|---|---|---|
| 1. Metadata | The name and description from the frontmatter |
At startup, always | ~100 tokens per skill |
| 2. Instructions | The SKILL.md body | When a task matches the description, or you invoke it | Under 5,000 tokens |
| 3. Resources | Bundled files — references, templates, scripts | Only when the instructions point Claude at them | Nothing until accessed; a script’s output enters context, not its code |
That staging is the entire economic argument. Always-needed rules belong in CLAUDE.md, as I set out in The CLAUDE.md That Actually Works. Task-specific procedures belong in skills, where they cost almost nothing until they are useful. Deciding what stays and what moves is the work of The Context Budget Audit.
One nuance the staging hides: once a skill is invoked, its instructions stay in context for the rest of the session. Loading is cheap; a bloated skill body is not free after it fires. Write skill bodies the way you would write CLAUDE.md — tight, imperative, no narration.
Anatomy of a skill that actually triggers
Three parts matter. The name, which should describe the job in plain words. The description, which is the trigger. And the body, which is a procedure: ordered steps, checks, and examples, written for an agent that is competent but does not know your conventions.
The format rules are specific, and worth knowing before you debug a skill that never fires:
- Name: at most 64 characters, lowercase letters, numbers and hyphens only, and it cannot contain the words “anthropic” or “claude”. In Claude Code the
namefield is technically optional — it defaults to the folder name — but the Agent Skills specification treats it as required, and portable skills should always set it. - Description: at most 1,024 characters under the specification, and it must say both what the skill does and when to use it. In Claude Code, the description plus the optional
when_to_usefield is truncated at 1,536 characters in the skill listing, so put the main use case first. - Body: one job per skill. A skill that tries to cover writing, images, SEO, and publishing will be mediocre at all four and hard to trigger cleanly. Split it, the same way I argue for splitting agent work in Subagents vs One Long Session.
Vague descriptions are the number one reason skills “don’t work.” If your description says “helps with content,” the agent cannot reliably match it to “create a new article in the scholarships collection.” Write the description like a routing rule, not a tagline. When a skill still refuses to fire, debugging a Claude Skill that is not triggering walks the failure modes in order.
A complete sample: Astro content collections
This is a real pattern I use for content sites. It teaches the agent to create a collection entry that passes the schema on the first try, instead of inventing fields and failing the build.
---
name: astro-content-entry
description: Create or edit an entry in an Astro content collection.
Use when adding an article, guide, or product page under
src/content/, or when a build fails on frontmatter or schema errors.
---
# Astro Content Entry
## Before you start
1. Read src/content/config.ts and find the target collection schema.
2. Open one recent, published entry in the same collection and copy
its frontmatter shape exactly. Do not invent fields.
3. Check the slug: kebab-case, lowercase, no date prefix.
## Creating an entry
1. Draft frontmatter using ONLY fields defined in the schema.
- Dates: YYYY-MM-DD
- Draft entries: set draft: true until told to publish
2. Write the body in Markdown. Headings start at H2.
3. Internal links use trailing slashes, e.g. /blog/example-slug/
4. Images go in src/assets/ and are imported, never hotlinked.
## Validate — do not skip
1. Run: npm run check
2. Run: npm run build
3. If the schema errors, fix the frontmatter, not the schema,
unless I explicitly ask you to change the schema.
## Report back
- File path created, build result, and any field you had to guess.
Notice the habits baked in: read the schema first, copy a known-good example, validate with the project’s real commands, and report guesses instead of hiding them. Those four moves prevent most content-build failures I used to debug by hand.
Where skills live decides where they load
A skill is discovered from its folder, and the folder’s location sets its reach:
| Location | Path | Loads in |
|---|---|---|
| Personal | ~/.claude/skills/<name>/SKILL.md |
All your projects on this machine |
| Project | .claude/skills/<name>/SKILL.md |
Sessions in this repository — commit it and your team gets it too |
| Nested | <subdir>/.claude/skills/<name>/SKILL.md |
Sessions in or below that directory, useful in monorepos |
| Plugin | <plugin>/skills/<name>/SKILL.md |
Wherever the plugin is enabled, invoked as /plugin-name:skill-name |
| Enterprise | Managed settings directory | Every user your organisation deploys it to |
Project skills also load from parent directories up to the repo root, so starting a session deep in a monorepo still finds the root set. Skills below your starting directory load later, the first time Claude works on files there. The older .claude/commands/ format still works and accepts nearly the same frontmatter, but skills are the format to write new work in — only skills support bundled files.
Skills are also no longer a Claude-only format. Agent Skills is an open standard, supported across Claude.ai, Claude Code, the Agent SDK and the Claude Developer Platform, and the same folder structure travels between tools. The directory of ready-made examples on this site is the skills directory — including workflow skills like audit-context-building — and installing and auditing Claude Skills safely covers vetting skills written by other people.
Invocation: who runs it, and with what arguments
By default both you and Claude can invoke any skill. You type /skill-name; Claude loads it automatically when your request matches its description. Two frontmatter fields change that balance:
disable-model-invocation: true— Claude cannot trigger the skill on its own; only you can, by typing its name. Use it for anything with side effects or timing you want to control: deploys, commits, sending messages. You do not want an agent deciding to deploy because the code looked ready.user-invocable: false— the opposite: the skill disappears from your/menu and only Claude loads it. Right for background knowledge that is not an action, like a skill explaining how a legacy system works.
Arguments pass through cleanly. Whatever follows the skill name is available in the body as $ARGUMENTS, positionally as $0, $1 and so on, or by name if you declare an arguments list in the frontmatter — /fix-issue 123 can turn into “Fix GitHub issue 123 following our coding standards…” without you retyping the procedure. An argument-hint field tells the autocomplete what to suggest.
Two more fields earn their place in real workflows. allowed-tools pre-approves listed tools for the turn that invokes the skill, so a commit skill can run its git commands without prompting you three times; the grant clears when you send your next message, while the skill’s instructions stay loaded. context: fork runs the skill in a subagent with its own context window, so a research-heavy skill returns a summary instead of filling your session — pair it with the agent field to pick which subagent type runs it.
Supporting files and live context
The SKILL.md body is level two of three. Real skills grow a folder around it:
references/— documentation Claude reads only when the instructions send it there: the long API notes, the full style guide, the edge-case catalogue.scripts/— executable code for the deterministic steps. Scripts run through the shell and only their output enters context, which makes them cheaper and more reliable than asking the model to redo the same calculation in prose. Skills with scripts and reference files builds one out in full.assets/— templates, fonts and files used in the output rather than read as instructions.
Claude Code adds one more trick the base specification does not have: dynamic context injection. A line like !`git diff --stat` inside the skill body runs that command when the skill is invoked and inserts the output in its place, so the instructions arrive grounded in the current state of your repo rather than in guesses about it. The bundled /summarize-changes style skills are built on exactly this.
What belongs in a skill — and what does not
Good candidates: any procedure with steps you repeat (publishing a post, adding a product, running a release check), any long checklist, any format with examples, and any task where “good” needs demonstrating rather than describing. If you keep pasting the same prompt into chat, converting repeated prompts into skills is the mechanical version of the same move.
Bad candidates: your package manager, your build command, and your never-touch boundaries. Those must be active even when no skill triggers, so they stay in CLAUDE.md. Safety rules especially should never depend on a skill being loaded — enforce the critical ones mechanically with the approach in 5 Claude Code Hooks That Catch the Mistakes Agents Actually Make.
A quick test: if forgetting the instruction during an unrelated task would cause damage, it is not a skill. If forgetting it merely means one specific task is done less well, it probably is. And when one skill needs to work across several repos, sharing skills across projects and teams covers the distribution options.
Writing skills that survive real work
Write steps as verbs, in order. Include the exact commands, not “run the tests.” Include one good example rather than five mediocre ones. And include the failure path: what to do when the build fails, the file exists already, or a required field is missing. Agents improvise at exactly the points where your instructions go silent.
Version your skills with the repo and prune them like code. When a procedure changes, update the skill that same day — a stale skill is worse than none, because the agent follows it confidently. I keep my production set in the Claude Code Workflow Pack. Browse more on resources and themes.
Start with one skill, not ten
Pick the task you have corrected most often in the last month. That correction history is your spec. Write the skill, use it on the next three real instances of the task, and fix the steps where the agent still guesses. One battle-tested skill teaches you more about writing them than a library of untested ones, and it immediately shrinks your CLAUDE.md.
That discipline also keeps costs sane, which I cover from the money side in Claude Code Cost Control.
Verdict
Skills are how a CLAUDE.md stays short without the knowledge being lost: facts and boundaries stay always-loaded, procedures move into folders that cost roughly 100 tokens while idle and load in full only when a task matches. Open your CLAUDE.md, find the longest task-specific section, and move it into a single SKILL.md using the sample above as your template — keeping only a one-line pointer behind. Use it on a real task this week.
When you are ready to build one, writing your first Claude Skill is the hands-on version, advanced skill patterns covers what to do when one skill becomes ten, and SKILL.md descriptions that trigger goes deep on the single field that decides whether any of it runs.
FAQ
How are Skills different from CLAUDE.md? CLAUDE.md loads on every request and costs context on all of them. A skill’s name and description — roughly 100 tokens — are all that sit in context until a task matches; the full instructions load only then. Same author, same plain Markdown, completely different cost profile.
What makes a skill trigger reliably? Its description, written as the situations and phrases that should call it in — what the skill does plus when to use it — not a summary of what the file contains. Vague descriptions are why most home-made skills sit unused; put the key use case first, because the listing truncates the description text.
Are Claude Skills safe to install from other people?
Treat a third-party skill like any code you run: read the SKILL.md and any bundled scripts before installing, and check the allowed-tools field, which can pre-approve tool use for the invoking turn. A skill can instruct the agent to run commands, so the audit habit is not optional.
Can skills and CLAUDE.md rules conflict? Yes, and the fix is ownership: each rule lives in exactly one place. When a rule graduates to “always true,” move it up to CLAUDE.md and delete it from the skill.
Category: Claude Code & Context Engineering · Tags: #claude-code #skills #claude-md #astro #skill-md
Next step: this article is part of Claude Code guides, which covers the full topic from first setup to advanced use.