What it is
CLAUDE.md is a Markdown file in your project root that gives Claude Code persistent memory about the project. Claude Code reads it automatically at the start of every session and adds its contents to your prompt.
Without it, Claude re-explores the codebase each session, which can lead to wrong assumptions.
Two levels
| Level | Location | Scope |
|---|---|---|
| Project-level | Project root, committed to version control | Shared with the team |
| User-level | Your settings folder | Personal, applies to all projects |
Example contents
A simple, short sample file includes:
- A project description (e.g., a Next.js app using Tailwind and Drizzle ORM)
- Commands for the dev server, tests, and linting
- Code style rules (indentation, named exports, where API routes live)
Recommendations
-
Save corrections to memory. If you keep correcting the same behavior, ask Claude to save the rule to
CLAUDE.md(e.g., "prefer server actions over API routes"). -
Reference documents. Use
@with a file path (e.g.,@README.md) so Claude reads that document. -
Start small. Don't write the file up front. Note where Claude keeps needing correction, and keep the file compact. Run
/initto have Claude generate one.
Try it
- Run
/initin a project without aCLAUDE.md. - Delete lines a new team member wouldn't need.
- Add one correction you often make.
- Start a new session and check that Claude follows it.
Recap
Much of the difference between frustrating and productive sessions comes down to context, and CLAUDE.md is how you provide it. Start with your tech stack, preferences, and commands, then build from there.
Navigation: Previous lesson: Code Review. Next lesson: Subagents.
Note: the page content was retrieved from a stored copy (2026-11-22).
Top comments (0)