CLAUDE.md — The Single Most Valuable File in Your Repository
A CLAUDE.md file, placed in the root of a repository, is automatically loaded by Claude Code at the start of every session in that project. Think of it as the system prompt you write once for your entire codebase — it tells Claude who you are, what your tech stack is, what conventions matter, and how to behave in this specific project context. Teams that invest 30 minutes in writing a thoughtful CLAUDE.md get dramatically more consistent, on-target assistance from Claude Code than those relying on per-session prompting. The return on investment compounds with every developer who works in the repo.
What to include
- Architecture overview: A concise description of the system — what each major directory contains, what the primary entry points are, and how the components relate. Claude doesn't read your entire codebase on every turn; this overview is what bridges that gap.
- Tech stack and versions: Framework, language, test runner, ORM, CI system. Prevents Claude from suggesting idioms from incompatible libraries or older API versions.
- Conventions that matter: Naming patterns, where config lives, how errors are structured, what "done" means for a PR. Be specific — "use conventional commits" is more useful than "write good commit messages."
- What to avoid: Explicitly list anti-patterns, deprecated patterns still in the codebase, or patterns that look reasonable but conflict with your team's decisions.
- Commands to know: The test command, lint command, build command, and any project-specific scripts Claude should use rather than inventing from scratch.
CLAUDE.md is loaded on every session, so token cost matters. Aim for under 500 words. If your project is complex, use sub-directories: place a CLAUDE.md in /frontend and another in /backend — Claude loads the nearest one(s) relevant to the files it's working with.