Help! My CLAUDE.md Is Huge: Strategies to Break It Up
A CLAUDE.md file should make your assistant better at your codebase.
But when it turns into a 2,000-line encyclopedia, you end up paying for that guidance over and over: every turn, every follow-up, every small question.
This post shows how to keep the same guidance while cutting token waste.
If you have asked, "how do I break up a huge CLAUDE.md file without losing guidance?", this is a practical workflow.
We use CLAUDE.md examples because many teams hit this first in Claude-centric workflows, but the same rules-file scaling issue appears across AI coding assistants.
Quick answer (30 seconds)
Keep root CLAUDE.md as a short index of global truths. Move detailed guidance into folder-level CLAUDE.md files close to the code they govern. This keeps capability intact while reducing repeated rule overhead on unrelated tasks. Pair that with .claudeignore to reduce low-value scanning.
How do I break up a huge CLAUDE.md file without losing guidance?
Use a table-of-contents root file plus modular sub-files by domain. Keep global standards at root, move local detail closer to local code, and validate with real tasks in each area. You keep guidance depth, but load less irrelevant context per turn.
The math that should scare you
If your root CLAUDE.md is large, it behaves like a hidden subscription inside every session.
Simple example:
- CLAUDE.md size: 5,000 tokens
- Session length: 50 turns
- Rule overhead alone: 250,000 input tokens
At roughly $3 per 1M input tokens, that is about $0.75 spent just re-sending rules in one session. That is before your real prompts, tool calls, and outputs.
There is also a quality hit.
Long, noisy rule files can bury the few instructions that matter most for the task in front of you.
The table-of-contents pattern
Your root CLAUDE.md should be an index, not a handbook.
A practical target is under 200 lines (around 2,000 tokens or less).
Think of root CLAUDE.md as:
- project overview
- architecture summary
- core coding conventions
- links or pointers to domain-specific instruction files
Then split detailed guidance into sub-files near the code they govern.
Example structure:
/CLAUDE.md <- project-wide index
/src/components/CLAUDE.md <- UI/component patterns
/src/api/CLAUDE.md <- API/backend conventions
/tests/CLAUDE.md <- testing rules and fixtures
/docs/CLAUDE.md <- writing/docs standards
Why this works:
- global rules stay visible
- deep rules load only when relevant
- less token overhead on unrelated tasks
Same total guidance. Better loading behavior.
How to migrate from one giant file
Use this sequence once, then maintain it monthly.
-
Audit the monolith
Tag each section as project-wide or domain-specific. -
Keep only project truths in root
Architecture, tech stack, global style conventions, and decision principles. -
Create sub-CLAUDE.md files by area
Components, API, tests, infra, docs, or other major folder boundaries. -
Replace long inlined detail with pointers
In root, point to deeper rules instead of pasting everything. -
Validate with real tasks
Run typical tasks in each area and confirm local rules are being applied. -
Prune dead guidance
Remove stale instructions that conflict with current code reality.
Mental model: root is the email, sub-files are the links.
Writing token-efficient rules
You can often reduce instruction length by 30 to 60 percent without losing meaning.
Practical techniques:
-
Prefer positive directives
- Better: "Use const/let, strict TypeScript, arrow functions."
- Worse: "Do not use var, do not use ==, do not use function declarations."
-
Reference source docs instead of pasting
- Better: "See /docs/api-conventions.md for response contracts."
- Worse: 400 lines of copied API rules in root.
-
Avoid duplicate rules across files
Keep one source of truth and point to it. -
Use examples sparingly and precisely
One good example beats ten repetitive ones. -
Delete legacy guidance aggressively
If a rule no longer matches current architecture, it is noise.
Use .claudeignore to reduce discovery overhead
.claudeignore is your "do not scan this" control surface.
Exclude files and directories that add little value during coding tasks:
- build artifacts
- generated files
- dependency folders
- logs and coverage outputs
- large lockfiles when not needed
Example starter:
node_modules/
dist/
build/
coverage/
.next/
*.log
*.lock
Less irrelevant scanning means fewer tokens burned before useful work starts.
Key takeaways
- A massive root CLAUDE.md can silently burn large token volume every session.
- Keep root CLAUDE.md as a table of contents, not the whole rulebook.
- Move detailed guidance to sub-CLAUDE.md files in relevant directories.
- Write rules in compact, positive form and reference docs on demand.
- Use .claudeignore to cut indexing and discovery noise.
FAQ
How big should a CLAUDE.md file be?
There is no universal hard limit, but root CLAUDE.md should stay concise and focused on global guidance. A practical target is a short index-style file with references to deeper folder-level rules.
Does a huge CLAUDE.md increase token usage?
Yes. Large root rule files are often re-sent across turns, which creates repeated input overhead during long sessions.
What should stay in root CLAUDE.md?
Keep project-wide truths: architecture summary, core conventions, decision principles, and pointers to domain-specific rule files.
Should I split CLAUDE.md files by folder?
Usually yes. Splitting by feature or domain helps load deep guidance only when relevant and reduces unrelated context during routine tasks.
How do I migrate from one large CLAUDE.md to modular files?
Audit the monolith, separate global vs local guidance, keep global content in root, move local detail into sub-files, then validate behavior with real tasks in each area.
What does .claudeignore do for token usage?
It reduces low-value discovery and scanning overhead by excluding noisy paths like build artifacts, generated files, dependency folders, and logs.
How can I reduce rules-file overhead without hurting coding quality?
Write concise positive directives, remove stale guidance, avoid duplication, and reference deeper docs on demand. The goal is high-signal instructions, not less capability.
Related reading
- Saving Tokens at Conversation Start with LLMs
- Why Document Search Can Burn Tokens Fast
- Skills Are Killing Your Budget (Can They Be Loaded Dynamically?)
CTA
If you want the same coding capability with less instruction overhead, Mana helps keep context lean by loading only what is needed for the current task.