optimize-claude-mdlisted
Install: claude install-skill mthines/agent-skills
# Optimize CLAUDE.md
Reduces the recurring token cost of `CLAUDE.md` (and its nested + linked
siblings) by identifying paragraph-length entries, redundant content, and
hot-path bloat — then trimming or extracting them while preserving the
canonical source.
> **This `SKILL.md` is a thin index.** Detailed rules live in `rules/*.md`
> and load on demand. Worked examples live in `references/*.md`. Reading
> them all up-front would burn tokens you do not need yet.
---
## When to run
Run when **any** of these hold:
- Claude Code prints `Large CLAUDE.md will impact performance (Xk chars > 40.0k)` at session start.
- The user asks "shrink", "optimize", "reduce", or "trim" CLAUDE.md.
- A paragraph in CLAUDE.md exceeds 6 lines and is not a code block.
- An inventory section duplicates content already loaded by the harness
(e.g. skill `description` frontmatter, which is preloaded automatically).
- A nested package `CLAUDE.md` repeats content from the root.
Refuse if the target file is < 10k chars — see [`rules/hard-rules.md`](./rules/hard-rules.md).
---
## Mode Detection
Parse `$ARGUMENTS` and detect the mode. First positional is mode; second is
optional path (default `./CLAUDE.md`).
| Mode | Default | Trigger |
| --------- | ------- | ---------------------------------------------------------------- |
| `audit` | **yes** | Default. Or `audit`, "review", "report", no mode argument. |
| `trim` |