Need AI Training/Help?CloudYeti.io/meet
MarkdownMe
Agent instruction guide

What Should Go in a CLAUDE.md File

Decide what belongs in CLAUDE.md and what belongs in the README, a path-scoped rule, or a skill. One test per line, applied to a real file.

Direct answer

Put in CLAUDE.md only the facts Claude needs in every session: build, test, and lint commands with exact flags, project layout, naming conventions, and concrete do-not-do rules. Apply one test per line: would removing this line cause a mistake Claude would not otherwise make? Anything Claude can read from the code belongs in the code. A multi-step procedure belongs in a skill. Guidance that applies to one file type belongs in a path-scoped rule under .claude/rules/. Claude Code documents a target of under 200 lines per file, because longer files reduce how consistently the instructions are followed.

Open CLAUDE.md Reviewer

When to use this

  • You are writing a CLAUDE.md from scratch and do not know where to start.
  • You ran /init and want to know which generated sections to keep.
  • Your file repeats the README and you cannot tell which lines earn their place.

Steps

  1. Paste your draft CLAUDE.md into the reviewer.
  2. For each line, ask if removing it would cause a mistake. Delete the lines that fail.
  3. Move any procedure with more than three steps into a skill under .claude/skills/.
  4. Move any rule that applies to one file type into .claude/rules/ with a paths frontmatter field.
  5. Keep exact commands, project layout, conventions that differ from tool defaults, and real anti-patterns your team has hit.

Example review focus

CLAUDE.md excerpt
# CLAUDE.md

This is a Next.js 16 app with TypeScript and Tailwind.

## Structure
- src/app holds routes
- src/components holds components
- src/lib holds helpers

## Rules
- Write clean code.
- Test your changes.
- Follow the existing patterns.

## Deploy
We deploy to S3 and CloudFront.
What to fix
Cut the structure section: Claude reads the directory tree already. Cut the three generic rules: none is verifiable. Replace them with the facts Claude cannot infer — `npm run test` uses Vitest not Jest, `npm run audit:ai` must pass before a commit, and the deploy fires from a push to main, so never run deploy.sh locally.

Common mistakes

  • Do not copy the README into CLAUDE.md; Claude can open the README when it needs it.
  • Do not write rules you cannot verify, such as write clean code or be careful.
  • Do not use @path imports to shrink the file; imported files still load into context at launch.
  • Do not put deploy checklists or release procedures here; those are skills that load on demand.

FAQ

How long should a CLAUDE.md be?
Claude Code's memory documentation gives a target of under 200 lines per file. Longer files consume more context and reduce adherence. Most repositories need far less than 200 lines.
Should I document my file structure in CLAUDE.md?
Usually no. Claude can read the directory tree. Document a path only when the name does not explain the contents, such as an API handler directory that is not called handlers.
What is the difference between CLAUDE.md and auto memory?
You write CLAUDE.md; Claude writes auto memory. Auto memory stores learnings Claude picks up from your corrections in ~/.claude/projects/<project>/memory/. CLAUDE.md stores the instructions and rules you decide on.
Where does the project CLAUDE.md go?
Either ./CLAUDE.md or ./.claude/CLAUDE.md at the repository root. Personal preferences that should not be committed go in ./CLAUDE.local.md, which you add to .gitignore.

Related CLAUDE.md guides

Desk gear for long writing sessions

A few things that help if you write docs, tickets, and specs on a laptop all day.

Amazon affiliate links. We earn a commission on qualifying purchases at no extra cost to you.