• 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.

Always read

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.

Read when relevant

Skill

A folder with a SKILL.md. It loads when the task matches its description, like "review auth code". One policy per skill.

Runs every time

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.

advisory mandatory how sure you can be the rule holds CLAUDE.md Skill Hook

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

Agent reads and followsCode enforces

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.

1---
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
.agents/skills/
└─ 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.
TriggerInstructionsScriptsExample skill is illustrative

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.

## Commands npm run build # build npm test # unit tests npm run gate # build + tests + lint, exits non-zero on failure
## Conventions - API fields use snake_case. - Branches: type/project-what. - No default exports in src/.
## Architecture - web/ is the React front end. - api/ is the service; it owns the database. - gen/ is generated. Never edit by hand.
## Things Claude gets wrong - Update CHANGELOG.md in the same PR. - Dates are UTC in the API, local in the UI. - Do not add new dependencies without asking.

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.mdSkillHook
PurposeProject context, commands, conventions, recurring mistakesInstitutional policy applied consistentlyDeterministic allow, ask or block
Enforcementadvisory read every sessionadvisory triggered by contextmandatory when it matches
OwnerWhole team, via pull requestThe policy ownerPlatform or tech lead
Keep smallUnder a pageOne policyFast 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.

Go deeper