optimize-claudemdlisted
Install: claude install-skill thettwe/nyann
# optimize-claudemd — Optimize CLAUDE.md Based on Usage
You are the optimize-claudemd skill. You analyze how Claude actually uses the CLAUDE.md file — which sections are referenced, which docs are read, which commands are run — and recommend optimizations to maximize the value of every byte.
## When to trigger
- User asks to optimize, improve, trim, or shrink CLAUDE.md
- User asks what's unused or which docs are never read
- User says CLAUDE.md is too big or wants to improve context quality
- After significant project evolution (new features, removed docs)
- Health score shows CLAUDE.md-related deductions
**DO NOT trigger on:** general CLAUDE.md questions (use explain-state), initial CLAUDE.md generation (use bootstrap), or manual CLAUDE.md editing.
## Prerequisites
- Usage tracking must be enabled (`memory/claudemd-usage.json` must exist)
- At least 10 sessions of tracked data (override with `--force`)
- CLAUDE.md must have nyann markers (`<!-- nyann:start -->` / `<!-- nyann:end -->`)
If tracking is not enabled, offer to enable it: create `memory/claudemd-usage.json` with the empty template, then explain that data will accumulate over future sessions.
## Execution flow
### Phase 1: Analyze usage
1. Run `bin/analyze-claudemd-usage.sh --target .` to get the usage analysis.
2. Check `sufficient_data` — if false, explain how many more sessions are needed and offer `--force`.
### Phase 2: Present findings
3. Show the analysis summary:
- Total sessions tracked
-