Six building blocks can carry a rule: you need a method to know which one to pick. You have just set up CLAUDE.md, targeted rules and a settings.json; hooks and skills come in the next module. This page is the map of the whole set: one simple rule per building block, with examples on lab-claude, so you know what goes where before you have practiced everything. The goal: stop hesitating, and above all stop duplicating the same rule in three files.
What you will learn
- Tell a fact, a rule, a procedure, an automation and a permission apart
- Choose between
CLAUDE.md,CLAUDE.local.md,rules,settings.json,hooksandskills - Put a rule at the right level (project, personal, code area)
- Recognize the common bad mixes
When should you use this guide?
- You are adding a new rule to your project and you hesitate
- Your
CLAUDE.mdis starting to overflow with procedures and permissions - You find the same rule in two different places
- A contributor asks "why is this rule here and not there?"
The 6 building blocks in one line
| Building block | Role | Example on lab-claude |
|---|---|---|
CLAUDE.md | Global fact about the project, shared with the team | "We use FastAPI, uv, ruff, pytest" |
CLAUDE.local.md | Personal preference, not shared | "I edit with Helix, formatting is forced to ruff format" |
.claude/rules/*.md | Targeted rule for a code area | "Tests use TestClient" |
.claude/settings.json | Permission on tools and commands | allow: Bash(uv run pytest *) |
hooks in .claude/settings.json | Automation around events | Run ruff after every Edit |
.claude/skills/<name>/SKILL.md | Procedure you invoke with /name | /valider chains ruff + pytest and summarizes |
.mcp.json / MCP servers | External tools outside the repository | fetch for the FastAPI docs, github for issues |
The last row does not file any rule: MCP servers plug in external tools. The six building blocks above it carry the rules and settings of your project.
Remember this distinction in five words: fact, rule, permission, automation, procedure. Each building block has one main role, even though settings.json carries two (permissions and the declaration of hooks).
The decision tree in 4 questions
Four questions are enough to file a new instruction, asked in this order. In the tree, each question has its "yes" exit on the same line, naming the building block; only a "no" sends you down. The fourth question is split in two, because it separates the two building blocks that are most often confused: the hook, which triggers on its own, and the skill, which you invoke.
The same questions, with the detail of each answer:
-
Is it a fact that is always true for this project? →
CLAUDE.md(orCLAUDE.local.mdif it only concerns you) -
Is it a rule that only applies in one area (tests, API, infra)? →
.claude/rules/<area>.mdwithpaths:in the frontmatter -
Is it a command to allow, deny or put behind a confirmation? →
.claude/settings.jsonviaallow/deny/ask -
Is it an action triggered by an event or invoked on demand?
- Automatic (after
Edit, beforeStop...) → hook - On demand (
/valider,/prep-pr...) → skill
- Automatic (after
If a single instruction earns a yes to several questions (a command to allow and a procedure to chain, for example), it mixes two things. Split it.
Block by block
CLAUDE.md, the stable facts of the project
What to put in:
- Stack, role of the project
- Useful commands (
uv run ruff check .,uv run pytest -q) - Major conventions (type annotations, test style)
- Simple guardrails ("do not modify
pyproject.tomlwithout confirmation")
What not to put in:
- Numbered procedures ("step 1, step 2, step 3") → skill
- Rules that only concern a subfolder → rule
- Shell permissions → settings.json
- Personal preferences → CLAUDE.local.md
Size rule: fewer than ~80 active lines. Details in configure CLAUDE.md (in French).
CLAUDE.local.md, your own preferences
What to put in:
- Your preferred summary style
- Reminders tied to your machine or to your current branch
- Conventions being tested before they are promoted to
CLAUDE.md
What not to put in:
- Team rules (→
CLAUDE.md) - Secrets (→ environment variables)
Add it to .gitignore.
.claude/rules/*.md, rules by area
What to put in:
- A rule that only applies to
tests/**/*.pyorapp/routes/**/*.py - A
paths:frontmatter so the rule is loaded only when Claude touches the area
Example on lab-claude (.claude/rules/tests.md):
---paths: - tests/**/*.py---
# Rules specific to tests
- Use `fastapi.testclient.TestClient`- One test = one main assertion- No mock on the project's own functionsDetails in targeted rules.
.claude/settings.json, permissions and environment
What to put in:
allow,deny,askon tools (Bash,Read,Edit,WebFetch)- Injected environment variables (
env) - Attribution (
attribution)
What not to put in:
- Behavior rules ("always summarize in 5 points") →
CLAUDE.md - Procedures → skill
Rule: deny protects, allow speeds things up, ask keeps you in control. Details in advanced settings.json.
Hooks, automating events
A hook is declared under the hooks key of .claude/settings.json. The .claude/hooks/ folder holds the scripts it runs.
What to put in:
- Systematic validation after
Edit|Write(e.g.ruff check) - Blocking destructive commands before
Bash - A command reminder on
Stop
Typical example: run uv run ruff check . after every modification of a Python file.
What not to put in:
- Actions that you must be able to trigger on demand → skill
- Permissions → the
permissionskey ofsettings.json(withaskordeny)
Details in Claude Code hooks (in French).
.claude/skills/<name>/SKILL.md, invocable procedures
What to put in:
- A procedure you often type by hand (validation, PR preparation, review)
- A
SKILL.mdwith steps in the imperative disable-model-invocation: trueif the skill changes the state of the project
What not to put in:
- A general rule (→
CLAUDE.mdorrule) - An action that must trigger on its own on an event (→ hook)
Details in Claude Code skills.
The same intent, filed in the right place
To build the reflex, here are 7 common intents on lab-claude, each in its right place:
| Intent | Right building block |
|---|---|
| "We use FastAPI, pytest, ruff" | CLAUDE.md |
"Tests use TestClient" | .claude/rules/tests.md (paths: tests/**/*.py) |
| "I prefer summaries in 3 points" | CLAUDE.local.md |
"Allow uv run pytest * without a prompt" | .claude/settings.json (allow) |
"Always refuse rm -rf *" | .claude/settings.json (deny) |
"Run ruff after every Edit" | PostToolUse hook on Edit|Write |
"A /valider command that chains ruff + pytest" | skill .claude/skills/valider/SKILL.md |
Keep in mind the trickiest distinction: hook vs skill. A hook triggers on its own on an event. A skill waits for you to type /name.
What not to mix
The common mistakes all follow the same pattern: one building block takes the role of another.
| Mix to avoid | Symptom | Fix |
|---|---|---|
Procedure in CLAUDE.md | The file bloats, Claude skims it | Extract it to a skill (/valider, /prep-pr) |
Area rule in CLAUDE.md | Contradictory rules depending on the folder | Move it to .claude/rules/<area>.md with paths: |
Permissions in natural language in CLAUDE.md | Claude asks again every time | Turn them into allow/deny in settings.json |
| Automation inside a skill | Claude forgets to run it | Turn it into a hook (PostToolUse) |
Personal preference in the shared CLAUDE.md | Other contributors have to live with it | Move it to CLAUDE.local.md (gitignored) |
| Skill triggered automatically on a risky action | Unexpected deployment or commit | Add disable-model-invocation: true |
An example of a good split on lab-claude
Here is what a well-organized project looks like:
lab-claude/├── CLAUDE.md # Stack, commands, global conventions├── CLAUDE.local.md # Personal preferences (gitignored)├── .claude/│ ├── settings.json # Team permissions (allow, deny, ask) and hooks│ ├── settings.local.json # Personal permissions (gitignored)│ ├── rules/│ │ ├── tests.md # Rules for tests/**│ │ └── routes.md # Rules for app/routes/**│ ├── hooks/│ │ └── ruff-apres-edit.sh # Script run by a hook after Edit|Write│ └── skills/│ ├── valider/SKILL.md # /valider: ruff + pytest + summary│ └── prep-pr/SKILL.md # /prep-pr: diff, commits, PR titleEach building block has a single role, even when two of them share a file: settings.json carries the permissions and the declaration of hooks. No rule is duplicated. If you add a rule tomorrow, you know exactly where to put it.
Orientation checklist
- I can tell a fact, a rule, a permission, an automation and a procedure apart
- No numbered procedure is left in my
CLAUDE.md - Rules specific to an area are in
.claude/rules/withpaths: - Permissions are in
settings.json, not in natural language elsewhere - Automations are in
hooks, not in skills - Procedures to invoke are in
skills, not inCLAUDE.md - My personal preferences are in
CLAUDE.local.md(gitignored)
Key takeaways
- One building block = one role. As soon as you have a doubt, split.
CLAUDE.mdfor facts,rulesfor targeted rules,skillsfor procedures,hooksfor automations,settings.jsonfor permissions.CLAUDE.local.mdandsettings.local.jsonabsorb everything that is personal.- A well-organized project makes every new rule trivial to place.
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