Claude Code Is Not Following CLAUDE.md — How to Fix It
Diagnose why Claude Code ignores your CLAUDE.md: the file never loaded, the rule is vague, two files contradict, or the rule needs a hook instead.
Direct answer
When Claude Code ignores your CLAUDE.md, work through four causes in order. First, run /context and check the Memory files list — if your file is not there, it never loaded, and nothing else matters. Second, check whether the rule is specific enough to verify; 'use 2-space indentation' is followed far more reliably than 'format code properly'. Third, look for a contradicting rule in another CLAUDE.md up the directory tree or in .claude/rules/, because Claude picks one arbitrarily when two conflict. Fourth, accept that CLAUDE.md is context, not enforcement — a rule that must run at a fixed point, such as before every commit, belongs in a hook.
Open CLAUDE.md ReviewerWhen to use this
- Claude keeps making a mistake your CLAUDE.md explicitly forbids.
- A rule worked last month and stopped working as the file grew.
- You work in a monorepo and other teams' CLAUDE.md files load alongside yours.
Steps
- Run /context in the session and confirm your file appears under Memory files.
- Paste the CLAUDE.md into the reviewer and read the numbered findings for vague or unverifiable rules.
- Rewrite each vague rule as a concrete, checkable instruction with an exact command or path.
- Search your other CLAUDE.md files and .claude/rules/ for a rule that contradicts the one being ignored.
- If the rule must fire at a fixed moment, move it to a PreToolUse hook, which runs regardless of what Claude decides.
Example review focus
# CLAUDE.md - Always test before you finish. - Be careful with the database. - Don't commit broken code. - Follow our conventions. - Make sure the build passes.
Every rule here is unverifiable, so none reliably changes behavior. Rewrite: run `npm run test -- --run` before reporting done; never run migrations against `prod.db`, only `dev.db`; run `npm run build` and report the exit code before any commit. Then move the commit gate into a PreToolUse hook, because a commit rule in CLAUDE.md is a request, not a block.
Common mistakes
- Do not add the same rule three times hoping repetition helps; contradictions and length both reduce adherence.
- Do not assume the file loaded — nested and path-scoped files load on demand, not at launch.
- Do not rely on CLAUDE.md for anything that must never happen; use a hook or permissions.deny.
- Do not forget /compact — nested CLAUDE.md files and path-scoped rules are not re-injected after compaction.
FAQ
- Why is CLAUDE.md not enforced?
- CLAUDE.md content is delivered as a user message after the system prompt, not as configuration the client enforces. Claude reads it and tries to follow it, but compliance is not guaranteed, especially for vague or conflicting rules.
- How do I check whether my CLAUDE.md loaded?
- Run /context and read the list under Memory files. Use /memory to open and edit any of the listed files. If your file is absent, it is in a location that does not load for your working directory.
- Does a longer CLAUDE.md get followed less?
- Yes. Claude Code documents that files over roughly 200 lines consume more context and may reduce adherence. Important rules compete with filler, so cutting filler makes the remaining rules stronger.
- What should I use instead of CLAUDE.md for hard rules?
- Use a PreToolUse hook to block an action at a fixed lifecycle point, or permissions.deny in settings to block tools, commands, or paths outright. Settings are enforced by the client; CLAUDE.md shapes behavior.
Related CLAUDE.md guides
Review CLAUDE.md for Token Waste
Find vague, repeated, or unused CLAUDE.md instructions that cost tokens every Claude Code turn without improving behavior.
CLAUDE.md Missing Commands Checklist
Check whether a CLAUDE.md includes the build, test, lint, dev server, deploy, and verification commands an agent needs before editing.
CLAUDE.md Repo Boundaries and Rules
Write CLAUDE.md rules that tell agents which files to edit, which files to avoid, and how to handle dirty worktrees safely.
Review CLAUDE.md Before Converting to AGENTS.md
Clean a CLAUDE.md first, then convert it into AGENTS.md, Cursor rules, GitHub Copilot instructions, or Windsurf rules.
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.
CLAUDE.md vs .claude/rules vs Skills — Which File Owns What
Route each instruction to the right file: always-loaded CLAUDE.md, path-scoped .claude/rules/, or on-demand skills. One question decides it.
CLAUDE.md Best Practices Checklist — Audit Your File Against 8 Rules
Run your CLAUDE.md through eight checks: size, specificity, exact commands, anti-patterns, structure, contradictions, enforcement, and staleness.
Desk gear for long writing sessions
A few things that help if you write docs, tickets, and specs on a laptop all day.
Anker 5-in-1 USB-C Hub
One cable turns a laptop into a desk setup. Drives a 4K display, charges at up to 85W, and adds three data ports.
- 4K HDMI output
- 85W max power delivery
- 1x USB-C + 2x USB-A, 5Gbps each
- MacBook Pro, MacBook Air, Dell
Dell 27" S2725QC 4K
The monitor I write and review documents on. 163 PPI keeps small text sharp, and USB-C carries video and power on one cable.
- 3840x2160 IPS, 163 PPI
- 120Hz, 4ms, FreeSync Premium
- 99% sRGB
- USB-C, HDMI, DisplayPort
Apple MacBook Neo 13" (A18 Pro)
The cheapest way into an Apple-silicon machine that runs local models. Fanless, and the Liquid Retina panel holds small text at a full day of reading.
- A18 Pro chip, built for Apple Intelligence
- 8GB unified memory, 256GB SSD
- 13-inch Liquid Retina display
- 1080p FaceTime HD camera
Amazon affiliate links. We earn a commission on qualifying purchases at no extra cost to you.