Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Claude Code skills: turn repetitive tasks into reusable routines

18 min read
Improve this page

Logo Claude

You keep retyping the same sequence of steps: validate the project, prepare a PR, review a diff. These procedures do not belong in CLAUDE.md (which describes facts) or in .claude/rules/ (which targets rules by folder). Their right place is skills. A skill is a SKILL.md stored in .claude/skills/<name>/, called with /name, which Claude or you can trigger when the need arises.

What you will learn

  • Create a project skill you call with /name
  • Choose between automatic and manual invocation (disable-model-invocation)
  • Pass arguments to a skill with $ARGUMENTS
  • Know when a procedure becomes a skill (versus staying in CLAUDE.md)
  • Store a skill's scripts in its folder and pre-approve exactly their calls

When should you use this feature?

The most reliable signal is manual repetition. If you catch yourself retyping the same three-point instruction in every session, or pasting a block from your notes, that instruction deserves to be frozen in a versioned file instead of replayed from memory.

The second signal comes from CLAUDE.md. This file describes permanent facts about the project; as soon as one of its sections starts describing a sequence of steps, it is in the wrong place and weighs down every session start for something that is rarely needed.

Two other reasons justify a skill:

  • You want a routine shared by the team, callable with a simple /
  • You want to prevent Claude from triggering an action with side effects (deployment, commit) on its own

Prerequisites

Structure of a skill

A skill is a folder with a SKILL.md inside. Project skills live in .claude/skills/<name>/ and are shared through git.

lab-claude/
├── .claude/
│ └── skills/
│ ├── valider/
│ │ └── SKILL.md
│ └── prep-pr/
│ └── SKILL.md
└── ...

The SKILL.md has two parts: a YAML frontmatter (the header between two --- lines) that tells Claude when the skill is relevant, and a Markdown body that describes the procedure. The Claude Code documentation recommends keeping this file under 500 lines and moving the detail into companion files, which the lesson on advanced skills (in French) develops.

If you already had custom commands, the next note concerns you: the two formats coexist, but they are no longer quite equal.

The most useful frontmatter fields

None of these fields is required: a SKILL.md without frontmatter works, and takes the name of its folder. They answer two different questions. description and paths determine when Claude loads the skill by itself; disable-model-invocation and user-invocable determine who is allowed to trigger it.

The most important field is description, and it is also the one most often badly written. It is read not by a human but by Claude, when it decides whether the skill is relevant. A description that lists the situations of use ("when tests fail in CI", "before opening a PR") works much better than one that summarizes the content of the file.

FieldEffect
nameName of the /name command (otherwise derived from the folder)
descriptionGuides Claude when deciding whether to load the skill automatically
disable-model-invocationtrue to allow only manual /name invocation
user-invocablefalse so that only Claude can load the skill
allowed-toolsTools pre-approved while the skill runs
argument-hintAutocomplete hint for the arguments
pathsGlob that loads the skill automatically when Claude touches a matching file

Skill vs CLAUDE.md vs rule: which one fits?

The three locations differ not by their content but by when they are loaded. CLAUDE.md enters the context in every session, whatever you do. A rule loads when Claude touches a file in the zone it covers. A skill loads only when it is invoked, by hand or by Claude.

Putting a procedure in CLAUDE.md is therefore not just a filing mistake: it is a permanent context cost for something that is only needed now and then.

ContentRight place
Global fact ("we use FastAPI, Ruff, pytest")CLAUDE.md
Targeted rule ("tests use TestClient").claude/rules/tests.md
Procedure to run ("run ruff, pytest, summarize the diff").claude/skills/<name>/SKILL.md

If you are writing "1. then 2. then 3.", it is a skill.

Applying it on lab-claude

Goal: two skills that are useful every day, /valider (full validation) and /prep-pr (PR preparation).

Skill 1: /valider

  1. Create the skill folder

    Terminal window
    cd ~/Projets/lab-claude
    mkdir -p .claude/skills/valider
  2. Write SKILL.md

    ---
    name: valider
    description: Validates lab-claude with ruff and pytest, summarizes the errors by priority
    disable-model-invocation: true
    allowed-tools: Bash(uv run ruff *) Bash(uv run pytest *)
    ---
    Validate the project in two steps and summarize.
    1. Run `uv run ruff check .` and note the errors (type and file)
    2. Run `uv run pytest -q` and note the failing tests
    3. Summarize in 3 points:
    - Overall status (green / red)
    - First blocker to handle
    - Exact command to reproduce the blocker
    Do not modify any file. If everything is green, confirm in one line.
  3. Test it in a session

    Terminal window
    claude

    Then:

    /valider

Why disable-model-invocation: true here: /valider is triggered on demand. You do not want Claude to start the full validation on its own in the middle of an exploration.

Skill 2: /prep-pr

This second skill illustrates two mechanisms the first one did not use: passing an argument (the target branch) and declaring an argument-hint that feeds autocomplete. It stays read-only on the repository: the three allowed git commands inspect the state, and none of them changes it.

The last line of the SKILL.md matters as much as the others. Explicitly forbidding git push prevents Claude from moving on by itself to the irreversible action once the summary is produced.

  1. Create the skill

    Terminal window
    mkdir -p .claude/skills/prep-pr
  2. Write SKILL.md

    ---
    name: prep-pr
    description: Prepares a PR for lab-claude: diff, summary, suggested commit message
    disable-model-invocation: true
    argument-hint: "[target] optional, otherwise main"
    allowed-tools: Bash(git diff *) Bash(git log *) Bash(git status)
    ---
    Prepare a PR against the target branch (default `main`).
    Target: $ARGUMENTS
    1. `git status` to check that nothing is pending
    2. `git diff <target>...HEAD --stat` to list the touched files
    3. `git log <target>..HEAD --oneline` to list the commits
    4. Summarize in 5 points at most:
    - Intent (what, why)
    - Significant files changed
    - What still needs manual testing
    - A PR title (≤ 70 characters)
    - A PR body in 3 bullets
    Do not suggest `git push`. Pushing remains a human action.
  3. Test it

    /prep-pr
    /prep-pr develop

Automatic vs manual invocation

Two independent fields control access to the skill, one per trigger. disable-model-invocation: true takes the skill away from Claude and reserves it for you. user-invocable: false does the opposite: the skill disappears from the / list and is loaded only by Claude, which suits background knowledge you never trigger by hand.

The decision criterion is not the complexity of the skill but its effect. A skill that reads and summarizes can be left freely accessible; a skill that writes, deploys, commits or sends something to the team must stay under human control.

FrontmatterYou invokeClaude invokesWhen to use
defaultyesyesSkill without side effects, Claude may decide
disable-model-invocation: trueyesnoActions with effects (/valider, /prep-pr, /commit)
user-invocable: falsenoyesBackground knowledge never invoked by hand

Simple rule: if the skill changes the state of the project or commits the team, set disable-model-invocation: true.

Passing arguments

$ARGUMENTS receives everything that follows the skill name, as a single string. To split that string into positional arguments, use $1, $2, $3: numbering starts at 1, there is no $0.

---
name: resume-fichier
description: Summarizes a project file in 5 points
---
Summarize $ARGUMENTS in 5 points at most, without modifying it.

Usage: /resume-fichier app/main.py.

Which tools are pre-approved during the skill?

The allowed-tools field avoids permission prompts while the skill runs. It pre-approves the commands it lists and does not forbid the others: a command missing from the list simply asks for permission again. It complements the allow of settings.json for the commands specific to the procedure.

Making a skill self-contained: its scripts in its own folder

A skill that calls scripts stored elsewhere in the repository works as long as it stays in that repository. Copied into another project, it fails on the first missing script. The fix is to store the scripts in the skill's folder, under scripts/, so that copying .claude/skills/valider/ carries the whole procedure.

.claude/skills/valider/
├── SKILL.md
└── scripts/
├── check_style.py
├── run_tests.py
└── check_secrets.py

Three points make the skill conform to the Agent Skills standard, and the lab below checks them with its test bench, an offline program that is not Claude Code:

  • the file is named SKILL.md, in capitals, as in the Claude Code documentation and in the standard, and the lab's bench accepts only that exact name;
  • the name is written in lowercase letters, digits and hyphens (64 characters at most) and equals the folder name, as the standard requires; Claude Code makes it optional and then uses the folder name;
  • the description is filled in and says when to use the skill: the standard requires it, Claude Code recommends it.

Add disable-model-invocation: true: the validation runs commands, so only /valider should trigger it.

The scripts are copied unchanged. The skill's steps run them with a direct call of the file, as CI does, from the project root: .claude/skills/valider/scripts/check_style.py src tests.

A direct call needs two things: the first line #!/usr/bin/env python3 (which says which interpreter to use) and the execute permission on the file (chmod +x). Be careful, cp does not give that permission to a copy whose source lacks it. Running python3 path/script.py does without it, but it changes the text of the command, and therefore the rule that must approve it.

The allowed-tools field takes space-separated entries, one per call: Bash(path/to/script.py arguments). For a validation skill, name each script by its full path, with its arguments:

allowed-tools: Bash(.claude/skills/valider/scripts/check_style.py src tests) Bash(.claude/skills/valider/scripts/run_tests.py) Bash(.claude/skills/valider/scripts/check_secrets.py src)

This list pre-approves exactly three calls. A bare Bash would approve any command, and a star on the folder (scripts/*) would also approve any script added there later. A script missing from the list asks for permission again, unless your allow rules already cover it: this is intended for anything outside the procedure. The least-privilege principle for allowed-tools is detailed in the lesson on advanced skills (in French).

The Claude Code documentation also recommends writing the path with ${CLAUDE_SKILL_DIR}, which designates the folder of the SKILL.md: the skill then works whether it is personal, project-level or inside a plugin. The lab asks instead for the path written from the project root.

Finally, the steps of a validation all run, even after a failure: the report must list every defect, not just the first. Write it in the body of the SKILL.md ("Run the three steps in order, even if one fails").

Common mistakes

The six symptoms below come from four sources: the file location, the description, the permissions and the body of the skill.

The last symptom is the most puzzling, because nothing visibly fails: the skill is loaded, but Claude treats it as informational context. Writing in the imperative ("Run", "Check", "Summarize") is the first fix to try.

SymptomLikely causeFix
/<name> not foundFile not named exactly SKILL.md, folder in the wrong place, or name outside the Agent Skills standard format (a capital letter, for example)Check .claude/skills/<name>/SKILL.md exactly, with a lowercase name equal to the folder name, as the standard requires
Claude never triggers the auto skilldescription too vagueAdd real usage keywords
Claude triggers the skill too oftendescription too broadNarrow it, or switch to disable-model-invocation: true
The skill asks for permission againCommand not listed in allowed-toolsComplete allowed-tools with the exact pattern
A skill script fails with "Permission denied"File copied without the execute permissionchmod +x on the script, and #!/usr/bin/env python3 as the first line
Skill invoked but then ignoredContent treated as a guide, not as a taskPhrase it in the imperative ("Run", "Summarize"), not descriptively

End-of-guide checklist

Go through these six points on your own repository before considering the topic mastered. The second is the only one checked by running something: a skill that loads without error but does not do what its name announces is still a broken skill.

  • I created at least one project skill in .claude/skills/<name>/SKILL.md
  • The skill runs with /<name> and does what it promises
  • I chose disable-model-invocation according to the risk
  • I told skill (procedure) from rule (targeted rule) from CLAUDE.md (global fact)
  • allowed-tools reflects the tools actually used
  • The skill's scripts live in its scripts/ folder, and allowed-tools names each call

Put it into practice

The lab starts from a /valider skill that Claude Code never loaded: the file is named skill.md, the name is in capitals, the steps call scripts outside the skill, one of them misspelled, and allowed-tools covers none of them. You turn it into a self-contained skill: a valid SKILL.md, its three scripts copied into scripts/ and made executable, steps that call them directly, and an exact allowed-tools.

The validation runs an offline bench, which is not Claude Code. It checks part of the format of your skill, then actually runs its steps, including on copies of the project where a defect was injected (a secret in the code, a failing test, an overlong line). It therefore proves that the skill says the right thing to this bench and that its scripts run, not how a given version of Claude Code loads it.

Key takeaways

  • A skill captures a procedure you call on demand
  • disable-model-invocation: true for anything that has an effect or commits the team
  • Skills (procedure) / rules (rule) / CLAUDE.md (global fact): three distinct boxes
  • Skills are shared through git, so available to the whole team
  • allowed-tools pre-approves the listed calls and does not forbid the others: name each script with its arguments
  • A skill's scripts go in its scripts/ folder, so that copying the folder carries the whole procedure
  • Keep SKILL.md under 500 lines and move the detail into companion files

Knowledge check

Check that the essentials of this guide are mastered. The questions cover only what has just been explained here.

Knowledge check

Check what you have learned with this interactive quiz

6 questions
6 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer