Course navigation
Claude CodeLesson 15 of 25

Skills in Claude Code

A skill is a saved instruction file that teaches Claude how to do a specific job. Write it once, store it in your project, and call it any time with a simple slash command — no re-typing needed.

The problem skills solve

Imagine you write tests the same way on every project — same structure, same naming conventions, same coverage rules. Without skills, you either paste those instructions into every chat, or dump them all into CLAUDE.md where they sit in context even when you are not writing tests. Skills give you a third option: store the instructions in a dedicated file and load them only when you actually need them.

ApproachDrawback
Paste into every chatSame multi-step instructions repeated each session
Put everything in CLAUDE.mdLoads on every session — spends context budget even when unused
Store as a skillInstructions stay on disk; loaded only when you type /skill-name

How a skill is structured

A skill is a folder inside .claude/skills/. The folder name becomes the slash command. Inside the folder, SKILL.md is the only required file. You can add extra files alongside it for templates, examples, or scripts that the skill references.

.claude/skills/write-tests/ — folder name = /write-tests command
write-tests/
├── SKILL.md ← required: instructions + settings
├── checklist.md ← optional: detailed coverage checklist
├── examples/
│ └── button.test.ts ← optional: sample test Claude can mirror
└── scripts/
└── scaffold.sh ← optional: shell script Claude can run
Keep SKILL.md focused on the essentials. Put detailed reference material in separate files and link to them from the main file. Claude only loads those extra files when it actually needs them.

Worked example: /write-tests

This skill tells Claude exactly how to write unit tests for any file you point it at — consistent structure, consistent naming, no repeated instructions. After building it you can run /write-tests src/utils/date.ts and Claude will follow the same approach every time.

Step 1 — create the skill folder

Project skills go in .claude/skills/ — available only in this project. Personal skills go in ~/.claude/skills/ and work across every project you open.

Terminal
# Project-scoped skill (checked into version control)
$ mkdir -p .claude/skills/write-tests

Step 2 — write SKILL.md

The file has two parts. The YAML block at the top (between ---) sets metadata and controls how Claude invokes the skill. The Markdown below it is the actual instruction Claude follows.

.claude/skills/write-tests/SKILL.mdSKILL.md
---
description: Write unit tests for a given source file.
Invoke when asked to add tests or increase coverage.
disable-model-invocation: true
allowed-tools: Read Bash(npx jest *)
---
# Write Unit Tests
Target file: $ARGUMENTS
Follow these steps:
1. Read the target file to understand its exports
2. Identify the top 5 behaviours worth testing
3. Write a test file next to the source using Vitest
4. Name each test: 'should <verb> when <condition>'
5. Run the tests and fix any failures before finishing
FieldWhat it does
descriptionClaude uses this to decide when to auto-load the skill
disable-model-invocation: trueYou trigger it manually — Claude won't run it on its own
allowed-toolsClaude can Read files and run jest without asking each time
$ARGUMENTSReplaced with whatever you type after /write-tests

Step 3 — use the skill

Type the skill name followed by the file path. Claude reads SKILL.md, substitutes $ARGUMENTS with your path, and works through the steps.

Claude Code prompt
> /write-tests src/utils/currency.ts
Reading src/utils/currency.ts...
Found 4 exported functions to test
Writing src/utils/currency.test.ts...
Running: npx jest currency.test.ts
8 tests passed

Where skills live

You can store skills at three levels depending on how widely you want to share them. When two skills share the same name, the broader scope wins.

ScopePathAvailable to
Personal~/.claude/skills/skill-name/Every project you open
Project.claude/skills/skill-name/Only this project — commit to Git for the team
EnterpriseManaged settings (admin)All users in your organisation

Key frontmatter fields

The YAML block at the top of SKILL.md controls how and when the skill is used. Every field is optional — start with just description and add others as you need them.

FieldWhat it doesWhen to use it
descriptionTells Claude what this skill is for and when it appliesAlways — helps Claude decide whether to suggest the skill
nameOverrides the display name (defaults to the folder name)When your folder name is not human-friendly
disable-model-invocationPrevents Claude from calling the skill on its ownFor actions with side effects you want to trigger yourself
user-invocableSet false to hide the skill from the / menuFor background reference material, not user-facing commands
allowed-toolsTools Claude can use without a per-use approval promptWhen the skill needs to run scripts or read files automatically
argumentsNamed placeholders for positional arguments ($name, $0, $1)When your skill accepts more than one input value
context: forkRuns the skill in an isolated sub-agentFor heavy tasks that should not pollute the main conversation

Who can invoke a skill

By default any skill can be triggered by you or by Claude. Two flags let you lock down that behaviour when you need more control.

ModeSettingYouClaudeGood for
Both (default)No extra field neededYesYesCode review helpers, formatting standards, style guides
You onlydisable-model-invocation: trueYesNo/deploy, /release — anything with real-world effects
Claude onlyuser-invocable: falseNoYesBackground knowledge, coding conventions, domain glossaries

Passing arguments

Anything you type after the skill name is available inside the skill as $ARGUMENTS. If you need to access individual words separately, use $0 for the first, $1 for the second, and so on.

One argument — $ARGUMENTS

summarise-branch/SKILL.mdSKILL.md
---
name: summarise-branch
disable-model-invocation: true
---
Review all commits on branch $ARGUMENTS
and write a one-paragraph plain-English summary
of what changed and why.
Claude Code prompt
> /summarise-branch feature/dark-mode
Review all commits on branch feature/dark-mode...

Multiple arguments — $0, $1

move-component/SKILL.mdSKILL.md
---
name: move-component
---
Move the component at $0 to $1.
Update all import paths in the project.
Run TypeScript check after moving.
Claude Code prompt
> /move-component src/Button.tsx src/ui/Button.tsx
Move src/Button.tsx to src/ui/Button.tsx...

Built-in skills

Claude Code includes a handful of ready-made skills. You do not need to create any files for these — they are available in every session. Call them the same way as your own skills.

CommandWhat it does
/simplifyMakes code shorter and clearer without changing its behaviour
/debugWalks through a bug methodically — hypothesis, investigation, fix
/batchApplies the same operation to a list of files at once
/loopRepeats a task in a cycle until you tell it to stop
/claude-apiLets Claude call the Anthropic API directly from within a session
Built-in skills are defined as SKILL.md files internally — they work exactly the same way as skills you write yourself.

Before you continue

  • Skills are folders in .claude/skills/ with a required SKILL.md file.
  • Invoke with /skill-name; pass arguments after the command.
  • Use disable-model-invocation: true for skills you want to trigger yourself.
  • Project skills can be committed to Git so the whole team shares them.
  • Next lesson: Debugging & Troubleshooting.

What's Next

Skills are powering your Claude Code workflow. Next: debugging — how to diagnose, fix, and iterate when things go wrong.