/docs-hygiene:audit-derivability [target|audit [target]|sweep <dir>] [--repo <repo> ...]from docs-hygiene
Audits whether documentation files earn their existence by checking if their content can be re-derived from code, config, and structure. Reports verdicts: delete, convert-to-pointer, keep-as-derivation-cache, or keep-owns-facts.
Ships in docs-hygiene. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Uncommitted .md files (first 20; empty = none matched or the probe returned nothing): !"${CLAUDE_SKILL_DIR}/scripts/uncommitted-md.sh" 20 2>/dev/null || echo "(status unavailable)"
Every command in this line matches an allowed-tools grant, so a dontAsk lane can run this skill.
Every tracked document must be kept true as its code moves, and every low-signal document costs its readers (human or agent) attention. A document earns that only when it holds something a reader could not cheaply reconstruct. This skill audits document-level worth: should this whole document exist at all?
The test is derivability: could a fresh agent reach the document's conclusions by natively exploring the repository (code, config, metadata, structure) without being handed it? A document that only restates the code is a derivation cache at best and dead weight at worst; one that records why a decision was made, a constraint no single file shows, or a fact outside the repo owns something exploration can never recover.
Read-only classifier: it reports a verdict per document with the reasoning; the author owns every deletion and rewrite. Deletion is the highest-stakes doc edit, so, like /docs-hygiene:audit-noise, this skill never applies it.
A verdict is never "derivable, therefore delete." Weigh all four factors together. context/rubric.md holds the scoring detail: factor definitions, the Diataxis fact-ownership mapping, the audience cost model, the spot-test protocol, and worked examples. Load it when a verdict is close.
| Factor | Question | Pushes toward |
|---|---|---|
| Derivable? | Could a fresh agent reconstruct these conclusions from native exploration alone? | derivable → delete/pointer; not derivable → keep |
| Re-derivation cost | If deleted, what does the next reader pay to rebuild it: a 2-second grep, or a multi-file investigation? | cheap → delete; expensive → keep-as-cache |
| Drift risk | How fast does the source move, and how silently does the doc rot when it does? | high drift → delete/pointer; low drift → cache is safer |
| Fact ownership | Does the document own non-derivable facts: rationale, decisions, constraints, external facts, cross-cutting invariants no single file states? | owns facts → keep, regardless of derivability of the rest |
Fact ownership is the trump card: a document owning even one non-derivable fact is kept (keep-owns-facts), and the derivable remainder routes to trimming (/docs-hygiene:audit-noise, /docs-hygiene:extract-ssot), not deletion.
| Verdict | Meaning | Condition |
|---|---|---|
delete | Derivable, cheap to re-derive, owns no non-derivable fact: dead weight. | All of: derivable, low re-derivation cost, no owned facts. Load-bearing or contested candidates require the empirical spot-test below before a confident delete. |
convert-to-pointer | Exists to route readers to a truth that lives elsewhere (code, another doc, an external source). Replace the body with a one-line pointer to the source of truth. | Derivable or duplicative, but the routing/orientation value is real. The verdict must name its pointer target as a repo path verified to exist (or an external URL), with the verification in the rationale; a pointer at a nonexistent anchor is worse than the doc it replaces. |
keep-as-derivation-cache | Derivable, but re-derivation is expensive enough that a cached rendering earns its keep, if the cache cannot silently rot. | Derivable + high re-derivation cost + a drift-control condition is present: a regeneration/verification path, or a recorded recheck trigger. Absent that condition, this verdict demotes to convert-to-pointer or delete. |
keep-owns-facts | Owns at least one non-derivable fact (rationale, decision, constraint, external fact, cross-cutting invariant). | Any owned non-derivable fact. Route the derivable remainder to the trimming siblings. |
A file a component consumes or copies at runtime (a checklist template a skill instructs agents to copy and tick, an eval fixture, a scaffold) is machinery, not documentation, and gets no verdict. Test: is this file an input a tool or skill consumes, rather than prose a reader learns from? If yes, record it as out-of-scope: functional artifact in the ledger and move on: the four factors presuppose a document read for its claims, and a scaffold has none.
Re-derivation cost is paid by the reader, and agent and human readers pay differently, so the same content can score differently by audience. Classify each document's primary audience and name it in the verdict; a document serving both is classified for each, taking the more conservative (keep-leaning) verdict. Agent-facing surfaces (CLAUDE.md, AGENTS.md, .claude/rules/, skill and agent bodies) get the full axe: exploration is cheap and redundant context is a standing token tax. Human-facing docs (onboarding, READMEs, tutorials, architecture explainers) clear a higher bar: human re-derivation cost is real. Cost model and examples: context/rubric.md.
Do not guess derivability from a skim. Two passes, escalating only where the stakes justify it:
/docs-hygiene:extract-ssot), or nowhere else (owned, non-derivable); the mix drives a provisional verdict. Before every delete or convert-to-pointer verdict that recommends a change (not convert-to-pointer (already satisfied)), check git log for the file: a commit recording a decision about the doc (a deliberate creation, or a deliberate empty or reset state) is an owned fact (Factor 4). Mechanical history is derivable; a decision or rationale in a commit message is not. Where the decision is the file's state (a deliberately emptied file) the verdict is keep-owns-facts; otherwise it ships provisional with the text reverses a recorded decision, never as confirmed-actionable.delete/convert-to-pointer by delegating to a fresh-context, non-fork subagent that has not seen the document. When the audited file loads at launch (root CLAUDE.md, AGENTS.md, an unscoped .claude/rules file), the subagent must be Explore or Plan, this skill's choice: which subagent types load those files before they start is the Sources pointer's to state, and the skill does not rely on any other type skipping them. The subagent reproduces the document's conclusions from native exploration only; then compare. Prefer a cross-vendor advisor for the spot-test when one is enabled and set up, when its documented surface can take this artifact, invoked per its own docs, with the fresh-context same-vendor subagent as the stated fallback, never a route to a command that may not resolve (per docs/plugin-philosophy.md "Fresh-eyes checkpoints" in the marketplace repository). Convergence confirms derivable; divergence means the document owns something exploration could not recover: keep it. Never the Agent tool's fork subagent type, whatever it carries over from this context: the spot-test needs a context that never saw the document. A skill's own context: fork frontmatter is a different mechanism, and this rule does not rule it out; what each starts with is the Sources pointer's to state. Full protocol: context/rubric.md.Gate the spot-test by stakes: skip it for an obviously trivial derivable file (an auto-generated index, a verbatim config restatement); run it whenever being wrong about the deletion costs a reader something real.
The verification level decides how many spot-tests run. Resolve it once before the first verdict with bash "${CLAUDE_PLUGIN_ROOT}/lib/read-verification.sh" --plugin docs-hygiene --skill audit-derivability --file docs/conventions/docs-hygiene.yaml and report its line (levels). This skill's allowed-tools does not grant the reader, so the call may prompt; a refused or denied call resolves light. standard is the two paragraphs above. strict spot-tests every delete/convert-to-pointer verdict, trivial files included, and a sweep's cap defers none. Under light, and off, which acts as light here, dispatch no spot-test or keep-sample and never grade one from this context: each verdict that needed one ships provisional, its Spot-test: line reading verification: skipped (<level>), and is never routed as actionable.
Keep verdicts get a sampled spot-test too, so false-keeps are bounded. A diverged keep-sample confirms the keep. A converged one sends the doc back through the four factors; any delete/convert-to-pointer result ships provisional (never confirmed-actionable) and counts as overturned. Sizing, selection, and recording: context/rubric.md, "Keep-sample protocol".
| Action | Args | Behavior |
|---|---|---|
<target> (default, no action keyword) | empty → uncommitted .md files; file path → single doc; dir path → each .md directly in it | Run the rubric per document: heuristic pass, spot-test where gated, emit the verdict ledger |
audit [target] | same target rules | Explicit form of the default; identical behavior |
sweep <dir> | a directory to walk recursively | Corpus audit of the directory's tracked markdown. Enumerate via git ls-files -- '<dir>/*.md', one combined pathspec: two pathspecs ('*.md' -- <dir>) OR together and silently escalate the sweep to the whole repo. Gitignored and untracked files are out of scope, and so are /docs-hygiene:extract-ssot's codified survey exclusions (vendored trees, eval fixtures, test data, run logs; ${CLAUDE_PLUGIN_ROOT}/skills/extract-ssot/actions/identify.md owns that list; read it there, don't paraphrase it). Report the scope root and enumerated file count before fan-out. Fan out fresh read-only subagents (no concurrency ceiling of the skill's own; the runtime may cap, which is fine; an actual rate-limit error is the only reason to back off). Small corpus: one document per subagent. Large corpus: batch ~15-25 documents per subagent, grouped by directory affinity so siblings share one exploration context, and route same-basename or near-identical files into one batch; where they still split, reconcile divergent verdicts on near-identical documents before the aggregate. Each subagent writes its per-document verdict blocks to a batch ledger file (session scratchpad or similar) and returns compact verdicts and counts; the reply carries the aggregate, the actionable subset, and pointers to the batch ledgers. Corpus-scale per-document detail never streams through one context or one reply. Spot-test a sample of keep-owns-facts verdicts too, so false-keeps are bounded, not only false-deletes: every tenth keep in lexical filename order, at least one per batch ledger (the ten is judgment). Record the sampled file list beside the batch ledger when it is drawn; never reconstruct it later. Outcomes: context/rubric.md, "Keep-sample protocol". |
--repo <repo> (and the other target forms) | beside any action above | That action once per repository, per ${CLAUDE_PLUGIN_ROOT}/reference/target-scope.md and ../../context/clean-tree-fallback.md "Several repositories". With no path, each repository gets a sweep of its root. Each repository's subagent keeps its own batch ledgers and keep-sample list, under a scratchpad directory named for the repository (<owner>/<name>/), and the aggregate line is given per repository and then in total |
One action per response; actions do not chain implicitly. sweep is the only recursive mode; the bare/audit default never walks subdirectories, so a large tree is never audited by accident.
Sweep subagent model and effort. Every sweep fan-out, explicit or reached through the repo-wide escalation, sets these per subagent; a tier the user pins wins. Run /multi-agent:route worker session=<this session's model alias> (if enabled) and pass its fanout variant: the model unless omit_model is true, and the effort always. When it does not resolve, omit the model so subagents inherit the session's, except when the session model is frontier or unknown, where pass opus; pass effort medium. That fallback is this skill's stand-in for the role map /multi-agent:route (if enabled) applies, not an upstream default; say once in the reply that enabling the multi-agent plugin makes this routing configurable.
Shared clean-tree / no-scope shape: ../../context/clean-tree-fallback.md. Read it when the bare invocation is unattended or non-interactive, the case the rules below leave unstated, or when editing those rules.
AskUserQuestion where available, a plain prose question otherwise), with the prescribed defaults below pre-filled so a bare "yes" suffices; the interview may adjust any knob. Declining, or no answer, ends as the friendly no-op exit 0 ("No uncommitted .md files. Pass a file/dir target, or sweep <dir> for a corpus.").md files → audit those filesaudit) → audit each .md directly in the directory (non-recursive; filenames sorted lexically)sweep → recursive corpus audit on the restThe interview knobs for the confirmation in rule 1, each with its default. A confirmed escalation runs as a sweep over the resolved scope; every hard rule (read-only above all) still applies.
.md files (git ls-files '*.md'); the user may narrow to a directory.sweep contract: fresh read-only subagents, batched for a large corpus.delete/convert-to-pointer verdicts up to a stated cap per pass. A flagged verdict past the cap is emitted as provisional: pending its spot-test, excluded from the actionable-routing offer, never presented as a confirmed delete. The cap defers the hard rule's spot-test to a follow-up pass; it never waives it. Under a strict verification level there is no cap.Per document:
<file> — verdict: <delete | convert-to-pointer | keep-as-derivation-cache | keep-owns-facts> [audience: agent | human | both]
| Factor | Reading |
|--------|---------|
| Derivable? | <yes/partial/no> — <where the truth lives> |
| Re-derivation cost | <cheap/moderate/expensive> — <why> |
| Drift risk | <low/moderate/high> — <what moves underneath it> |
| Fact ownership | <none | owns: rationale / decision / constraint / external fact> |
Verdict rationale: <1-2 lines>.
Spot-test: <not run (trivial) | verification: skipped (<level>) | run — converged/diverged, subagent reproduced X of Y conclusions | keep-sample: converged/diverged>.
Provisional (if any): <reverses a recorded decision | spot-test deferred | verification skipped (<level>) | keep-sample converged, verdict overturned>.
Owned-fact salvage (if keep-owns-facts): <the non-derivable facts to preserve; route the rest to /docs-hygiene:audit-noise or extract-ssot>.
Cache drift-control (if keep-as-derivation-cache): <the regeneration path or recheck trigger that keeps it honest>.
Batch / sweep aggregate at the end:
Audited <N> document(s): <d> delete, <p> convert-to-pointer, <c> keep-as-cache, <k> keep-owns-facts, <f> out-of-scope functional artifacts; <r> of the verdicts also carry a route-to-sibling annotation; keep-sample: <s> sampled, <o> overturned.
Route-to-sibling is an annotation on a verdict, never a fifth verdict class: the verdict stands (usually a keep) but its rationale routes material to a sibling (doc-to-doc duplication to /docs-hygiene:extract-ssot, line-level noise to /docs-hygiene:audit-noise). Record the route in the rationale; <r> counts the documents carrying one, so routed work shows in the aggregate instead of vanishing into the keep bucket. <s> counts sampled keep verdicts and <o> those a converged sample overturned into a provisional delete/convert-to-pointer, so a false-keep rate is readable from the aggregate.
Corpus-scale sweeps (more documents than one reply can carry): the per-document blocks live in the batch ledger files; the reply carries the aggregate line, the confirmed-actionable (delete / convert-to-pointer) subset, the provisional (cap-deferred) verdicts listed separately, never in the actionable subset, and the ledger file locations.
After the ledger, offer to route actionable verdicts (delete / convert-to-pointer) to the consumer's work-item tracker, one item per document, and stop. Never auto-file, never auto-edit.
Edit or Write inside the repo, no Bash that mutates it; session-scratchpad ledgers and artifacts are the one sanctioned write surface. The author applies every deletion and rewrite. Deletion is the highest-stakes doc edit; the classifier only recommends.delete verdict requires all of: derivable, low re-derivation cost, no owned facts. Any owned non-derivable fact forces keep-owns-facts.context/rubric.md, Factor 3).fork subagent type (see Sources for what a fork starts with). A launch-loaded audited file is spot-tested only by Explore or Plan (this skill's choice; see Sources for which agents load those files). A verdict whose spot-test is deferred (e.g. past a sweep's cap) or skipped by a light or off verification level stays provisional and is never routed as actionable.CLAUDE.md, AGENTS.md, and project rules loaded grades its spot-test of those files having read them; which types do is the Sources pointer's to state. Use Explore or Plan./docs-hygiene:extract-ssot, not a delete here./docs-hygiene:audit-noise. That classifies line-level noise inside a document worth keeping; this decides whether the whole document is. A keep-owns-facts doc can still have noise lines for audit-noise to trim./docs-hygiene:extract-ssot. That deduplicates a unit repeated across files into one home, at any multiplicity (a new home is created only at 3+). Derivability is re-derivation from code/config/structure, not from another markdown file: a doc that duplicates another doc is extract-ssot's; a doc that restates the code is this skill's./docs-hygiene:compress. That trims prose within a doc that stays; this deletes or repoints whole docs.fork subagent starts with, and how a skill's context: fork differs from it. Pointer: fork the current conversation and Extend Claude with skills: run skills in a subagent.| Condition | Action |
|---|---|
| The rubric is proven over real audits | Route it upstream to the shared standards repository as doc-value policy (deferred; ledger E-a) |
| Demand surfaces for applying verdicts, not just classifying | Revisit the deferred remediation/apply action (deferred; ledger E-b) |
| A native "regenerate this doc from source" mechanism ships | Strengthen the keep-as-derivation-cache drift-control test to prefer regeneration over a recorded recheck trigger |
context/rubric.md (opens in a new tab)evals/evals.json (opens in a new tab)evals/fixtures/decision-rationale.md (opens in a new tab)evals/fixtures/derivable-with-source/runtime-settings.md (opens in a new tab)evals/fixtures/derivable-with-source/settings.json (opens in a new tab)scripts/uncommitted-md.sh (opens in a new tab)scripts/uncommitted-md.test.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
bashThree short reads, in order
npx claudepluginhub melodic-software/claude-code-plugins --plugin docs-hygiene10 skills in this plugin
/audit-encapsulationAudit encapsulationAudit skill encapsulation and boundary leak where external citation reaches private skill surface (.claude/skills/X/, plugins/*/skills/X/) beyond slash invocation; read-only, explicit fix FILE:LINE. Use when 'audit encapsulation', 'find skill leaks', 'check skill boundaries', skill boundary violation, reaching into SKILL, API drift, refactor skill. Load it to ask what depends on another plugin's internals. Load it too before publishing plugins as separate installs./audit-noiseAudit noiseRead-only audit of tracked markdown (rule/skill/convention doc) for nine noise shapes: stale historical citation, ghost ref, preamble, tracker back-ref, negation without positive, conversational residue. Use when 'audit markdown noise', 'find ghost refs', 'declutter', sweep for noise. Not for code comments: /code-tidying:remove-comments. Load it before listing a doc's leftover lines to cut before sharing it./audit-progressive-disclosureAudit progressive disclosureRead-only progressive-disclosure audit of agent instruction markdown: grades file and context loading across always-loaded, invocation-loaded, on-demand tiers; flags split, hub-and-spoke, disclosure defect. Use when 'progressive disclosure', 'split this file', 'too much context'. Not for noise: /docs-hygiene:audit-noise; QA: /skill-quality:check. Load it before advising what in a CLAUDE.md or rule stays loaded./compressCompress markdown (drop filler/hedging; keep directives, thresholds, examples; articles per compress_articles) with semantic-diff revert guard; default, audit/compare (read-only). Use when 'compress this doc', 'tighten markdown', 'cut prose'. Not for compaction: /compact, noise: /docs-hygiene:audit-noise, or SSOT: /docs-hygiene:extract-ssot./extract-ssotExtract SSOTDeduplicate repeated markdown (rule files, skill bodies, ADRs, docs) into one source of truth, migrating call sites to cite it by exact heading; below Rule of Three, offers non-abstracting remedies and refuses a new SSOT artifact. Use when prose, literals, or concepts recur: 'DRY this prose', 'extract a shared rule', 'single source of truth for X'. Load it before planning one place for text copied into files. Load it too when a rule pasted into several files should change in one place, or a user proposes a new shared file for it./rename-referencesRename referencesSweep stale references after rename (slash-token, path, chain prose, table row, frontmatter glob grep misses); audit rename, preview, blocklist. Use when 'rename X to Y', 'find stale refs', 'after git mv', I renamed skill/X, sweep references, broken refs, pre-PR rename check. Not for casing rules: /docs-naming:audit-file-names (if enabled).Other plugins' skills for the same job