- What goes in CLAUDE.md, a skill or a hook
- How strongly each one holds
- How to write a skill and keep CLAUDE.md small
Three places your knowledge lives
Your intent, spec and plan files say what to build. Every agent session still starts with no memory of your project, so these three files are how it learns your rules, each with a different strength.
CLAUDE.md
A short file at the repo root. Commands, conventions, architecture, and the mistakes Claude keeps making. Read at the start of every session.
Skill
A folder with a SKILL.md. It loads when the task matches its description, like "review auth code". One policy per skill.
Hook
A script that runs on a matching action, like an edit or a deploy. It can allow, ask or block. The agent cannot talk its way past it.
From advisory to mandatory
Advisory means the agent reads it and usually follows it. Mandatory means code enforces it. Select a marker.
Select a marker
The further right, the less it depends on the agent choosing to follow it.
"A skill makes violations rare, while a hook makes them close to impossible."
Anthropic, The AI-native SDLC playbook
Anatomy of a skill
A skill is a folder. Its SKILL.md has two parts, and the folder can hold scripts. Select each numbered part.
name: auth-security-review
description: Review login, token, session and permission code against our security checklist. Use when a change touches auth.
--- 2# Auth security review
1. List every endpoint the diff touches.
2. Check tokens never reach logs.
3. Run scripts/check.sh and paste the result.
4. Write findings to review/security.md. 3# scripts/check.sh runs the same checks every time
└─ auth-security-review/
├─ SKILL.md
└─ scripts/check.sh (optional)
Select a numbered part
The frontmatter says when. The body says what. Scripts handle the parts that must be exact.
- Use skills for know-how you want applied the same way every time.
- One policy per skill. Its owner signs off on changes.
What goes in CLAUDE.md
Run /init to draft one, then trim it to what a new joiner needs on day one. Keep it under a page.
Keep it small
Every line is read every session. A long file buries the rules that matter.
Example above: well under one page.
Your team owns it
Changes go through a pull request like any code.
Side by side
| CLAUDE.md | Skill | Hook | |
|---|---|---|---|
| Purpose | Project context, commands, conventions, recurring mistakes | Institutional policy applied consistently | Deterministic allow, ask or block |
| Enforcement | advisory read every session | advisory triggered by context | mandatory when it matches |
| Owner | Whole team, via pull request | The policy owner | Platform or tech lead |
| Keep small | Under a page | One policy | Fast and scoped to the file |
Hooks as guardrails
Block edits to generated files. Run the formatter after each edit. Keep credentials out of diffs.
Hooks as approval gates
A hook can pause a production deploy until a named person approves. The agent may act up to the production gate and cannot pass it.
Inside your company
Use the models and tools your company approves. Your agents act with your access, nothing more.
Key takeaways
- CLAUDE.md holds context for every session. Keep it under a page.
- A skill applies one policy the same way each time. Its description is its trigger.
- A hook is the only one that enforces. Use it for rules that must always hold.
- Keep CLAUDE.md small and owned by your team. Add the mistakes Claude keeps making.