Category · Method and documentation
What is CLAUDE.md?
CLAUDE.md is the instruction file Claude Code reads at the start of every session, with the project’s commands, conventions and structure. Claude reads it as context, not as an absolute rule. Keep it short, under 200 lines.
By Laurent Poupet, Claude trainer and artificial intelligence architect · Updated
How it works
- At launch, Claude Code reads the CLAUDE.md files of the working folder and its parents, and those of subfolders when it touches a file there. These files add up instead of replacing each other.
- The documentation recommends fewer than 200 lines per file, because a long file uses up context and is followed less well. The rest goes into path-specific rules or into skills loaded on demand.
- An @path import includes another file, and since version 2.1.277 Claude Code reads an AGENTS.md when there is no CLAUDE.md in the working folder or above, so the same rules can be shared with other assistants.
The trap to avoid
The trap is writing a prohibition there that must always hold. Claude reads it as context, so a firm rule goes through a hook or through the organization’s managed settings.
A concrete example
At the root of the project, a thirty-line CLAUDE.md says: the command that runs the tests, “never add a dependency without approval”, the database in use and where the pages live. At every new session, Claude Code reads it before starting: you no longer repeat those instructions, and everyone working on the project shares the same ones.
What is the difference with an agent skill?
| Criterion | CLAUDE.md | an agent skill |
|---|---|---|
| When it is read | At every session, in full | Only when the task calls for it |
| Content | The project’s rules and landmarks | A method for one kind of task |
| Recommended size | Short, under 200 lines | Longer, loaded on demand |
Related terms
- ClaudeModels and how they work
- Claude CodeDevelopment and code
Where this is taught
Track 2 · Claude Code: the augmented developer
CLAUDE.md and Persistent Memorylesson 3 · 1 hour
Lesson content (step-by-step instructions, exercises with solutions, quizzes) is for students only, with an access code received after the first lesson.