What is CLAUDE.md? A plain-English guide

CLAUDE.md is a short note that Claude Code reads every time you start a session, so you stop explaining your project over and over. This guide shows what it is, where it lives, what to put in it, and the part most people skip: keeping it lean and up to date.

Time: 25 minYou need: Claude Code installed and one project folder to try it in

A CLAUDE.md file sending the same briefing into Monday's session, Tuesday's session and a teammate's session
Watch the whole idea in 46 seconds, then follow the steps below.

Understand it

Know what CLAUDE.md is

CLAUDE.md is a plain text file with Markdown headings. Claude Code reads it on its own at the start of every session. You don't paste it in and you don't remind it. Think of it as the onboarding note you would hand a new hire on day one, except Claude reads it every single morning.

  • It is not documentation. It is a short briefing: how to run things, your house rules, and what not to touch.
  • The name must be exactly CLAUDE.md, in capitals.
  • Other AI coding tools read a similar file called AGENTS.md. Step 10 shows how to use both.
Left: without CLAUDE.md you type the same setup into session 1, 2 and 3. Right: with CLAUDE.md written once, every session starts already briefed
Write it once, and every session starts already briefed.
WHAT YOU SHOULD SEEYou can say in one line what CLAUDE.md does: it tells Claude what it can't work out on its own, every time, without you typing it.

Understand it

See why everyone needs one

Count how often this week you told Claude your test command, your package manager, or which folder to leave alone. Every one of those repeats costs you time and tokens. A CLAUDE.md says it once and it holds for every chat after that.

  • No repeating yourself. One file instead of the same paragraph pasted into 40 chats.
  • Fewer tokens, sharper answers. Claude starts briefed instead of guessing.
  • Everyone gets the same rules. A new hire, a contractor and your most senior person all start from the same briefing.
  • Fewer surprises. The mistakes Claude kept making become one line it reads first.
WHAT YOU SHOULD SEETwo or three things you have explained to Claude more than once. Those are your first lines.

Understand it

Learn the three levels

CLAUDE.md is not one file in one place. It can live at three levels, and where you put it decides who it applies to. Picture boxes inside boxes: you, then the project, then one folder inside the project.

  • You: ~/.claude/CLAUDE.md in your home folder. Applies to every project you open. Not in git, so nobody else gets it. Use it for your style: how short you like answers, how you like commits written.
  • The project: CLAUDE.md in the project root, or .claude/CLAUDE.md. Both work. It lives in git, so everyone who clones the repo gets it. Team rules go here.
  • One folder: a CLAUDE.md inside a subfolder such as packages/api/. Loads only when Claude works in that folder.
  • Bonus: CLAUDE.local.md next to a project CLAUDE.md holds your personal notes for that one repo. Add it to .gitignore.
Nested boxes. Outer: you, at ~/.claude/CLAUDE.md, not in git. Middle: the project, CLAUDE.md or .claude/CLAUDE.md, shared through git. Inner: one folder such as packages/api/CLAUDE.md. Also CLAUDE.local.md for personal notes on one repo
The wider the box, the more places the file applies.
Can't see the .claude folder? (Mac)

Folders that start with a dot are hidden by default. Open Finder, go to your home folder or your project folder, and press Command + Shift + . (period) to show them. Press it again to hide them.

GUARDRAILThe classic mix-up: a team rule sitting in someone's personal file. It works for them and nobody else, and the new hire's Claude behaves differently. If a rule matters to the team, move it to the project file.

Understand it

Know how the levels add up

This part surprises people. The files don't replace each other. Claude Code stacks every one it finds into the same context, broadest first, and reads them all together. There is no rule that the closer file wins.

  • All matching files load together: yours, the project's, and the folder's when you work there.
  • If two files contradict each other, Claude may pick either one. Fix the contradiction instead of hoping.
  • CLAUDE.md is advice. Claude follows it most of the time, but nothing forces it. Step 9 covers rules that must hold every time.
  • After /compact, the project file is read again from disk. Folder files come back when Claude next works in that folder. Rules you only typed in chat can get lost, so put the important ones in a file.
GUARDRAILDon't write the same rule two different ways in two files. One rule, one home.

Write it

Generate a starter file with /init

You don't have to start from a blank page. Open Claude Code in your project and run /init. It reads your code and writes a first CLAUDE.md for you. Treat that as a rough draft: it usually says too much.

  • Open a terminal in your project folder and run claude.
  • Type /init and let it finish.
  • Open the new CLAUDE.md and cut anything Claude could have found by reading the code (step 6 shows what).
  • Aim for under 200 lines. Shorter is better.
WHAT YOU SHOULD SEEA CLAUDE.md in your project root with your build and test commands near the top.

Write it

Keep only what Claude can't guess

The rule of thumb: include what Claude can't work out by itself, and cut everything else. A bloated file is worse than a short one, because the rules that matter get lost in the noise and Claude starts ignoring them.

  • Keep: commands, style rules that differ from normal, how you test, branch and commit habits, where key logic lives, what not to touch, your team's jargon, and the quirks that bit you before.
  • Cut: tours of each file, standard language rules, long tutorials, and facts that change every week.
  • Ask: "What does every new person get wrong here?" That is probably your most useful line.
Two columns. Keep: commands, style rules that differ, how you test, branch and commit habits, where logic lives, team jargon, past quirks. Cut: file tours, standard language rules, long tutorials, facts that change weekly, anything readable in the repo, and never passwords, API keys or client data
Lean beats long. More is not better here.
GUARDRAILNever put passwords, API keys or client data in CLAUDE.md. The project file lives in git, so anyone with the repo can read it.

Write it

Write rules you could check

Vague rules get followed some of the time. Specific ones get followed. Write each line as an instruction, not a description, so you could look at Claude's work and say yes or no.

  • Swap "properly", "generally" and "try to" for an exact instruction.
  • If Claude keeps ignoring one rule, add IMPORTANT: to that line only.
  • Use that word once or twice in the whole file. If everything is important, nothing is.
Example rewrites: format code properly becomes use 2-space indents; we generally prefer Pest becomes write tests in Pest; test your changes becomes run the single test file, not the full suite
Example rules. If you couldn't check it, Claude can't follow it.
WHAT YOU SHOULD SEEEvery line in your file could be answered with "did it do this, yes or no?"

Write it

Use a simple layout

A good CLAUDE.md reads top to bottom like a briefing: how to run things, the house rules, where things live, then the one or two hard limits. Here is the shape of one, cut down to the essentials.

  • Commands go first, because Claude needs them most.
  • Then house rules, where things live, and your team's words.
  • End with the one or two hard limits, so they are easy to find.
  • Want the full layout with every section? The free starter kit has a fill-in-the-blanks CLAUDE.md ready to drop in.
Example CLAUDE.md (short version)
# My Shop App

## Commands
- Run one test file: pnpm test path/to/file.test.ts
- Lint before every commit: pnpm lint

## House rules
- 2-space indents, named exports only
- Never commit to main. Open a pull request.

## Hard limits
- IMPORTANT: Never edit anything in src/billing/legacy/
WHAT YOU SHOULD SEEA file you can read in under a minute, with the most important rule easy to spot.

Maintain it

Put each rule in the right place

Not everything belongs in CLAUDE.md. It loads every session, so it should hold only what always applies. Claude Code has other places for rules that matter sometimes, and for rules that must never be broken.

  • CLAUDE.md: advice that applies every session.
  • .claude/rules/: topic files, such as testing.md. Add a paths: line at the top and the file loads only when Claude works on matching files.
  • A skill: a process you need now and then, like a release checklist. It loads only when the job comes up.
  • A hook or settings.json: anything that must happen every time, like "never push to main". These are enforced by Claude Code itself, not left to Claude's judgement.
Four rows. CLAUDE.md loads every session for advice that always applies. .claude/rules loads for matching files only. A skill loads only when the job comes up. A hook or settings.json is enforced every time
From gentle advice at the top to hard rules at the bottom.
GUARDRAILIf breaking a rule would cost you real money or data, don't trust CLAUDE.md alone. Back it with a hook or a permission setting.

Maintain it

Split it up with @ imports

When the file grows, split it into topic files and pull them in. Write @ followed by a path on its own line, and that file is read in as if you had pasted it there. There is no @import keyword, just the @.

  • Good topic files: product.md (customers, business rules, jargon), design.md (colors, components, accessibility), architecture.md (how the parts fit and why).
  • Imports keep things tidy but don't save any space. Everything imported still loads every session.
  • Keep imports one level deep. Imports can chain, but only a few levels, and a long chain is hard to follow.
  • Using other AI tools too? Keep shared rules in AGENTS.md, put @AGENTS.md at the top of CLAUDE.md, then add only the Claude-specific bits below it. Don't copy the text across.
GUARDRAILA wrong path fails silently. There's no error, the rules just vanish. After you add or rename an import, check it loaded (next step).

Maintain it

Check what actually loaded

Don't assume a file is working. Claude Code can show you exactly which instruction files it read, so you can catch a wrong name, a typo in a path, or a rule in the wrong level.

  • Run /memory to see where your CLAUDE.md files are and open any of them in your editor.
  • Run /context and look under Memory files to see what loaded when the session started.
  • Folder-level files and path-scoped rules load later, when Claude touches a matching file. Watch for a "Loaded" line in the terminal.
  • Neither command loads anything. They only show you what is already there.
WHAT YOU SHOULD SEEYour personal and project CLAUDE.md files listed, plus any file you imported.

Maintain it

Keep it fresh

This is the step most people skip. A CLAUDE.md that was right in March and wrong in June is worse than none, because a dead path or old command misleads every session. Treat it like code: small, reviewed, and cleaned up on a schedule.

  • When Claude gets something wrong, check this file first. Then add or fix one line so it doesn't happen again.
  • When you change how things work, such as a new test command or a renamed folder, update CLAUDE.md in the same change.
  • Once a month, read it top to bottom and cut anything stale. The free starter kit has the full ten-minute checklist and a 10-question scorecard.
  • Review changes like code. The project file goes through a pull request, the same as everything else.
WHAT YOU SHOULD SEEA short file where every line is still true, every path still exists, and nothing appears twice.

Get the free CLAUDE.md starter kit

A fill-in-the-blanks CLAUDE.md, the monthly upkeep checklist and a 10-question scorecard. Next, see where skills fit in the skills guide.

  • CLAUDE.md templateEvery section laid out, with a bracket where your details go.
  • Starter kit PDF3 pages: keep vs cut, monthly checklist and a 10-question scorecard.
Get the free starter kit →