CLAUDE.md is the single highest-leverage file in Claude Code setup. Get it right and every session benefits: better answers, less rework, less need to explain team conventions repeatedly. Get it wrong and you have a file that looks helpful but produces sessions worse than a blank CLAUDE.md would. This guide is what we've learned about CLAUDE.md discipline over 8 months of iteration across 6 codebases.
Why CLAUDE.md matters
CLAUDE.md is context that every session in a repo gets automatically. Not context you have to fetch; not context you have to remember to include. Automatic. That makes it the ideal place for information Claude needs every session: conventions, patterns, current architecture, current priorities.
The multiplier effect is significant. If CLAUDE.md prevents one confused Claude session per developer per day, that's 20-40 minutes saved per developer per day. Over a 10-person team, that's 3-7 hours of saved time daily. Compounding over a year: significant.
But CLAUDE.md that's wrong or bloated has the opposite effect. Bad CLAUDE.md includes outdated conventions Claude follows; includes noise that dilutes signal; consumes context budget that could be used for actual work. Bad CLAUDE.md makes every session slightly worse instead of slightly better.
What belongs in CLAUDE.md
Five categories of content earn their place:
1. Non-obvious conventions. If your team uses tabs for indentation, snake_case for filenames, or two spaces for JSX — and these differ from framework defaults or common conventions — document them. Not because Claude can't figure them out from existing code, but because it's faster and more reliable when explicit.
2. Current architectural state. "We use CQRS for the orders domain but transactional patterns everywhere else." "Payments go through Stripe for cards and Payoneer for bank transfers." "We're migrating from REST to tRPC; new endpoints should use tRPC." Claude can read the code but architectural intent isn't always visible in code.
3. Current priorities and constraints. "We're in a performance push; prefer smaller changes." "We're getting SOC2 audited; be extra careful with logging." "Sprint 47 is about the checkout redesign; other features on hold." Time-bound but high-impact for the sessions during that period.
4. Directions for common tasks. "For new features, follow the pattern in services/orders/." "Tests go in __tests__/ folders next to source, not test/ at root." "Database migrations require running pnpm db:migrate." Common tasks; not exhaustive.
5. Explicit "do not" for high-cost mistakes. "Don't touch the legacy/ directory; it's being decommissioned." "Don't add packages to the top-level package.json; use the workspace-specific ones." "Don't modify auto-generated files (marked with @generated)." Prevents specific failure modes.
What doesn't belong
Six categories that seem useful but hurt:
1. Language basics. "This is a TypeScript project using React." Claude can read the tsconfig and package.json. Wasted space.
2. Auto-discoverable structure. "The main app is in src/." Repo structure is readable; don't restate.
3. Standard best practices. "Follow SOLID principles." "Write tests." "Use meaningful variable names." Claude knows. Restating dilutes real signal.
4. Team member details. "Alice is the tech lead. Bob knows about payments." Not useful in code sessions; goes stale as team changes.
5. Historical decisions without current relevance. "We chose React because it was the standard in 2019." History; not helpful for current work.
6. Long prose explanations. Claude Code sessions are focused; long explanations don't fit the interaction pattern. If a topic needs long explanation, link to a doc instead of embedding.
The size discipline (3-8KB target)
Our target CLAUDE.md size: 3-8 KB. Below 3 KB, you're probably missing high-value content. Above 8 KB, you're diluting signal with noise.
Why the ceiling matters. CLAUDE.md is included in every session's context. Larger CLAUDE.md means less context budget for actual work. Also: humans skim CLAUDE.md less carefully when it's long; drift creeps in unnoticed.
Ways to stay under the ceiling:
- Link, don't include. For detailed docs, link to them. Claude follows links in CLAUDE.md; humans do too.
- Prune quarterly. What was current 3 months ago may not be current now. Remove.
- Consolidate repetition. If three sections say similar things, merge.
- Trust the tooling. Repeating what's in
package.jsonortsconfigorREADMEis bloat; Claude reads those directly.
Sections that actually work
Structure that we've evolved and that produces good sessions:
# Project overview
Brief - one paragraph. What this project is, who it's for, what state it's in.
# Architecture
Current architectural state. Key decisions and their reasoning.
Trade-offs made. What's stable, what's in flux.
# Current priorities
Time-bound. What's the team focused on now. What's on hold.
Update every 2-4 weeks.
# Conventions
Non-obvious ones. If it's obvious from the code or standard, skip.
Naming, structure, testing patterns, formatting quirks.
# Common tasks
How to do the things developers do frequently.
Adding a route, adding a migration, running tests, etc.
# Do not
Specific "don't touch this" or "don't do that in this codebase."
High-cost mistakes; not general best practices.
# Links
To detailed docs, decision records, style guides.
For things too big for CLAUDE.md itself.
The order matters. Overview first (fastest context); do-not last (prevents wrong paths that Claude might otherwise start down).
Sections that look useful but aren't
Three sections that teams put in CLAUDE.md that we've learned to leave out:
Tech stack listing. "React 19, TypeScript 5, Prisma, tRPC, Tailwind." Claude reads the package.json faster than parsing the list. Restating: bloat.
File structure map. "src/ contains the app; test/ contains tests; docs/ contains docs." Claude explores the repo; the map doesn't help. It's what humans read when new to the project; Claude doesn't need it.
Getting started instructions. These belong in README; not CLAUDE.md. Claude Code sessions assume the developer already has the environment set up.
How CLAUDE.md changes over time
CLAUDE.md is a living file. Ours changes ~2-3 lines per week during normal work; more during big architectural shifts.
Update triggers:
- Architectural change. Adding a new pattern; sunsetting an old one. Update the Architecture section.
- New team convention. "We've decided to use co-located component tests." Update Conventions.
- Priority shift. Start of new sprint or quarterly planning. Update Current priorities.
- Specific failure mode. Claude session went badly because of missing context. Add to Do not or Conventions.
Update discipline:
- Quarterly review. Explicit review to remove outdated content, consolidate, prune.
- PR discipline. Big architectural PRs include CLAUDE.md updates.
- Session-triggered. When Claude produces something wrong because of missing context, update CLAUDE.md before continuing.
Project-level vs global
Two levels: repo-level CLAUDE.md (at repo root, per-project) and global ~/.claude/CLAUDE.md (developer-level, applies to all projects).
What goes where:
- Repo-level: project-specific conventions, architecture, priorities. Team-shared. Committed.
- Global: developer preferences (formatting preferences, workflow style, personal shortcuts). Not team-shared.
Common mistake: putting developer preferences in repo-level CLAUDE.md. Muddles the team file with individual preferences; other team members inherit preferences that aren't theirs.
Measuring CLAUDE.md quality
Three metrics that indicate CLAUDE.md health:
1. Time to first useful output in new sessions. With good CLAUDE.md, Claude produces good code immediately. With bad or missing CLAUDE.md, sessions start with clarifying questions and wrong first-attempts. Measure this over time; declining time means CLAUDE.md is improving.
2. Rework rate on generated code. Code Claude produces that needs immediate rework indicates missing context. Track this; rising rate means CLAUDE.md is missing something.
3. Onboarding acceleration. New developer sessions with team-shared CLAUDE.md should approach experienced-developer output faster than without. Discussed in the onboarding playbook.
Examples from real teams
Anonymized excerpts from three CLAUDE.md files:
Team 1 (fintech, 15 engineers, 8 KB CLAUDE.md):
# Architecture
CQRS for orders domain (services/orders/); classic transactional pattern everywhere else.
Payments via Stripe (cards) and Payoneer (bank transfers).
Data warehouse in Snowflake; ETL runs nightly at 2 AM UTC.
# Current priorities
Q3 focus: reducing checkout latency. Prefer performance-conscious solutions.
On hold until Q4: new payment methods, mobile app work.
# Do not
- Don't touch services/legacy-billing/. Being decommissioned; changes go to services/billing/.
- Don't modify @generated files (schema.ts, api-types.ts).
- Don't add packages to root package.json; use per-workspace.
Team 2 (SaaS, 8 engineers, 4 KB CLAUDE.md):
# Conventions
Component files: PascalCase (SearchBar.tsx, not search-bar.tsx).
Test files: same location as source, .test.ts suffix.
Absolute imports via ~/ alias; no ../ chains.
Tailwind classes preferred over CSS modules.
# Common tasks
Adding a route: add to routes/, add to router config, add tests.
Adding a migration: pnpm db:new-migration; edit; pnpm db:migrate.
Team 3 (open source, 4 engineers + community, 3 KB CLAUDE.md):
# Project overview
CLI tool for managing GitHub PRs. Written in Rust.
Users: developers who prefer terminals; team leads managing many PRs at once.
# Architecture
Single-binary CLI. Config in ~/.config/prtool/. Uses GitHub GraphQL v4.
# Conventions
Rust 2024 edition. clippy strict; fix or explain every warning.
Follow patterns in src/commands/list.rs for new commands.
# Do not
- Don't add heavy dependencies. Keep binary small.
- Don't change CLI arg names without deprecation warning first.
All three are effective. Different sizes; different content emphasis; each fits its team.
What to do next
- Audit your current CLAUDE.md. Size? Content? Anything outdated?
- Remove content that doesn't earn its place (auto-discoverable, standard practices, historical without current relevance).
- Add content that's missing (non-obvious conventions, current priorities, do-not list).
- Target 3-8 KB total.
- Set quarterly review calendar; don't skip.
- Update CLAUDE.md when sessions reveal missing context.
CLAUDE.md is easy to write and easy to write badly. The discipline is more about what to leave out than what to put in. Good CLAUDE.md is a permanent multiplier on every session; it's worth the recurring effort of keeping it lean and current.
The Documentation Discipline Guide
24 min read