How-to · · Claude Code · 4 steps
Claude Code CLAUDE.md: Set project rules in 4 steps
Explaining your build commands to Claude Code every session?
Write them into a CLAUDE.md once and Claude reads it at the start of every session.
You need: Claude Code with a Pro, Max, Ultra, Team, Enterprise or Console account (or a supported cloud provider), started in your project folder. Plan source: Claude Code docs: account requirements
Steps
- Run
/init. Claude looks through your codebase and writes a startingCLAUDE.mdwith the build commands, test steps and conventions it finds. If the file already exists,/initsuggests improvements instead of overwriting it. - Open the file with
/memory(or your editor) and add what Claude can’t work out from the code. Make each rule easy to check, likeRun npm test before committing, and aim for under 200 lines. - Optional: put personal notes for this project in
CLAUDE.at the project root, and add that file tolocal. md .gitignore. - In your next session, run
/context alland check thatCLAUDE.mdis listed under Memory files.
Heads-up
CLAUDE.mdis context, not enforced configuration. To block an action whatever Claude decides, use a PreToolUse hook.- Already have an
AGENTS.md? Claude Code reads it only while there’s noCLAUDE.md,.orclaude/ CLAUDE. md CLAUDE., so putlocal. md @AGENTS.mdat the top of your newCLAUDE.mdto keep it. - If two instructions contradict each other, Claude may pick one arbitrarily, so prune old rules now and then.
Source: Claude Code docs: how Claude remembers your project · Claude Code docs: account requirements