optimize-claude-md
/optimize-claude-md
Restructure a CLAUDE.md so the tokens it costs on every single turn are the ones that earn it — move reference material into on-demand skills, keep the standing rules. Use this when a CLAUDE.md has grown past a few thousand tokens, when the user asks how to write or shorten a CLAUDE.md, when a fresh session already feels full, when someone wants a CLAUDE.md template, or when context is tight and the memory file has not been examined. Measure it first; do not trim on instinct.
- Author
- emerickchasse ↗
- Repository
- claude-code-plugin-marketplace-culp ↗
- Licence
- MIT
- Last repository change
- 12.08.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 2
No signals detected. Repository changed on 12.08.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Restructure a CLAUDE.md so the tokens it costs on every single turn are the ones that earn it — move reference material into on-demand skills, keep the standing rules. Use this when a CLAUDE.md has grown past a few thousand tokens, when the user asks how to write or shorten a CLAUDE.md, when a fresh session already feels full, when someone wants a CLAUDE.md template, or when context is tight and the memory file has not been examined. Measure it first; do not trim on instinct.
Original author description
Restructure a CLAUDE.md so the tokens it costs on every single turn are the ones that earn it — move reference material into on-demand skills, keep the standing rules. Use this when a CLAUDE.md has grown past a few thousand tokens, when the user asks how to write or shorten a CLAUDE.md, when a fresh session already feels full, when someone wants a CLAUDE.md template, or when context is tight and the memory file has not been examined. Measure it first; do not trim on instinct.
How it works
- Work in this order
- What a good CLAUDE.md holds
- The failure mode to warn about
- Two things worth adding rather than removing
SKILL.md preview
--- name: optimize-claude-md description: Restructure a CLAUDE.md so the tokens it costs on every single turn are the ones that earn it — move reference material into on-demand skills, keep the standing rules. Use this when a CLAUDE.md has grown past a few thousand tokens, when the user asks how to write or shorten a CLAUDE.md, when a fresh session already feels full, when someone wants a CLAUDE.md template, or when context is tight and the memory file has not been examined. Measure it first; do not trim on instinct. license: MIT metadata: author: Emerick Chasse homepage: https://claudeusagelimits.com --- # Optimize CLAUDE.md `CLAUDE.md` is the only file that is loaded before the user types anything, on every turn, in every session — and, less obviously, **into every subagent**, at every level of the hierarchy. That is what makes it worth examining and what makes trimming it on instinct a bad idea: input tokens are the cheap side of the ledger, and a rule that prevents one wrong approach per session has already paid for itself many times over. The goal is not a shorter file. It is a file where **everything in it is needed on most turns**, and everything else is a skill that loads when it is relevant. ## Work in this order **1. Measure.** Do not guess, and do not recommend anything before this: ```bash python3 ../count-tokens/scripts/count_tokens.py ``` Under ~2,000 tokens: leave it alone and say so. Over ~5,000: there is almost certainly reference material in there. In between: judgement, and the split test below is the one to apply. **2. Sort every section by one question.** For each section, ask: *would this change what Claude does on a turn that has nothing to do with it?* | Answer | Where it belongs | | --- | --- | | Yes — it is a standing rule, a convention, a constraint | Stays in `CLAUDE.md` | | No — it is a procedure, a reference table, a walkthrough | Becomes a skill | | No — it is history: why a past decision was made, an incident writeup | A doc, linked from `CLAUDE.md` in one line | The third row is where most of the weight usually is. "We chose Postgres over MySQL in 2024 because…" is worth having written down and is not worth paying for on a turn about CSS. **3. Move, do not delete.** A procedure becomes `.claude/skills/<verb-name>/SKILL.md` with a description saying when it applies. It then costs its description in the skill listing rather than its whole body in context — that is the entire trade, and it is close to free. If a rule only applies to certain files, a skill can say so in frontmatter and load only then: ```yaml paths: ["src/api/**", "*.sql"] ``` **4. Leave one line pointing at what moved.** A `CLAUDE.md` that silently loses a section teaches the next session that the rule does not exist. One line — "Deploy procedure: `/deploy`" — keeps it findable at a cost of a few tokens. ## What a good CLAUDE.md holds The full annotated template, with the section order and what goes in each: [reference/template.md](reference/template.md). In short: what the project *is*, the commands that are not guessable, the conventions that differ from the language's defaults, and the constraints whose violation is expensive. Not: API documentation, changelog, onboarding narrative, a tour of the directory tree, or anything the code already says. ## The failure mode to warn about Every level of the hierarchy loads: `~/.claude/CLAUDE.md`, the project file, `CLAUDE.local.md`, and managed policy files. Someone who has optimised the project file and still sees a full context should check their **personal** one — it loads into every project they open, and it is the file nobody remembers writing. And the compounding case: a large hierarchy makes [`delegate-to-subagents`](../delegate-to-subagents/SKILL.md) *worse*, because each subagent pays the whole thing at startup before doing any work. If someone is spawning subagents to control context while carrying a 10,000-token memory file, this is the fix that has to come first. ## Two things worth adding rather than removing - **Compaction instructions.** A short section telling `/compact` what to keep — "focus on test output and the code changes" — makes auto-compaction lose less of what mattered. - **A one-line statement of what the project is.** It is the cheapest thing in the file and it prevents whole categories of wrong assumption. --- Part of the [Usage Limits Optimizer](https://claudeusagelimits.com/claude-usage-limits-skill/), a free and open plugin. MIT licensed.
Files in this package (2)
- SKILL.md 4 KB
- reference/template.md 4 KB
Versions
The database has no other skills named optimize-claude-md.
Database snapshot: 13.11.2026 · package version 597591477095 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 95count-tokens
Measure how many tokens a file costs Claude, and what share of the context window it occupies. Use this whenever the user asks how big their CLAUDE.md is, whether a file is too long for context, what is eating their context window, how many tokens something costs, or before… - 90slim-claude-md
Shrinks a bloated CLAUDE.md that is loaded into every session by moving its history and status notes, word for word, into topic files under docs/notes/ and leaving a short CLAUDE.md with the always-needed rules plus an index. Verifies line by line that nothing was lost and keeps… - 100context-audit
Use when the user wants to cut Claude Code token cost or asks "why is this session so expensive / what's eating my tokens / trim my CLAUDE.md / reduce context". Audits the always-on context a project re-sends every turn (CLAUDE.md, memory, MCP servers, skills, agents), ranks it… - 100example-skill
This skill should be used when the user asks to "demonstrate skills", "show skill format", "create a skill template", or discusses skill development patterns. Provides a reference template for creating Claude Code plugin skills. - 98claude-context-improver
Audit and improve the Claude Code context layer — CLAUDE.md guidance files, .claude/rules/ path-scoped rules, and companion code_map.md navigation maps — against Claude 5 context-engineering rules (judgement over rules, progressive disclosure, no cross-layer conflicts). Asks… - 90sift
Review and prune Claude Code's auto-memory entries with the user, moving standing rules into CLAUDE.md. Use when the user asks to clean up, prune, review, or audit memory, or when better-memory says instructions wait for review.