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
lab-claudeup and running, withruffandpytestgreenCLAUDE.mdalready in place (see configure CLAUDE.md (in French))- A basic
.claude/settings.json(see advanced settings.json)
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.
| Field | Effect |
|---|---|
name | Name of the /name command (otherwise derived from the folder) |
description | Guides Claude when deciding whether to load the skill automatically |
disable-model-invocation | true to allow only manual /name invocation |
user-invocable | false so that only Claude can load the skill |
allowed-tools | Tools pre-approved while the skill runs |
argument-hint | Autocomplete hint for the arguments |
paths | Glob 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.
| Content | Right 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
-
Create the skill folder
Terminal window cd ~/Projets/lab-claudemkdir -p .claude/skills/valider -
Write
SKILL.md---name: validerdescription: Validates lab-claude with ruff and pytest, summarizes the errors by prioritydisable-model-invocation: trueallowed-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 tests3. Summarize in 3 points:- Overall status (green / red)- First blocker to handle- Exact command to reproduce the blockerDo not modify any file. If everything is green, confirm in one line. -
Test it in a session
Terminal window claudeThen:
/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.
-
Create the skill
Terminal window mkdir -p .claude/skills/prep-pr -
Write
SKILL.md---name: prep-prdescription: Prepares a PR for lab-claude: diff, summary, suggested commit messagedisable-model-invocation: trueargument-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: $ARGUMENTS1. `git status` to check that nothing is pending2. `git diff <target>...HEAD --stat` to list the touched files3. `git log <target>..HEAD --oneline` to list the commits4. 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 bulletsDo not suggest `git push`. Pushing remains a human action. -
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.
| Frontmatter | You invoke | Claude invokes | When to use |
|---|---|---|---|
| default | yes | yes | Skill without side effects, Claude may decide |
disable-model-invocation: true | yes | no | Actions with effects (/valider, /prep-pr, /commit) |
user-invocable: false | no | yes | Background 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-fichierdescription: 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.pyThree 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
nameis 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
descriptionis 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.
| Symptom | Likely cause | Fix |
|---|---|---|
/<name> not found | File 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 skill | description too vague | Add real usage keywords |
| Claude triggers the skill too often | description too broad | Narrow it, or switch to disable-model-invocation: true |
| The skill asks for permission again | Command not listed in allowed-tools | Complete allowed-tools with the exact pattern |
| A skill script fails with "Permission denied" | File copied without the execute permission | chmod +x on the script, and #!/usr/bin/env python3 as the first line |
| Skill invoked but then ignored | Content treated as a guide, not as a task | Phrase 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-invocationaccording to the risk - I told skill (procedure) from rule (targeted rule) from
CLAUDE.md(global fact) -
allowed-toolsreflects the tools actually used - The skill's scripts live in its
scripts/folder, andallowed-toolsnames 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: truefor 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-toolspre-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.mdunder 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
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
Review
(0/0)Result saved on this device. It will be sent to your account at the next sync. Sync now
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
A new full quiz with random questions
Work again only on the questions you missed