CLAUDE.md Best Practices: The Complete 2026 Guide A developer's guide to CLAUDE.md files recommends keeping them under 200 lines with only universally applicable rules, as bloated files degrade model accuracy from 95% to 60% based on a 2025 Chroma study. The file loads into every Claude Code session as persistent project memory, layered across three scopes (project `./CLAUDE.md`, local `./CLAUDE.local.md`, and user `~/.claude/CLAUDE.md`), with narrower scopes overriding broader ones. The guide advises using file:line references to detailed documentation rather than pasted code blocks, and warns against confusing CLAUDE.md with AGENTS.md or `.claude/agents/*.md` files. A CLAUDE.md file is plain markdown that Claude Code reads at the start of every session, and it's the single biggest lever you have over output quality. Get it right and Claude stops guessing your conventions. Get it wrong and you bloat the context window before you've typed a word. The best practice that matters most: keep it short, specific, and universally true for the project. TL;DR CLAUDE.md is project memory loaded into every Claude Code session. The best CLAUDE.md files areunder ~200 lines, contain onlyuniversally-applicablerules commands, architecture, conventions , point to detailed docs with file references instead of pasting them, and never duplicate what a linter already enforces. Bloated files trigger context rot. Chroma's 2025 study found every one of 18 frontier models degrades as input grows, sometimes from 95% to 60% accuracy Chroma , 2025 . Treat CLAUDE.md like code: commit it, review it, and prune it. I've been editing CLAUDE.md files daily for over a year, across decade-old Laravel codebases the Sivon API among them and the Next.js blog publisher that runs maketocreate.com. This is the deep-dive the rest of my real-world Claude Code workflow that CLAUDE.md plugs into https://maketocreate.com/the-complete-claude-code-workflow-how-i-ship-10x-faster/ keeps pointing back to. If CLAUDE.md is one of seven moving parts there, here it gets the whole article. Key Takeaways - CLAUDE.md loads on everysession, so every line spends context budget, and Anthropic's own guidance is to keep it concise Claude Code docs , 2026 .- Frontier models reliably follow only ~ 150–200 instructions; Claude Code's system prompt already uses ~50 HumanLayer , 2025 .- Use file:line referencesand pointers to agent docs/ , never pasted code blocks. Progressive disclosure keeps the always-loaded file small.CLAUDE.md ≠ AGENTS.md ≠They're three distinct surfaces; mixing them up is the most common configuration mistake I see. .claude/agents/ .md . CLAUDE.md is a markdown file Claude Code automatically loads into context at the start of every conversation, giving the model persistent, project-specific memory it can't infer from code alone Claude Code docs https://code.claude.com/docs/en/best-practices , 2026 . Think of it as the briefing you'd give a senior contractor on day one, except Claude reads it fresh, every single session, forever. The claude md file lives in a small hierarchy, and the layering is the part most people miss. There are three locations Claude Code checks, in increasing scope: ./CLAUDE.md at the repo root. Committed to git, shared with the team. This is the one you'll spend 90% of your time on. ./CLAUDE.local.md gitignored for personal overrides you don't want to commit. ~/.claude/CLAUDE.md , applied across every project on your machine. Good for personal preferences "always explain before refactoring" that aren't repo-specific.Claude Code also walks up the directory tree, so a CLAUDE.md in a subdirectory layers on top of the root one, which is useful in monorepos. The filename is case-sensitive and exact: it's CLAUDE.md , not claude.md or claude .md . If you've just installed the CLI and don't have one yet, see my guide to installing Claude Code if you haven't yet, then run /init inside any repo and it scaffolds a starter file from your project structure. CLAUDE.md is loaded into context on every Claude Code session as persistent project memory, layered across three scopes project ./CLAUDE.md , local ./CLAUDE.local.md , and user ~/.claude/CLAUDE.md , with narrower scopes overriding broader ones, exactly as documented in Anthropic's Claude Code best-practices guide Anthropic https://code.claude.com/docs/en/best-practices , 2026 . Most developers install Claude Code, skip CLAUDE.md entirely, and then wonder why it keeps using the wrong test runner. That's a mistake: 84% of developers now use or plan to use AI coding tools, yet only 33% trust their accuracy versus 46% who actively distrust it Stack Overflow Developer Survey https://survey.stackoverflow.co/2025/ai/ , 2025 . A precise CLAUDE.md is the cheapest way to close that trust gap on your own codebase. Here's the mechanism. Claude Code is the most-loved AI coding tool of 2026, with a 46% "most loved" rating across 15,000 developers surveyed Pragmatic Engineer via UncoverAlpha https://www.uncoveralpha.com/p/anthropics-claude-code-is-having , 2026 , and it crossed a $2.5B revenue run-rate by February 2026 UncoverAlpha https://www.uncoveralpha.com/p/anthropics-claude-code-is-having , 2026 . But the model still doesn't know that your project deploys with make ship , that legacy/ is off-limits, or that you use Pest, not PHPUnit. Without CLAUDE.md it relearns or mis-guesses those facts every session. The day it clicked for me was on the Sivon Laravel API. I'd been re-typing "use the repository pattern, not Eloquent in controllers" into every session for a week. I moved one line into CLAUDE.md and the correction stopped being necessary. That's the underrated part: CLAUDE.md doesn't make Claude smarter, it makes it stop forgetting . Every rule you write once is a correction you never type again. My finding:Across roughly 40 repos I've configured, the single highest-ROI line in any CLAUDE.md is the exact test command. Claude defaults to the ecosystem-common runner npm test , phpunit and gets it wrong constantly. One line, Run tests with: npm run test:unit , eliminates an entire class of wasted turns. Knowing how to write a CLAUDE.md comes down to one rule: include only what's true across every session, and structure it around three questions: what, why, and how HumanLayer https://www.humanlayer.dev/blog/writing-a-good-claude-md , 2025 . Frontier models reliably follow only about 150–200 instructions, and Claude Code's system prompt already consumes roughly 50 of those HumanLayer https://www.humanlayer.dev/blog/writing-a-good-claude-md , 2025 . Your budget is smaller than you think. So what actually goes in the file? Run /init first to scaffold, then rewrite it by hand. A good structure, top to bottom: legacy/ , generated files, vendored code . agent docs/ or deeper specs for anything detailed.That last one is the technique that keeps the file small: progressive disclosure . Store detailed guidance in separate files and reference them with file paths, so Claude pulls them only when relevant HumanLayer https://www.humanlayer.dev/blog/writing-a-good-claude-md , 2025 . A CLAUDE.md should be a map, not the whole territory. The strongest CLAUDE.md files answer three questions what the project is, why its components exist, and how to build, test, and verify it while pushing detailed guidance into referenced agent docs/ files. This progressive-disclosure pattern keeps the always-loaded file under the ~150-instruction ceiling frontier models reliably follow HumanLayer https://www.humanlayer.dev/blog/writing-a-good-claude-md , 2025 . The fastest way to internalize CLAUDE.md best practices is to read good examples. Below are three condensed, real-shaped files from the stacks I work in. Notice what's absent : no code style rules the linter owns those , no pasted code, no task-specific instructions. Laravel API CLAUDE.md : Sivon API Laravel 11 REST API for booking management. PHP 8.3, MySQL 8, Pest for tests. Commands - Test: php artisan test Pest, NOT PHPUnit directly - Lint: ./vendor/bin/pint - Migrate fresh: php artisan migrate:fresh --seed Architecture - Controllers stay thin — business logic lives in app/Services/ - DB access through app/Repositories/ only. Never use Eloquent in controllers. - API resources in app/Http/Resources/ shape every JSON response. Conventions - Form Requests for all validation. No inline $request- validate . - New endpoints: add a route, a Form Request, a Service method, a Pest feature test. Off-limits - app/Legacy/ — frozen, do not modify. See agent docs/legacy-migration.md. Next.js app CLAUDE.md : maketocreate Blog Publisher Next.js 16 App Router + React 19 + TypeScript strict . Tailwind v4. File-based JSON state, no DB. Commands - Dev: npm run dev | Build: npm run build | Lint: npm run lint Architecture - Articles: markdown in articles/