optimizing-claude-mdlisted
Install: claude install-skill qiaeru/skill-claudemd
# Optimizing CLAUDE.md
CLAUDE.md is loaded in full at the start of every session, so every line costs tokens for the whole conversation and competes with the user's real instructions. A bloated file wastes context and lowers adherence: the important rules get lost in the noise. Optimizing means keeping only what changes Claude's behavior and cannot be derived from the code, and pointing to everything else instead of copying it.
This skill follows Anthropic's own guidance for memory files and CLAUDE.md. See the [official memory docs](https://code.claude.com/docs/en/memory) and [best practices](https://code.claude.com/docs/en/best-practices).
The bundled `/doctor` skill (Claude Code 2.1.206 and later) makes a first-pass trim of a checked-in CLAUDE.md: it cuts content derivable from the codebase, dedupes `CLAUDE.local.md` against it, and migrates procedures to skills and nested files. This skill is the deeper pass: contradictions, stale commands and paths, the choice between the five referencing mechanisms, and hooks. When working interactively, suggest `/doctor` first, then run this skill on what remains.
## When to apply
Apply when the user asks to optimize, trim, audit, shrink, clean up, or improve a CLAUDE.md, or whenever a CLAUDE.md has grown well past 200 lines. The same procedure works on every memory file in the hierarchy:
- Managed policy, organization-wide: a platform-specific path (for example `/Library/Application Support/ClaudeCode/CLAUDE.md` on macOS, `/etc/c