Skip to content

Set Up CLAUDE.md: Project Memory That Stops the Repetition

CLAUDE.md gives Claude Code persistent project context. Where it lives, what to put in it, the user vs project files, imports, and how to keep it lean and useful.

MGMCSA Guru Team June 10, 2026 5 min read
A CLAUDE.md file at a project root listing build commands and conventions

If you find yourself telling Claude Code the same things at the start of every session — the build command, where the tests live, the conventions you follow, the directory it should never touch — that’s what CLAUDE.md is for. It’s a markdown file Claude Code reads as context when a session starts, so the project’s standing facts are always present without you typing them.

This is the highest-return, lowest-effort feature in Claude Code. Five minutes on a good CLAUDE.md saves you re-explaining your project in every conversation, and it makes the agent’s output match your project instead of generic defaults. This guide covers where the file goes, what belongs in it, the project-versus-user distinction, and how to keep it from bloating your context.

It’s the first thing to set up in any repo you’ll use regularly — start here before MCP servers or subagents, as the power-user guide recommends.

Where it lives

There are two files, and they stack:

CLAUDE.md locations

./CLAUDE.md Project root — committed, shared with the team
~/.claude/CLAUDE.md User-level — personal, applies to every project

On Windows the user file is C:\Users\YourName\.claude\CLAUDE.md. When both exist, both load — the project file for repo-specific facts, the user file for your personal preferences. Put team conventions in the project file so everyone benefits; keep your own habits in the user file so they follow you without being forced on teammates.

What to put in it

The test for any line: is this a durable fact about the project that you’d otherwise repeat? If yes, it belongs. If it’s a one-off task note, it doesn’t.

A solid project CLAUDE.md covers:

# Project: Acme API

## Commands
- Build: `npm run build`
- Test: `npm test` (run before every commit)
- Lint: `npm run lint`
- Dev server: `npm run dev` (port 3000)

## Stack
- Node + TypeScript, Express, PostgreSQL
- Tests: Vitest, in `__tests__/` next to source

## Conventions
- Conventional Commits for messages
- No raw SQL string interpolation — use the query builder
- All new endpoints require an auth check

## Don't
- Don't edit anything in `generated/` — it's built
- Don't touch the migration files in `db/migrations/` without asking

Short, specific, and all of it the kind of thing you’d otherwise say out loud. The “Don’t” section earns its place fast — it’s how you stop the agent wandering into generated code or rewriting migrations.

Keep it lean

Here’s the discipline. CLAUDE.md loads every session, so its length is a standing context cost — the same kind of cost connected MCP servers carry. A bloated memory file quietly shrinks the window you have for actual work.

So write it tight. Durable facts only. Resist the urge to paste your whole architecture doc into it. If the agent needs deep detail occasionally, that’s what references are for.

Reference other files instead of inlining

When you have detailed material — a long style guide, an architecture overview, API conventions — keep it in its own file and reference it from CLAUDE.md. That way the main file stays short and the detail loads when it’s relevant rather than every session.

## Detailed guides
See @docs/architecture.md for the system overview.
See @docs/api-conventions.md for endpoint standards.

The exact import syntax and how referenced files are pulled in can change, so confirm it in the memory documentation. The principle holds regardless: short core file, detail behind references.

User-level memory for personal preferences

Your ~/.claude/CLAUDE.md is for things that are about you, not any one project — your preferred commit style, that you want concise explanations, tools you always reach for. Because it applies everywhere, keep it to genuine cross-project preferences. Project-specific facts belong in the project file, not here, or they’ll leak into repos where they don’t apply.

Keep it current

A CLAUDE.md that’s out of date is worse than none, because the agent trusts it. When the build command changes, the test framework moves, or a convention is dropped, update the file. Treat it like code: when it’s a project file, review changes to it in pull requests, the same as any other shared configuration.

CLAUDE.md setup checklist

  • Run /init to scaffold, or create CLAUDE.md at the repo root
  • List build, test, lint, and run commands
  • Note the stack, key directories, and conventions
  • Add a 'Don't' section for things to leave alone
  • Keep it to one or two screens — link out to detail
  • Put personal preferences in ~/.claude/CLAUDE.md instead
  • Commit the project file and keep it current

Wrapping up

CLAUDE.md is the cheapest big win in Claude Code. A short, accurate file at your repo root means the agent knows how to build and test, follows your conventions, and stays out of the directories you’ve flagged — all without you re-explaining anything. Keep it tight, reference detail rather than inlining it, use the user file for personal preferences, and update it when the project changes.

Set this up first, then layer on the rest of the power-user features — MCP servers, skills, and subagents — on top of a project the agent already understands.

Frequently asked questions

What is CLAUDE.md?

CLAUDE.md is a markdown file that Claude Code loads as context at the start of a session. It holds the persistent information about your project — build and test commands, conventions, architecture notes, things to avoid — so you don't re-explain them every time.

Where does CLAUDE.md go?

A project CLAUDE.md sits at the repo root and is committed so the team shares it. A personal one lives at ~/.claude/CLAUDE.md (on Windows, C:\Users\YourName\.claude\CLAUDE.md) and applies across all your projects. Both load together when present.

What should I put in CLAUDE.md?

The things you'd otherwise repeat: how to build and test, the conventions you follow, key directories, the tech stack, and explicit don'ts. Keep it to durable facts about the project, not transient task notes.

Will a long CLAUDE.md slow Claude down?

It can. CLAUDE.md loads every session, so its length is a standing context cost. Keep it tight — the essential, durable facts only. Push detailed material into separate files and reference them so they load on demand rather than always.

Can CLAUDE.md include other files?

Yes. You can reference other files from CLAUDE.md so their content is pulled in, which lets you keep the main file short and link out to detailed docs. Check the memory docs for the current import syntax.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.