# CLAUDE.md

> A file of rules Claude Code reads each time it starts.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** CLAUDE.md file, Project memory, /init

## Think of it like

It is like a note on the fridge that says how this house works.

## Definition

CLAUDE.md is a plain text file of instructions that Claude Code reads at the start of every session. You write it in Markdown. It can hold your build commands, your style rules and things to avoid. There can be one in your home folder for all projects, one in the project for the team, and more in sub-folders. Claude Code loads them all together. Running /init writes a first version for you by looking at your code.

## Example

Emma's team keeps telling Claude to use their test command. She adds it to CLAUDE.md once, and every session after that uses it.

## Example code

```markdown
# Project rules
- Run npm test before you commit.
- Use 2 spaces, not tabs.
```

A short CLAUDE.md with two rules.

## Why it matters

It is the easy way to stop saying the same thing in every session.

## Common mistake

Writing a very long file. The docs suggest under 200 lines, because long files use up context and get followed less well.

## Three principles

- **Read at every start.** Every session.
- **Many levels.** Home, project, sub-folder.
- **Keep it short.** Under 200 lines.

## Related terms

- [Agent Instruction File](https://learn.benibix.com/term/ai/agent-instruction-file)
- [CLAUDE.local.md](https://learn.benibix.com/term/ai/claude-local-md)
- [Claude Code Rules](https://learn.benibix.com/term/ai/claude-code-rules)
- [Auto Memory](https://learn.benibix.com/term/ai/auto-memory)

## Told apart from

- [CLAUDE.md vs Auto Memory](https://learn.benibix.com/compare/claude-md-vs-auto-memory): People often think auto memory and CLAUDE.md are the same file. Both reach Claude at the start of a session, but different people write them. You write CLAUDE.md, and your team can share it in git. Claude writes auto memory for itself, from what it learns while working with you. It lives in your home folder, so it is never shared.
- [Output Style vs CLAUDE.md](https://learn.benibix.com/compare/output-style-vs-claude-md): People think an output style and CLAUDE.md do the same job, since both shape every reply. They do not. CLAUDE.md tells Claude about your project, such as how to run the tests, and it loads whatever style you pick. An output style changes how Claude talks and works, such as shorter replies or notes on each choice. Put facts in CLAUDE.md and the way of working in a style.
- [REVIEW.md vs CLAUDE.md](https://learn.benibix.com/compare/review-md-vs-claude-md): People think REVIEW.md and CLAUDE.md do the same job, since Code Review reads both. They do not. CLAUDE.md tells Claude about the project, and every Claude Code session reads it. REVIEW.md tells Code Review what to flag and what to skip, and only that service reads it. The review command you run in a terminal reads CLAUDE.md but not REVIEW.md. So put review rules in REVIEW.md.

## Taught in

- [CLAUDE.md and Auto Memory](https://learn.benibix.com/learn/ai-claude-code/claude-md-and-auto-memory): Claude Code, 7/16

![CLAUDE.md files from your home folder, the project and a sub-folder, all stacked into one session.](https://learn.benibix.com/diagrams/cc-claude-md.svg)

---

Source: https://learn.benibix.com/term/ai/claude-md
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
