A CLAUDE.md file is a plain Markdown file that Claude Code loads at the start of every session. It holds the facts Claude should always know about your project: how to build and test it, how the code is organised and which rules to follow. This generator turns a short form into a file you can drop into your repository.
How do I use this tool?
- Write a one or two line project overview and list the main stack (language, framework, database).
- Add the exact commands for dev, build, test and lint, for example
npm run devorpytest -q. - Add code style notes, workflow rules and “do not” rules, one per line.
- Optionally list files to import with
@path, such as@README.mdor@docs/api-conventions.md. - Check the live preview and the line counter, then copy the text or download
CLAUDE.mdand save it at your project root.
Where does CLAUDE.md go and in what order does it load?
Claude Code reads instruction files from several places. According to the official memory documentation, they load from broadest to most specific, so a project instruction appears in context after a user instruction.
| Scope | Location | Shared with |
|---|---|---|
| Managed policy | macOS /Library/Application Support/ClaudeCode/CLAUDE.md, Linux and WSL /etc/claude-code/CLAUDE.md, Windows C:\Program Files\ClaudeCode\CLAUDE.md | Everyone in the organisation |
| User | ~/.claude/CLAUDE.md | Only you, all projects |
| Project | ./CLAUDE.md or ./.claude/CLAUDE.md | Your team, through source control |
| Local | ./CLAUDE.local.md (add it to .gitignore) | Only you, this project |
Files are concatenated, not overridden. Claude Code loads CLAUDE.md and CLAUDE.local.md from your working directory and every directory above it, ordered from the filesystem root down, so the file closest to where you launched Claude is read last. Files in subdirectories load on demand, when Claude reads or edits a file in that folder.
How do @imports work?
Write @path/to/file anywhere in the file to pull another file into context at launch. Relative paths resolve from the file that contains the import, not from your working directory. Imported files can import other files, up to a maximum depth of four hops. A path with spaces needs a backslash before each space, and an @path inside backticks or a code block is left as plain text. The first time a project imports a file from outside the working directory, Claude Code asks you to approve it.
Imports keep a long file organised, but they do not save context: imported files load at launch just like the main file.
How long should CLAUDE.md be?
The documentation says to target under 200 lines per CLAUDE.md file, because longer files use more context and reduce how well Claude follows them. The generator shows a warning when your file passes 200 lines. Claude Code skips a file over 4 MiB. If a rule only matters for part of the codebase, move it to a path-scoped rule in .claude/rules/ with a paths field, so it loads only when Claude works on matching files.
Worked example
# Acme Shop Next.js 15 storefront with a Postgres database. ## Commands - Dev: `npm run dev` - Build: `npm run build` - Test: `npm test` - Lint: `npm run lint` ## Code style - TypeScript strict mode, no `any` - Use named exports ## Rules - Run the tests before every commit - Do not edit files in `src/generated/` See @README.md and @docs/api-conventions.md
What are the common mistakes?
- Vague rules. “Write clean code” changes nothing. “Use 2-space indentation” is something Claude can follow and you can check.
- Conflicting rules. If two instructions contradict each other, Claude may pick one arbitrarily. Review nested files and
.claude/rules/together. - Long procedures. A multi-step deploy routine belongs in a skill, not in a file that loads every session. See our guide to Claude Code skills.
- Treating it as enforcement.
CLAUDE.mdis context, not a lock. To block an action every time, use a PreToolUse hook. - Committing personal notes. Put sandbox URLs and personal preferences in
CLAUDE.local.mdand keep it out of git.
Tips for a better file
- Run
/initin Claude Code to generate a first draft from your codebase. If aCLAUDE.mdalready exists,/initsuggests improvements instead of overwriting it. - Use
/memoryto list and open your memory files, and/contextto check which ones actually loaded. - Write commands exactly as you type them, inside backticks, so Claude can run them as written.
- If your repository already has an
AGENTS.md, add@AGENTS.mdtoCLAUDE.mdto share one set of instructions across tools.
New to the tool itself? Start with what Claude Code is, then read our longer CLAUDE.md guide. If you want Claude Code set up across a team or wired into your own workflows, see our AI automation service.
Last updated: October 19, 2026