The short version
- A Claude Code skill is a folder with a SKILL.md file; put it in .claude/skills/ and commit it so the whole team gets it.
- The description decides when Claude loads a skill, so write what it does and when to use it, with the key use case first.
- Mark anything with side effects, such as deploys, as manual-only with disable-model-invocation, and pre-approve only the exact commands it needs with allowed-tools.
- Keep SKILL.md under 500 lines and move detail into supporting files, because skill text costs tokens every time it is loaded.
- Test a skill on three real scenarios against a no-skill baseline before sharing it, and check it on each model your team uses.
On this page
- The short version
- What is a Claude Code skill, and when should you write one?
- Where do skills live?
- How do you write a minimal SKILL.md?
- How do you write a description that triggers?
- The frontmatter fields worth knowing
- How do you stop Claude running a risky skill on its own?
- How do allowed-tools and arguments work?
- When should a skill run in a subagent?
- How big can a skill be before it costs too much?
- How do you test a skill before sharing it?
- Where Atlas fits
- Conclusion
- Questions people ask
A Claude Code skill is a folder with a SKILL.md file in it. You write what the skill does and when to use it, add the steps, and Claude Code loads it when a request matches or when someone types /skill-name. This guide shows how to write one that triggers reliably, stays cheap in context, and is safe to share with a team.
Everything below comes from Anthropic's Claude Code skills documentation and its skill authoring best practices.
What is a Claude Code skill, and when should you write one?
A skill packages a procedure you keep explaining: how to cut a release, how to review a diff against your standards, how to fix an issue the way your team does. Unlike an instructions file such as CLAUDE.md, which is read every session, a skill's description is always in context but its full text loads only when the skill is invoked.
Write a skill when you notice you are pasting the same steps into prompts. Keep short, always-true rules in your instructions file. Put procedures, checklists and task recipes in skills.
Where do skills live?
The path decides who gets the skill:
| 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 to share |
| Nested | <subdir>/.claude/skills/<name>/SKILL.md | Sessions started in or below that subdirectory |
| Enterprise | .claude/skills/<name>/SKILL.md in the managed settings directory | All users on machines where your organisation deploys it |
| Plugin | <plugin>/skills/<name>/SKILL.md | Wherever the plugin is enabled, as /plugin-name:skill-name |
If a personal, project and enterprise skill share a name, enterprise wins over personal, and personal wins over project. Plugin skills are namespaced, so they never collide.
How do you write a minimal SKILL.md?
Create the folder and file:
mkdir -p ~/.claude/skills/summarize-changesThen save this as ~/.claude/skills/summarize-changes/SKILL.md:
---
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.Invoke it by asking something that matches the description, or directly with /summarize-changes. Claude Code watches the skill folders and picks up added or edited skills within the current session; if a brand-new skill does not appear, run /reload-skills.
The line starting with ! followed by a backtick command is dynamic context injection. The command runs before the content reaches Claude and its output replaces the placeholder, so Claude sees the real diff rather than being told to go and fetch it. With the default bash shell, a non-zero exit code aborts the whole invocation, so Claude never sees the content. The one carve-out is exit code 1 from search and comparison commands, which is treated as a normal result; exit code 2 or higher still fails. Append || true where failure is fine.
How do you write a description that triggers?
The description is the single most important line. Claude uses it to choose among potentially 100+ skills. Anthropic's guidance:
- Say both what the skill does and when to use it.
- Write in the third person. The description is injected into the system prompt, and inconsistent point of view can cause discovery problems.
- Use specific key terms. "Helps with documents" is a bad description; "Extract text and tables from PDF files... Use when working with PDF files or when the user mentions PDFs, forms, or document extraction" is a good one.
- Put the key use case first. In Claude Code,
descriptionpluswhen_to_useare truncated at 1,536 characters in the skill listing. The platform's upload rules are stricter: a 1,024-character description and a name of at most 64 characters (lowercase letters, numbers and hyphens, noanthropicorclaude).
If you only run skills inside Claude Code, the longer limit applies, but short is still better, because every skill's description sits in context.
The frontmatter fields worth knowing
All fields are optional; only description is recommended, so Claude knows when to use the skill. Claude Code silently ignores fields it does not recognise, so a typo fails quietly. Packaging a skill for claude.ai or the Skills API is stricter and reports an error.
| Field | What it does |
|---|---|
name | The / command name; defaults to the folder name |
when_to_use | Extra trigger phrases, appended to the description and counted toward the 1,536-character cap |
argument-hint | Autocomplete hint such as [issue-number] |
arguments | Named positional arguments for $name substitution |
disable-model-invocation | true stops Claude loading it automatically |
user-invocable | false hides it from the / menu; only Claude can use it |
allowed-tools | Tools Claude can use without asking during the turn that invokes the skill |
disallowed-tools | Tools removed from Claude's pool while the skill is active |
model, effort | Model and effort for the turn; effort options are low, medium, high, xhigh and max, depending on the model |
context, agent | fork runs the skill in a subagent; agent picks which one |
background | Only with context: fork; false waits for the result |
paths | Glob patterns for the files that activate the skill |
How do you stop Claude running a risky skill on its own?
By default both you and Claude can invoke a skill. For anything with side effects, make it manual-only:
---
name: deploy
description: Deploy the application to production
disable-model-invocation: true
---
Deploy $ARGUMENTS to production:
1. Run the test suite
2. Build the application
3. Push to the deployment target
4. Verify the deployment succeededWith disable-model-invocation: true, the description is not in context; the full skill loads only when you type /deploy. The opposite setting, user-invocable: false, hides a skill from the menu but lets Claude use it, which suits background knowledge.
How do allowed-tools and arguments work?
allowed-tools lets Claude use the listed tools without asking during the turn that invokes the skill. It does not restrict anything else; your permission settings still govern the rest, and the grant clears when you send your next message. Scope it tightly:
---
name: commit
description: Stage and commit the current changes
disable-model-invocation: true
allowed-tools: Bash(git add *) Bash(git commit *) Bash(git status *)
---One security note from the docs: a project skill's allowed-tools apply even in -p runs in untrusted folders, so read them before running Claude Code in a repository you did not write. If you do not want shell injection at all, set "disableSkillShellExecution": true in settings; it covers user, project, plugin and additional-directory skills, but not bundled or managed ones.
For arguments, $ARGUMENTS receives everything after the skill name, and $0, $1 and so on give positional access (quote multi-word values). Named arguments work too:
---
name: ticket
arguments: [issue, branch]
---
Fix $issue on branch $branch./ticket 123 fix-login then expands $issue to 123 and $branch to fix-login. If no placeholder receives your input, Claude Code appends ARGUMENTS: <value> instead. A bundled script can run without a permission prompt if you point at it with ${CLAUDE_SKILL_DIR}, the folder that holds SKILL.md, in both the body and allowed-tools.
When should a skill run in a subagent?
Add context: fork and the skill's content becomes the prompt of a forked subagent, chosen with agent (for example Explore, Plan, general-purpose or your own). The subagent does not see your conversation, so the instructions must stand alone. background defaults to true, so the subagent runs in the background; set background: false to wait for the result. Claude Code also waits in some settings, such as -p runs and the Agent SDK.
---
name: pr-summary
description: Summarize changes in a pull request
context: fork
agent: Explore
allowed-tools: Bash(gh *)
---
## Pull request context
- PR diff: !`gh pr diff`
- Changed files: !`gh pr diff --name-only`
## Your task
Summarize this pull request...Use this only for skills with an explicit task; guideline-only content gives the subagent nothing to act on.
How big can a skill be before it costs too much?
Skill text is a recurring token cost. The rules of thumb:
- Keep the
SKILL.mdbody under 500 lines and split the rest into files it links to, such asreference.md,examples.mdorscripts/. Supporting files load only when read, and scripts are run, not loaded. - Keep links one level deep from
SKILL.md. Anthropic warns that Claude may only preview files that are referenced from other referenced files. - Once invoked, a skill's rendered content stays in the conversation. After compaction, Claude Code re-attaches the most recent invocation of each skill, keeping the first 5,000 tokens per skill within a combined 25,000-token budget, starting from the most recently used.
- Only add what Claude does not already know. Anthropic's example: a roughly 50-token snippet beats a roughly 150-token explanation of what a PDF is.
Prefer a script for fragile, repeatable steps. The guidance is to match freedom to risk: loose text for code review, an exact command for a database migration.
How do you test a skill before sharing it?
Anthropic recommends building evaluations before writing extensive documentation:
- Run Claude on representative tasks without the skill and note where it fails.
- Write three scenarios that test those gaps.
- Record the baseline without the skill.
- Write the minimum instructions that fix the gaps.
- Re-run, compare against the baseline, and refine.
The docs say there is currently no built-in way to run these evaluations, so keep them as simple files, for example:
{
"skills": ["pdf-processing"],
"query": "Extract all text from this PDF file and save it to output.txt",
"files": ["test-files/document.pdf"],
"expected_behavior": [
"Reads the PDF with an appropriate library or tool",
"Extracts text from all pages",
"Saves the text to output.txt"
]
}Also test with each model your team uses. Haiku may need more guidance than Opus, while Opus may be over-instructed by text Haiku needs. Then watch real use: does the skill trigger when expected, does Claude read the files you linked, does it ignore any you bundled?
Where Atlas fits
Atlas is a team of AI engineers built on Claude Code. It does not write, show or review SKILL.md files for you today. What it does in a nearby area: lessons from finished work are passed to future engineers, one is held back as a control, and lessons that track worse results or higher cost are retired automatically. Domain plugins also teach the team a product's rules, and those rules are checked against every change before work counts as done.
Help with writing and reviewing skills is coming to Atlas, built in, so it needs no setup. Until then, follow the steps above in your own Claude Code sessions and review skill files in code review like any other code. You can find Atlas at the Atlas home page.
Conclusion
Start with one skill for a procedure you have explained three times. Write a third-person description with the trigger first, mark risky skills manual-only, pre-approve only the exact commands needed, keep the body short, and test against a no-skill baseline. Commit it under .claude/skills/ and review changes to it like code, since its allowed-tools and shell lines run with your permissions.
Questions people ask
Where do I put a Claude Code skill file?
Put it at .claude/skills/<skill-name>/SKILL.md in your repository and commit it to share it with the team, or at ~/.claude/skills/<skill-name>/SKILL.md for all your own projects. Plugins can also ship skills.
How do I stop Claude from running a skill automatically?
Set disable-model-invocation: true in the frontmatter. The skill then runs only when you type its /name, and its description is not loaded into context.
What does allowed-tools do in a skill?
It lets Claude use the listed tools, such as Bash(git add *), without asking during the turn that invokes the skill. It does not block other tools, your permission settings still apply, and the grant clears on your next message.
How long should a SKILL.md be?
Anthropic advises keeping the body under 500 lines and moving detail into linked supporting files. Descriptions sit in context and an invoked skill stays in the conversation, so length costs tokens.
How do I test whether a skill works?
Write three realistic scenarios, run them without the skill for a baseline, then with it, and compare. Repeat on each model you use and watch real usage. There is no built-in evaluation runner, so keep the scenarios as simple files.
Sources
Researched and drafted with Claude, then checked against the sources above. Atlas is an independent product, not affiliated with Anthropic or OpenAI. Claude and Claude Code are trademarks of Anthropic; Codex is a product of OpenAI.