Skill v1.0.0
currentLLM-judged scan90/100version: "1.0.0" name: context-debloat description: Audit and shrink what Claude Code loads at session start in any repository, then keep it lean. Use when CLAUDE.md is too big, when sessions start heavy, when the token budget is exceeded, or when someone asks for a context audit, a debloat, or "solo lo abierto". Do not use it to write a new CLAUDE.md from scratch — use claude-md-architect for that.
Context debloat
Framework: MCA · Helps satisfy: CTX-02..CTX-07 Human confirmation required for: deleting content that has no archive copy
Operating contract
This is an internal, fix-first audit. Do it in ONE pass.
- Find everything first. Do not report findings one by one.
- Fix every finding that is mechanical, reversible with git, and free of owner decisions.
- Defer only owner decisions. Put them in the final report with a recommended option.
- Report ONCE, at the end, in the table format of
references/procedure.md§7. - Do not write prose between steps. One status line per step is the maximum.
Procedure
Full detail per step: references/procedure.md. Read references/gotchas.md BEFORE step 4. Each entry broke a real debloat.
1. MEASURE
- Inventory the always-on weight: root and nested CLAUDE.md files,
.claude/settings.json,.mcp.json, skills, agents, commands. - Map the de-facto weight: docs that CLAUDE.md rules force-load nearly every session.
- Estimate chars and tokens per item (tokens ≈ chars / 4).
- Detect existing context-budget tooling before you add any.
2. MAP ENFORCEMENT — before you edit anything
- Find pre-commit hooks, CI jobs, and tests that pin doc paths, front-matter schemas, content literals, ratchet counters, or budgets.
- Grep the tests for
read_textandrglobcalls over docs. - Write down everything you find. This list is a hard constraint. The debloat must not break it.
3. CLASSIFY every CLAUDE.md section
| Verdict | Criterion | Action | |
|---|---|---|---|
| KEEP | Hard rule with no mechanical enforcement | Keep, compressed | |
| MOVE | Procedure duplicated by tooling or docs | Move to a trigger-loaded doc or a skill | |
| DELETE | Historical narrative, provenance dates, before/after examples, debt notes tracked elsewhere | Remove | |
| PATH-SCOPE | Rule applies only to some paths | Nested CLAUDE.md or a skill — real mechanisms only |
Never propose .claude/rules/ with paths: front matter. It is not a real mechanism.
4. TRIM trigger-loaded docs to "only open items"
- Archive closed content: move + metadata flip + pointer + inbound-link fixes, all in ONE commit.
- Fix trigger rows whose condition is false.
- Route large unrouted files. Fix broken links. Merge duplicate indexes into one.
5. RULES → SETTINGS
- Convert each "never do X" sentence into a
permissions.denyentry or a PreToolUse hook in.claude/settings.json. - Shrink the prose to one line that points at the setting.
- Sentences get ignored; settings block.
6. VERIFY & REPORT
- Re-run every gate from step 2 after each commit.
- Emit the single report: chars before/after per always-on file, lines before/after per trimmed doc, deferred items with their owner.
Quality gates
- [ ] Step 2 ran before any edit. The constraint list exists in the report.
- [ ] Every gate from step 2 re-ran green after each commit.
- [ ] No section number and no rule ID moved (gotchas 1 and 6).
- [ ] Every fix landed in this pass. Deferred items carry an owner and a recommendation.
- [ ] The report fits on one screen.
Maintenance loop
claude-md-architect defines the target shape; this skill keeps it lean over time. Run this skill when the CLAUDE.md grows past its declared budget, and at least quarterly.
References
references/procedure.md— full method, measurement heuristics, report templatereferences/gotchas.md— field-tested failure modes; read before editing