claude-md-hygiene
Skill0 starsChanged 3 months agoMITView on GitHub
Hygiene and compression pass over CLAUDE.md (distil, strip filler, drop stale, archive per topic) — WITHOUT new learnings. Owns every compression rule.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- loonylabs/claude-setupword for word, first seen Oct 17, 2026
- w2ur/claude-code-setuptheir own version, first seen Sep 4, 2026
Other versions2 projects use a version of this.
Word for word · 1
- loonylabs/claude-setup★ 0100% same
Edited · 0
None found.
Wrote their own version · 1
- w2ur/claude-code-setup★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- analyze-fix-cheapSkill
- analyze-fixSkill
- changelog-summarySkill
- codebase-designSkill
- create-stories-from-docsSkill
- domain-modelingSkill
- grillingSkill
- grill-meSkill
- handoverSkill
- implement-storiesSkill
- improve-codebase-architectureSkill
- setup-matt-pocock-skillsSkill
- step-by-stepSkill
- to-ticketsSkill
- update-claude-mdSkill
- wakeSkill
- work-with-meSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
There is no fifth case: If nothing in this table covers something, it stays.
- Distinctive: line 77
Duplicates: search for the same predicates and API names — are several paragraphs stacking up on one class of rule ("third instance")?
- Distinctive: line 116
Read the result once. If it is ambiguous, put the one word back that resolves it — not the sentence.
- Very specific: line 118
One language: No mixing, not even inside a sentence.
- Very specific: line 126
Supersession, cleanly: never carry the old and the new model side by side.
- Distinctive: line 128
An active campaign stays in the core: only DONE/SUPERSEDED moves to the archive.
- Very specific: line 136
Run the audit script again: target reached?
- Distinctive: line 149
Report: Every cut with its row from the table above AND its destination: evidence moved out (→ which file), lookup knowledge relocated (→ …
- Very specific: line 154
Standalone run: commit separately (docs: CLAUDE.md — …).
- Distinctive: line 166
Deliberately "broken" examples stay broken: If a symptom appears verbatim as a demonstration in the file (a mojibake line inside an …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md Hygiene (audit & compression)
Condense and clean up CLAUDE.md without adding new findings.
Boundary: /update-claude-md files session learnings IN; this skill only touches what
is already there. The compression rules live here and nowhere else — the other skill
calls this one instead of repeating them.
Supreme law (not negotiable): NO rule that still holds may be lost. A generic law (symptom → rule) that will prevent a mistake next time ALWAYS stays — in the core, distilled. What gets moved out or deleted is the EVIDENCE (derivation, measurements, calibration constants, anecdotes, superseded models). If you find an actionable rule while moving evidence out and it is missing from the core: distil it into the core FIRST, then move the rest.
What may move out is CONTENT — never the rule. The line does not run between "important" and "unimportant", but between the law and its evidence:
| May leave the core? | |
| The rule itself — symptom → law, in one sentence | NEVER. Not moved out, not deleted. It may only be worded more briefly. |
| Its evidence — measurements, derivation, rejected alternatives, how the failure surfaced | Moves into a topic file; the back-reference stays in the section |
| Pure lookup knowledge with no law — port tables, test users, recipes, command sequences | May move entirely, a reference stays |
| A rule that no longer HOLDS — points at deleted code, superseded by a new model | Is withdrawn, with the reason spelled out in the report. That is not loss, that is cleanup. |
There is no fifth case. If nothing in this table covers something, it stays. And the test for the last row is strict: "no longer holds" means the code it describes is gone or a new model replaced it — not that it is long, inconvenient or rarely needed.
Evidence from practice (one project, 48,768 → 30,021 characters): three lore files were opened, and all three imperative sentences appearing in them still stand in the core too. That is exactly the shape to aim for — lore explains the why, it does not replace the law.
A precondition, not a suggestion: what exists is committed BEFORE the pass starts.
That is the actual safety net — while it holds, no wrong call is final, it is one
git checkout away.
Measured in CHARACTERS, not lines
A line budget invites denser lines and then reports "no growth" while the file grows. Measured on one project: three commits in a row at exactly 399 lines (one under the 400-line gate), characters going 27099 → 27625, and density drifting from 62 to 69 characters per line within a week. Lines stay a readability hint, but are never the gate.
Projects declare their budget in KB, e.g. Budget ~23 KB (hard gate 25 KB) — the audit
script reads that from the file.
When to run it
- The audit reports an overrun (
VERDICT: OVER HARD GATE). - Called from
/update-claude-md, because new learnings do not fit the budget. - A language mix has crept in, a wave of deletions left sections stale, the same law is stacking up ("third instance of the class").
- On request.
Procedure
Measure — one call, not five:
node ~/.claude/scripts/claude-md-audit.mjs CLAUDE.mdGives size in characters and estimated tokens, the budget verdict, the largest sections (by subtree — cut there first), filler-word candidates, date ballast and language mix. Exit code: 0 within budget, 3 over soft, 1 over the hard gate. Note the starting number; make sure what exists is committed (a clean diff to compare against at the end).
Two targets the script does NOT find — grep for those:
- Stale: grep the class, file and API names the entries mention — do they still exist? A law pointing at deleted code is worse than no entry.
- Duplicates: search for the same predicates and API names — are several paragraphs stacking up on one class of rule ("third instance")?
- Set the target before you write. How many characters have to go? When called from
/update-claude-md: their number plus a buffer. Collect the cuts from what is there and do the arithmetic before touching the file — not write, measure, patch up. That convergence loop was the most expensive part of the old version (measured: 27 tool calls, a sequence of 11 → 18 → 16 → 13 lines over the limit — it got worse in between). Transform — the core rules:
- Distil: evidence out, rule + why in ONE sentence. Derivation and numbers → a small topic file in the project's docs or archive directory, with a one-line back-reference from the section.
- No monster archive: ONE file per topic; if the project already has a filing scheme, use it. Not a new file per individual finding.
Telegraphic style — and the default is CUT, not keep. A CLAUDE.md is a rule sheet read by a model, not prose read by a person. It is allowed to sound clipped. The test for every word is only: does the meaning stay unambiguous without it?
Cut by default:
Class Before After Article before a noun the context fixes Killing a process needs taskkill /T /FKilling process needs taskkill /T /FArticle inside a description reaches only the direct process reaches only direct process Article before a compound sends a window-close message they ignore sends window-close message they ignore "here" / "on this machine" under a heading that already says so A missing command exits 1 here A missing command exits 1 Copula in an enumeration severity is honest, impact is concrete severity honest, impact concrete Softeners that actually ships · simply run that ships · run Keep — these three carry meaning, not politeness:
Class Why which/thatintroducing a reason"throw on res.error, which otherwise returns empty" — without it the clause reads as a new main statement instead of a causeAn article that marks which one "the test that failed" ≠ "a test that failed" where the difference decides the action Negations, quantities, exact identifiers never compress NOT,only,≥, a threshold, a filenameRead the result once. If it is ambiguous, put the one word back that resolves it — not the sentence. The script only shows candidates; the decision is made here, word by word.
- One language. No mixing, not even inside a sentence. The language is whatever
language.mdand the project's ownCLAUDE.mdsettle on — when you touch an old passage in the other language, convert it as you go rather than leaving a seam. - Consolidate instead of stacking: a new instance of an existing rule → sharpen the entry that is there, do not put a paragraph beside it.
- Stale goes out entirely: a law that only explains HISTORY (code is stable, it warns of no future mistake) leaves the core → one-line reference. Rule of thumb: "would a new agent make the same mistake WITHOUT this paragraph?" No ⇒ out.
- Supersession, cleanly: never carry the old and the new model side by side; REMOVE
(SUPERSEDED …)inline markers during the pass rather than preserving them. - An active campaign stays in the core: only DONE/SUPERSEDED moves to the archive. Ongoing detail lives in its story, distilled in the core.
Apply through the Edit tool, batched — not through hand-written PowerShell or Python replacements. Edit makes the same exact string replacement in one call, with no re-read and no quoting risk.
- Verify — prove nothing was lost:
- Run the audit script again: target reached? And
referenced docs: N (0 missing)— a dead reference means content that moved out is gone while the core claims it is filed. - From ~15 % shrinkage the loss check is mandatory, not optional: 1–3 reviewers in
parallel (
Agent,model: opus, read-only) with the concrete question — for every imperative sentence that disappeared from the diff: where did it go? Acceptable answers: the rule still stands in the core (just shorter — where?), or only its evidence moved (where to?), or it no longer holds (why?). A sentence carrying a rule that still holds and is no longer in the core is a loss and gets pulled back — even if it turns up in a lore file. Additionally: flag leftover filler and over-compression. - Open a sample of reference targets: do they actually cover what the reference promises?
git diff --stat— ONLY the edited lines should churn (whole-file churn = an encoding or line-ending accident).
- Run the audit script again: target reached? And
Report. Every cut with its row from the table above AND its destination: evidence moved out (→ which file), lookup knowledge relocated (→ which file), rule withdrawn (+ why it no longer holds). A rule that still holds does not appear in this list — if one does, the pass failed. Plus the before→after balance in characters.
- Standalone run: commit separately (
docs: CLAUDE.md — …). - Called from
/update-claude-md: do NOT commit. Report how many characters you freed (and if the target was unreachable: how many are missing and why cutting further would cost a rule that still holds), then hand back to the caller. They file and commit in one go.
- Standalone run: commit separately (
Traps (learned the hard way)
- NEVER put an existing UTF-8 project file through PowerShell text pipelines (mojibake + BOM + whole-file churn). Text edits go through the Edit tool.
- Do NOT use
@pathimports to move detail out — they load EAGERLY into the startup context and undo the whole point. Prose back-references are what this is for. - Deliberately "broken" examples stay broken. If a symptom appears verbatim as a demonstration in the file (a mojibake line inside an encoding rule, say), that is the content, not an accident — do not "fix" it.
- This skill stays lean itself (the meta-irony of a bloated anti-bloat skill).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

