CLAUDE.md Optimization Guide

3 rules that cut your CLAUDE.md's token count by 40%. Based on 800+ hours of Claude Code operation.

The Problem

Your CLAUDE.md is included in every single API turn. A 100-line CLAUDE.md costs ~2,000 tokens per turn. At 20 turns/session × 5 sessions/day, that's 200,000 tokens/day just for instructions.

Measured update (2026-08-10). The framing above overstates the bill. CLAUDE.md sits in the cached prefix, so those tokens are charged at the cache-read rate, not the full input rate. On my own three-layer, 608-line setup, deleting every duplicated rule works out to roughly $0.24–$1.19 per month.

The 40% below is real, but it is 40% off your CLAUDE.md's token count — not 40% off your bill. Shrinking CLAUDE.md is still worth doing, for clarity and rule-following: shorter, checkable instructions get followed more often. It is just not where the money goes. If your bill is the problem, session transcripts are — see the free Token Audit or SERVICES.md.

The 3-Rule Framework

Rule 1: If a tool enforces it, don't write it

Before (wasteful):

# Don't use rm -rf
# Don't force push to main
# Don't commit .env files
# Always run tests before committing
# Format code with Prettier

5 lines × ~100 tokens = 500 tokens/turn wasted. Hooks and linters already enforce these.

After (efficient):

# Safety handled by hooks (npx github:yurukusa/cc-safe-setup)
# Style handled by ESLint + Prettier

2 lines. Same protection. 300 fewer tokens/turn.

Rule 2: One example beats ten rules

Before:

# When writing tests, use descriptive names
# Tests should be independent
# Mock external services
# Test edge cases
# Use beforeEach for setup

After:

# Tests: see tests/user.test.ts for patterns

Claude reads the example file when it needs to. Your CLAUDE.md stays small.

Rule 3: Context, not rules

What Claude can't figure out on its own:

# DB: PostgreSQL 15 (docker-compose.yml)
# API: /api/v2/ prefix, JWT auth
# Deploy: GitHub Actions → AWS ECS
# Current sprint: auth refactor (see JIRA-1234)

Project-specific context that saves Claude from asking or guessing.

Results

CLAUDE.mdTokens/turnCache hit rateInstruction tokens
100 lines (typical)~2,00089%Baseline
50 lines (trimmed)~1,20092%-20%
35 lines (optimized)~80095%-40%

Corrected 2026-08-10. The last column used to read "Monthly cost (Max)", which implied a 40% smaller bill. That was wrong. CLAUDE.md rides in the cached prefix, so on my own three-layer, 608-line setup, removing every duplicated rule came to about $0.24–$1.19 per month. The percentages are real as a reduction in instruction tokens — treat the bill impact as small, and shrink CLAUDE.md for clarity and rule-following instead.

Check Your CLAUDE.md Now

CLAUDE.md Analyzer (free) — Paste your CLAUDE.md and see exactly how many tokens it costs per turn. Nothing leaves your browser.

More Token Savings

Effort Level Calculator — Opus 4.7 defaults to xhigh. Switch to save 30-50%.

Token Checkup — 5-question diagnostic, 30 seconds, free.

Token Book (¥2,500) — Full guide: 36 chapters, 32 failure patterns, all templates included. Ch.1 free.