CLAUDE.md is a project-context file that Claude Code reads automatically at the start of every session. It tells Claude things it can't infer from code alone — build commands, code style, workflow rules — so Claude works the way your project expects. This article covers the principles and a ready-to-copy template. (Check the official docs for exact behavior.)
🟢 Model references match the current lineup · model notice · Fable subscription
Fable subscription (updated November 17, 2026): Claude Fable 5.2, released November 9, 2026, is the current Fable model; Fable 5.1 and Fable 5 are now legacy. Plan terms are the same for all three — Max and Ultra plans and premium seats on Team and seat-based Enterprise plans include Fable at up to 50% of the weekly usage limit; Pro plans and standard seats use usage credits (not available on Free). API pricing is $8/M input and $40/M output tokens for Fable 5.2, and $10/$50 for Fable 5.1 and 5. Some cybersecurity and biology requests may be answered by an Opus model due to safety classifiers. See the Fable 5.2 launch news and the Fable 5.2 guide for details.
Where it goes
Usually at the project root, named CLAUDE.md, in markdown format. We recommend running /init to generate a starter based on your current project structure, then refining it.
Writing principles
- Keep it short and concise: it loads in full every session, so a long file buries the rules that matter. For each line, ask: "Would removing this cause Claude to make a mistake?" If not, cut it.
- Be specific: instead of "write clean code" (aspirational), write "server components by default; add 'use client' only when truly needed" (testable).
- Explain the why: stating the reason behind a rule helps Claude judge edge cases.
- Use emphasis: marking must-follow items with "IMPORTANT" or "YOU MUST" improves adherence.
CLAUDE.md is advisory — Claude is said to follow it about 80% of the time. For things that must be enforced every time without exception (formatting, linting, security checks), use a hook rather than CLAUDE.md. Also, for domain knowledge or workflows needed only sometimes, prefer skills (loaded on demand) over bloating every conversation via CLAUDE.md.
What to include
- Build/test commands (e.g.,
npm run build, how to run a single test) - Code style (e.g., import style, naming conventions)
- Workflow rules (e.g., typecheck after changes, commit conventions)
- Project structure / architecture decisions that aren't obvious from code
- Gotchas
Conversely, don't include what's already in the README or package.json, anything that changes weekly, or things Claude already does well on its own (that's just noise).
Ready-to-copy starter template
Here's a starting point for a general web project. Trim and adapt it to your project.
# Project overview
[One or two sentences: what the project does, core stack]
# Commands
- Dev server: [e.g., npm run dev]
- Build: [e.g., npm run build]
- Typecheck: [e.g., npm run typecheck]
- Test (single): [e.g., npm test -- path/to/test] # prefer single tests over the whole suite
# Code style
- [e.g., Use ES modules (import/export), not CommonJS (require)]
- [e.g., Server components by default; add 'use client' only when truly needed]
# Workflow
- IMPORTANT: always typecheck after finishing a set of changes
- [e.g., commit messages in English, separate commits per file]
# Gotchas
- [Pitfalls you can't see from the code, with the reason why]
Operating tips
Treat CLAUDE.md like code — version it, review it when things go wrong, and prune it regularly. After adding a rule, check in a fresh session whether Claude's behavior actually changes. If Claude asks questions already answered in CLAUDE.md, the wording is probably ambiguous; if it ignores a rule, the file may be too long and the rule is getting lost.
For the concept overview, see the complete CLAUDE.md guide.
Once you know how to write it, grab paste-ready web/data/docs/monorepo examples in CLAUDE.md examples by project type.
This article is for general guidance only. Claude Code's features and behavior may change by version. Check the official docs (code.claude.com/docs) for the latest recommendations.
Related articles
- CLAUDE.md examples by project type — ready to paste
- What Is CLAUDE.md? — A Simple Explanation for First-Timers
- How to Use Claude: A Step-by-Step Guide for Beginners
- How to Use Claude Projects: Knowledge & Instructions to Cut Repetition
- How to Use Claude Code: Real Usage After Install (Commands, VS Code)
- 6 CLAUDE.md Anti-Patterns — Fix Them With Before/After Examples