How CLAUDE.md Cuts Token Waste on Frontend Changes by 70 Percent
How CLAUDE.md Cuts Token Waste on Frontend Changes by 70 Percent
If you are burning insane amounts of tokens for tiny frontend changes, you are not alone. Every developer using AI coding agents hits this wall - the agent rewrites files it was never asked to touch, refactors CSS you already approved, or restructures components that were working fine.
The fix is surprisingly simple: a CLAUDE.md file with persistent project-level instructions.
What Goes in CLAUDE.md
The most impactful rule is explicit scope control. A single line like "never modify files you were not asked to" cuts unnecessary rewrites by 70 percent. The agent reads this at the start of every session and respects it throughout.
Other high-value instructions include:
- Naming conventions - so the agent does not rename your existing components
- File structure rules - preventing the agent from moving files around
- Style preferences - stopping it from swapping your CSS approach
- Testing requirements - so it does not skip tests or add unnecessary ones
Why This Works
Without a CLAUDE.md, the agent treats every session as a greenfield project. It has no memory of your preferences, your architecture decisions, or which files are off limits. It optimizes for what it thinks is "better code" rather than what you actually need changed.
With a CLAUDE.md, the agent has persistent context. It knows the boundaries. A one-line frontend fix stays a one-line frontend fix instead of ballooning into a 15-file refactor that burns 200k tokens.
The Real Cost
Token waste is not just about money. It is about context window pollution. Every unnecessary rewrite fills the context with diffs you did not ask for, pushing out the actual conversation about your change. The agent loses track of what you originally wanted.
Start with three rules in your CLAUDE.md. Add more as you hit friction. The file pays for itself in the first session.
Fazm is an open source macOS AI agent. Open source on GitHub.