Improve Docs Architecture
Strict structural review for a body of markdown. Combination of
/thermo-nuclear-code-quality-review (standards, ambition, tone) and
aihero.dev's /improve-codebase-architecture (survey → deletion test →
candidate cards → grilling). Docs rot like code: facts get two homes and
drift, stories bury rules, indexes restate content, and always-loaded files
tax every session. Do not collect nits. Hunt for "doc judo" moves: restructurings
that keep every load-bearing fact while making the corpus dramatically
smaller, flatter, and harder to contradict.
Scope and modes
- Survey mode (default): the whole corpus the user names: a
.claude/
config tree, a docs/ dir, a repo's markdown, a skill fleet.
- Diff mode: when the user names a branch, PR, or file, review only that
change against the standards below, thermo-nuclear style.
- Activity bias: read git history (file mtimes when there is no repo) and
weight actively-edited files. Weight always-loaded files highest: anything
injected into context every session (CLAUDE.md, rules/, memory indexes) pays
its cost on every turn. A cleanup in a doc nobody reads is a refactor you
will never cash in.
- Measure first. Before judging, compute the numbers the review will rest
on: lines and bytes per file, and the total always-loaded payload. Report
them. No adjective without the yardstick.
Deep vs shallow, for markdown
A deep doc hides detail behind a small stable surface: a rule you can obey
without opening three other files; an index that is only pointers; a story
that lives in an archive nobody loads. A shallow doc has a surface as wide
as its content. The three shallowness forms to hunt:
- Split meaning: one policy smeared across files so the real rule lives
in the orchestration ("read A, unless B, see priority order in C").
- Boundary leaks: machine-specific facts in a shared doc, project facts
in a global doc, incident history in a rulebook, content in an index.
- Five-file concepts: a thing you cannot understand without opening five
files that point at each other.
The deletion test
Every candidate must pass: if this file or section were deleted or merged,
would its job concentrate into one existing home, or would readers lose
something no other file provides? Only "concentrates" qualifies. This kills
generic cleanup advice before it reaches the report.
Non-negotiable standards
- Be ambitious. Prefer the move that makes whole sections, files, or
meta-rules disappear. If a precedence table exists to referee overlapping
rules, the judo move is merging the rules, not polishing the table.
- One home per fact. The same rule, path, count, or convention stated in
two files is a drift bomb; one copy will rot silently. Flag every
duplicate; name the surviving home.
- Size gates. A doc drifting past ~300-400 lines is a decompose-or-cut
candidate. An always-loaded corpus has a token budget; state the current
total and the target. An index entry is one line; an index holding
paragraphs has become a second copy of the content.
- No stories in source. Dates, incident history, benchmark numbers, and
"we tried X first" belong in an archive file (
docs/incidents.md,
ADRs), never in an always-loaded rule. Keep the one-line rule, move
the story. (Same law as the Comments rule in coding-standards.)
- Contradictions are severity-one. Two docs disagreeing on a fact is
worse than either being missing; the reader cannot tell which is live.
Stale dated claims ("as of", versions, model names, counts) are
contradictions in waiting: verify or delete them.
- Verifier over prose. Where a hook, lint, or CI check enforces a rule,
shrink the prose to one line naming the verifier. Prose is taxed every
load; the hook is free.
- No wrapper docs. Files that only point at other files, headers over a
single bullet, meta-sections about how to read the sections: indirection
must buy clarity or die.
- Scoped exceptions, not scattered ones. "Does NOT fire on" patches,
per-file carve-outs, and special-case notes bolted on after the fact are
spaghetti growth. Reframe the rule so the exceptions disappear.
Standards, symptoms, and moves
| Standard |
Symptom to flag |
Preferred move |
| 0. Be ambitious |
A rulebook needed an internal priority system to referee its own overlapping sections; a merge shuffled text without reducing how many places a reader must look |
Merge overlapping sections into one and delete the referee |
| 1. One home per fact |
A fact, rule, or path with two or more homes, especially across always-loaded files; a shared doc carrying machine- or project-specific facts |
Relocate the fact to its owning layer (machine to local file, project to project CLAUDE.md, shared to the shared repo file) |
| 2. Size gates |
Indexes whose entries have grown into paragraphs |
Collapse an index entry to one line; the detail already lives in the file it points to |
| 3. No stories in source |
Incident narratives inside rules that fire every session |
Move the story to the archive; keep the sentence |
| 4. Contradictions are severity-one |
Dated claims that no longer match the system they describe |
Fix or delete every stale dated claim in the same pass |
| 5. Verifier over prose |
Docs whose job a deterministic check already does |
Replace enforced prose with one line naming the hook |
| 6. No wrapper docs |
A concept that takes five files to understand |
Delete the wrapper file; point the one reference at the real home |
| 7. Scoped exceptions, not scattered ones |
"Does NOT fire on" patches and per-file carve-outs bolted on after the fact |
Reframe the rule so the exceptions disappear |
Report
Produce a single self-contained HTML report (inline CSS, no framework) in the
scratchpad or OS temp dir: docs-architecture-review-<timestamp>.html. Open
it when done. Lead with the measured numbers (per-file sizes, always-loaded
total, duplicate-fact count). Then one card per candidate:
- files and sections involved
- the friction, in plain English
- the move, in plain English
- payoff: tokens saved per load × drift surfaces removed
- before/after outline (headings only)
- strength badge
| Badge |
Meaning |
| Strong |
Deletion test passes clearly; the friction is real today |
| Worth exploring |
Plausible; payoff depends on where the corpus is heading |
| Speculative |
Surfaced for completeness; safe to ignore |
End with one top recommendation. Then halt and ask which candidate to
explore. One candidate per session; a full-corpus rewrite in one pass is
how load-bearing lines get lost.
Grilling session
For the chosen candidate, pressure-test before any edit is proposed:
- References: grep for every link, anchor, skill name, and path that
points at the text being moved or deleted. List what must be updated.
- Survival: name each load-bearing fact in the affected text and its
destination. A fact with no destination blocks the move.
- Hidden coupling: who else loads this file (hooks, tools, other boxes,
CI)? A shared repo file changes on every machine that pulls it.
- Deepened shape: write the after-outline: headings and one-liners only.
The output of the grilling is a decision, not an edit.
Apply gate
This skill never changes a file without an explicit "apply" from the user.
Both parents are review-only; this one adds a single gated exception. On
"apply": honor the Hand-Maintained Files rule (show full rewrites and wait;
targeted edits proceed), save backups, make the reference updates found in the
grilling in the same pass, and re-run the measurement so the report's numbers
have an after-column. If the corpus is a git repo, leave the change
uncommitted unless asked.
Tone and output bar
Direct, serious, demanding, never rude. Do not soften a structural problem
into a mild suggestion. Prioritize: contradictions and duplicate homes, then
missed judo moves, then boundary leaks, then size, then style. A small number
of high-conviction candidates beats a long list of cosmetic notes. Do not
approve a docs change merely because the words are accurate: no new second
home for an existing fact, no new story in an always-loaded file, no new
wrapper, no size gate crossed without a stated reason; treat these as
presumptive blockers unless justified.
1---2name: improve-docs-architecture3description: Strict architecture review for markdown/docs corpora. Survey, deletion test, candidate cards, grilling. Review-only until apply.4---56# Improve Docs Architecture78Strict structural review for a body of markdown. Combination of9`/thermo-nuclear-code-quality-review` (standards, ambition, tone) and10aihero.dev's `/improve-codebase-architecture` (survey → deletion test →11candidate cards → grilling). Docs rot like code: facts get two homes and12drift, stories bury rules, indexes restate content, and always-loaded files13tax every session. Do not collect nits. Hunt for "doc judo" moves: restructurings14that keep every load-bearing fact while making the corpus dramatically15smaller, flatter, and harder to contradict.1617## Scope and modes1819- **Survey mode (default):** the whole corpus the user names: a `.claude/`20 config tree, a `docs/` dir, a repo's markdown, a skill fleet.21- **Diff mode:** when the user names a branch, PR, or file, review only that22 change against the standards below, thermo-nuclear style.23- **Activity bias:** read git history (file mtimes when there is no repo) and24 weight actively-edited files. Weight **always-loaded files highest**: anything25 injected into context every session (CLAUDE.md, rules/, memory indexes) pays26 its cost on every turn. A cleanup in a doc nobody reads is a refactor you27 will never cash in.28- **Measure first.** Before judging, compute the numbers the review will rest29 on: lines and bytes per file, and the total always-loaded payload. Report30 them. No adjective without the yardstick.3132## Deep vs shallow, for markdown3334A **deep** doc hides detail behind a small stable surface: a rule you can obey35without opening three other files; an index that is only pointers; a story36that lives in an archive nobody loads. A **shallow** doc has a surface as wide37as its content. The three shallowness forms to hunt:38391. **Split meaning:** one policy smeared across files so the real rule lives40 in the orchestration ("read A, unless B, see priority order in C").412. **Boundary leaks:** machine-specific facts in a shared doc, project facts42 in a global doc, incident history in a rulebook, content in an index.433. **Five-file concepts:** a thing you cannot understand without opening five44 files that point at each other.4546## The deletion test4748Every candidate must pass: **if this file or section were deleted or merged,49would its job concentrate into one existing home, or would readers lose50something no other file provides?** Only "concentrates" qualifies. This kills51generic cleanup advice before it reaches the report.5253## Non-negotiable standards54550. **Be ambitious.** Prefer the move that makes whole sections, files, or56 meta-rules disappear. If a precedence table exists to referee overlapping57 rules, the judo move is merging the rules, not polishing the table.581. **One home per fact.** The same rule, path, count, or convention stated in59 two files is a drift bomb; one copy will rot silently. Flag every60 duplicate; name the surviving home.612. **Size gates.** A doc drifting past ~300-400 lines is a decompose-or-cut62 candidate. An always-loaded corpus has a token budget; state the current63 total and the target. An index entry is one line; an index holding64 paragraphs has become a second copy of the content.653. **No stories in source.** Dates, incident history, benchmark numbers, and66 "we tried X first" belong in an archive file (`docs/incidents.md`,67 ADRs), never in an always-loaded rule. Keep the one-line rule, move68 the story. (Same law as the Comments rule in coding-standards.)694. **Contradictions are severity-one.** Two docs disagreeing on a fact is70 worse than either being missing; the reader cannot tell which is live.71 Stale dated claims ("as of", versions, model names, counts) are72 contradictions in waiting: verify or delete them.735. **Verifier over prose.** Where a hook, lint, or CI check enforces a rule,74 shrink the prose to one line naming the verifier. Prose is taxed every75 load; the hook is free.766. **No wrapper docs.** Files that only point at other files, headers over a77 single bullet, meta-sections about how to read the sections: indirection78 must buy clarity or die.797. **Scoped exceptions, not scattered ones.** "Does NOT fire on" patches,80 per-file carve-outs, and special-case notes bolted on after the fact are81 spaghetti growth. Reframe the rule so the exceptions disappear.8283## Standards, symptoms, and moves8485| Standard | Symptom to flag | Preferred move |86|---|---|---|87| 0. Be ambitious | A rulebook needed an internal priority system to referee its own overlapping sections; a merge shuffled text without reducing how many places a reader must look | Merge overlapping sections into one and delete the referee |88| 1. One home per fact | A fact, rule, or path with two or more homes, especially across always-loaded files; a shared doc carrying machine- or project-specific facts | Relocate the fact to its owning layer (machine to local file, project to project CLAUDE.md, shared to the shared repo file) |89| 2. Size gates | Indexes whose entries have grown into paragraphs | Collapse an index entry to one line; the detail already lives in the file it points to |90| 3. No stories in source | Incident narratives inside rules that fire every session | Move the story to the archive; keep the sentence |91| 4. Contradictions are severity-one | Dated claims that no longer match the system they describe | Fix or delete every stale dated claim in the same pass |92| 5. Verifier over prose | Docs whose job a deterministic check already does | Replace enforced prose with one line naming the hook |93| 6. No wrapper docs | A concept that takes five files to understand | Delete the wrapper file; point the one reference at the real home |94| 7. Scoped exceptions, not scattered ones | "Does NOT fire on" patches and per-file carve-outs bolted on after the fact | Reframe the rule so the exceptions disappear |9596## Report9798Produce a single self-contained HTML report (inline CSS, no framework) in the99scratchpad or OS temp dir: `docs-architecture-review-<timestamp>.html`. Open100it when done. Lead with the measured numbers (per-file sizes, always-loaded101total, duplicate-fact count). Then one card per candidate:102103- files and sections involved104- the friction, in plain English105- the move, in plain English106- payoff: tokens saved per load × drift surfaces removed107- before/after outline (headings only)108- strength badge109110| Badge | Meaning |111|---|---|112| **Strong** | Deletion test passes clearly; the friction is real today |113| **Worth exploring** | Plausible; payoff depends on where the corpus is heading |114| **Speculative** | Surfaced for completeness; safe to ignore |115116End with one top recommendation. Then **halt and ask which candidate to117explore**. One candidate per session; a full-corpus rewrite in one pass is118how load-bearing lines get lost.119120## Grilling session121122For the chosen candidate, pressure-test before any edit is proposed:123124- **References:** grep for every link, anchor, skill name, and path that125 points at the text being moved or deleted. List what must be updated.126- **Survival:** name each load-bearing fact in the affected text and its127 destination. A fact with no destination blocks the move.128- **Hidden coupling:** who else loads this file (hooks, tools, other boxes,129 CI)? A shared repo file changes on every machine that pulls it.130- **Deepened shape:** write the after-outline: headings and one-liners only.131132The output of the grilling is a decision, not an edit.133134## Apply gate135136**This skill never changes a file without an explicit "apply" from the user.**137Both parents are review-only; this one adds a single gated exception. On138"apply": honor the Hand-Maintained Files rule (show full rewrites and wait;139targeted edits proceed), save backups, make the reference updates found in the140grilling in the same pass, and re-run the measurement so the report's numbers141have an after-column. If the corpus is a git repo, leave the change142uncommitted unless asked.143144## Tone and output bar145146Direct, serious, demanding, never rude. Do not soften a structural problem147into a mild suggestion. Prioritize: contradictions and duplicate homes, then148missed judo moves, then boundary leaks, then size, then style. A small number149of high-conviction candidates beats a long list of cosmetic notes. Do not150approve a docs change merely because the words are accurate: no new second151home for an existing fact, no new story in an always-loaded file, no new152wrapper, no size gate crossed without a stated reason; treat these as153presumptive blockers unless justified.