Claude Code Skills: What SKILL.md Is and How to Write One

Published 7 min read

A Claude Code skill is a folder that contains a SKILL.md file: YAML front matter that says what the skill is for, followed by Markdown instructions Claude follows when the skill runs. You create it once in ~/.claude/skills/ or .claude/skills/, and Claude uses it when your request matches, or you run it yourself with /skill-name.

This guide covers the file format, every front matter field, the places skills live, how they load into context and a complete worked example. For ready-made files, see 8 SKILL.md examples you can copy. For the wider picture, see the Claude Code skills guide.

What a skill is for

Use a skill when you keep pasting the same prompt, checklist or procedure into chats. A skill turns that into a named, reusable instruction. Typical uses are a deploy checklist, a pull request template or a set of coding conventions.

A skill is not a subagent. A skill's instructions normally run in your current conversation. A subagent has its own context window and its own tools. You can combine them: a skill can run in a forked subagent with context: fork (covered below).

The minimum skill

Create this file:

~/.claude/skills/hello/SKILL.md

With this content:

---
name: hello
description: Greets the user and explains what Claude Code skills are. Use when the user says hello or asks what skills are.
---

Greet the user in one sentence. Then explain in two sentences that a skill is a
folder with a SKILL.md file that Claude can run automatically or on request.

Start Claude Code and type /hello. That is a complete skill. Everything else in this article adds control.

Where skills live

LocationPathScope
Enterprise.claude/skills/<name>/SKILL.md in the managed settings directoryAll users where your organization deploys it
Personal~/.claude/skills/<name>/SKILL.mdAll your projects
Project.claude/skills/<name>/SKILL.mdOne repository. Commit it to share.
Nested<subdir>/.claude/skills/<name>/SKILL.mdSessions in or below that folder. Loads when Claude touches files there.
Plugin<plugin>/skills/<name>/SKILL.mdWherever the plugin is enabled, as /plugin-name:skill-name

Priority: if two skills share a name, enterprise beats personal, and personal beats project. Plugin skills are namespaced, so they do not clash. A skill and a .claude/commands/ file with the same name resolve to the skill.

Project skills load from the folder where you start Claude Code and every parent up to the repository root.

Folder structure

A skill is a directory. Only SKILL.md is required:

my-skill/
├── SKILL.md        required: overview and navigation
├── reference.md    detailed docs, loaded when needed
├── examples.md     usage examples, loaded when needed
└── scripts/
    └── helper.py   utility script, executed rather than loaded

Link the extra files from SKILL.md so Claude knows when to open each one:

## Additional resources

- For complete API details, see [reference.md](reference.md)
- For usage examples, see [examples.md](examples.md)

To call a bundled script from any working directory, use ${CLAUDE_SKILL_DIR}, which expands to the folder that holds SKILL.md.

Front matter fields

The front matter sits between --- lines and must start on the first line of the file. If the YAML fails to parse, the skill still loads, but with no fields set. Unrecognized fields are ignored silently.

FieldWhat it does
nameThe command name. Defaults to the directory name. Use lowercase letters, numbers and hyphens.
descriptionWhat the skill does and when to use it. Put the key use case first. If omitted, Claude Code uses the first non-empty line of the body.
when_to_useExtra trigger text, such as phrases a user might say. It is appended to description.
argument-hintAutocomplete hint, for example [issue-number].
disable-model-invocationtrue means only you can run it. Default false.
user-invocablefalse hides it from the / menu so only Claude can use it. Default true.
allowed-toolsTools Claude can use without a permission prompt while the skill is active. It does not restrict other tools.
disallowed-toolsTools removed while the skill is active.
modelModel for the turn when you run the skill with /name.
effortlow, medium, high, xhigh or max.
contextfork runs the skill in a forked subagent.
agentWhich subagent type to use with context: fork, for example Explore, Plan or a custom agent.
pathsGlob patterns that activate the skill for matching files.
hooksHooks registered when the skill is invoked.

The combined description and when_to_use text is cut at 1,536 characters in the skill listing, so put the important words first.

Who can invoke a skill

SettingYou can run itClaude can run it
DefaultYesYes
disable-model-invocation: trueYesNo
user-invocable: falseNoYes

Use disable-model-invocation: true for anything with side effects, such as deploys or sending messages. You want to decide when those run.

How skills load into context

  1. Descriptions are always loaded. Claude sees every skill's description, so it knows what exists. (Skills with disable-model-invocation: true are not listed this way.)
  2. The full content loads on invocation. When the skill runs, the whole SKILL.md enters the conversation as one message and stays there. Claude Code does not re-read the file on later turns.
  3. After compaction, the most recent invocation of each skill is re-attached. Each keeps its first 5,000 tokens, within a shared budget of 25,000 tokens.

Two practical rules follow:

  • Write standing instructions, not one-time steps, because the text stays in context for the rest of the session.
  • Keep SKILL.md under 500 lines and move detail into supporting files that load only when needed.

Arguments and substitutions

You can pass arguments after the skill name, for example /fix-issue 123. Use these placeholders in the body:

PlaceholderMeaning
$ARGUMENTSEverything you typed after the name
$0, $1Positional arguments, counting from 0
${CLAUDE_SESSION_ID}Current session ID
${CLAUDE_SKILL_DIR}Folder containing SKILL.md
${CLAUDE_PROJECT_DIR}Project root

If the body has no $ARGUMENTS placeholder, Claude Code appends ARGUMENTS: <value> to the content. Quote multi-word values: /my-skill "hello world" second.

Run a command before Claude reads the skill

The syntax !`command` runs a shell command first and replaces the placeholder with its output. Claude receives the result, not the command.

---
name: summarize-changes
description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed, wants a commit message, or asks to review their diff.
---

## Current changes

!`git diff HEAD`

## Instructions

Summarize the changes above in two or three bullet points, then list any risks
you notice such as missing error handling, hardcoded values, or tests that need
updating. If the diff is empty, say there are no uncommitted changes.

A command that exits with an error aborts the whole invocation. Add || true after commands that may fail. Commands are checked against your permission rules, and allowed-tools can pre-approve them.

Run a skill in a subagent

Add context: fork to run the skill in a separate subagent. The skill body becomes the subagent's task. The subagent does not see your conversation, so the instructions must stand alone.

---
name: deep-research
description: Research a topic thoroughly
context: fork
agent: Explore
---

Research $ARGUMENTS thoroughly:

1. Find relevant files using Glob and Grep
2. Read and analyze the code
3. Summarize findings with specific file references

For writing the agent side, see Claude Code subagent examples.

Worked example: a changelog skill

Create .claude/skills/changelog/SKILL.md in your project:

---
name: changelog
description: Writes a changelog entry from recent commits in Keep a Changelog format. Use when the user asks for release notes or a changelog update.
argument-hint: "[version]"
disable-model-invocation: true
allowed-tools: Bash(git log *)
---

## Recent commits

!`git log --oneline -30`

## Instructions

Write a changelog entry for version $ARGUMENTS using the commits above.

1. Group changes under Added, Changed, Fixed and Removed. Skip empty groups.
2. Write each item as one short sentence in the past tense.
3. Leave out commits that only change tests, formatting or CI.
4. Output only the Markdown entry. Do not edit CHANGELOG.md unless asked.

Test it:

  1. Start Claude Code in the project.
  2. Type /changelog 1.4.0.
  3. Check that the entry has the groups you expect and that the version is correct.

Because of disable-model-invocation: true, Claude never runs this on its own.

Writing a description that triggers

The description is what Claude matches against your request. Make it do two jobs: say what the skill does, and say when to use it.

WeakStrong
Helps with PRsWrites a pull request description from the current branch diff. Use when the user asks for a PR description or summary.
Deploy stuffDeploys the app to production after running tests. Use only when the user asks to deploy.

Add the words a person would actually type to when_to_use. Avoid two skills with overlapping descriptions, because Claude may pick the wrong one.

Change detection and reload

Claude Code watches ~/.claude/skills/, the project .claude/skills/ and .claude/skills/ in --add-dir directories. Edits apply in the current session. If a new skill does not appear, run /reload-skills.

Test and maintain skills

  • Run realistic prompts in fresh sessions with the skill on and off, and compare. Check that Claude invokes it on the right prompts and that the output is right.
  • Run /skill-doctor to see each skill's context cost and usage, and to find unused skills. The docs list it for version 2.1.252 and later.
  • Run /doctor for setup checks, including unused skills.

Skills and old slash commands

Files in .claude/commands/ still work and create the same /name command. Skills are preferred for new work. To convert, move .claude/commands/deploy.md to .claude/skills/deploy/SKILL.md. You still type /deploy.

Seeing skills at work

Agent Office reads ~/.claude/skills and shows each skill as part of your agency, with a live record when Claude calls it in a session. It is a free local tool that reads tool names, task titles, status and token numbers, not message text. Follow the setup guide to install it, then open the Office.

Sources

  • Claude Code docs, Extend Claude with skills: https://code.claude.com/docs/en/skills
  • Claude Code docs, Create custom subagents: https://code.claude.com/docs/en/sub-agents

Frequently asked questions

What is a skill in Claude Code?

A skill is a folder containing a SKILL.md file with YAML front matter and Markdown instructions. Claude uses it automatically when the task matches its description, or you run it by typing /skill-name.

Where do Claude Code skills go?

Personal skills go in ~/.claude/skills/<name>/SKILL.md and work in all your projects. Project skills go in .claude/skills/<name>/SKILL.md inside the repository, and you commit them to share them with your team.

How does Claude choose a skill?

Skill descriptions are always in Claude's context, so Claude can match your request against them. The full SKILL.md content loads only when the skill is invoked. A clear description that starts with the key use case is what makes a skill trigger.

Can a skill run scripts?

Yes. Put scripts in a scripts/ folder inside the skill and reference them from SKILL.md with ${CLAUDE_SKILL_DIR}. You can also run a shell command before Claude sees the skill with the !command syntax.

How long can SKILL.md be?

The docs recommend keeping SKILL.md under 500 lines. Move long reference material into separate files in the skill folder and link to them. The description plus when_to_use text is cut at 1,536 characters in the skill listing.

Can I invoke a skill manually?

Yes. Type /skill-name, with optional arguments, for example /fix-issue 123. Put the name at the start of the message to run it directly. Set disable-model-invocation: true if only you should be able to start it.

My new skill does not show up. What do I do?

Claude Code watches the skills folders, so edits normally apply in the current session. If a new skill does not appear, run /reload-skills. Also check that the file is named exactly SKILL.md and that the front matter starts on the first line.