[Adam''s Skills] Sorts a repo''s docs with one test: could an agent get this by reading the code? Docs that pass the test stay in a fixed home (ADRs, the glossary, docs/agents/, contracts, human runbooks, or a doc kept on purpose and marked once). Plans, designs and research move to the issue tracker verbatim, are read back, and only then are deleted. How-it-works docs are deleted, ADRs holding several decisions are split, and every link to a removed doc is repointed. It proposes one batch, a...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Docs Audit?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adamlinscott-docs-audit)
---
name: docs-audit
description: '[Adam''s Skills] Sorts a repo''s docs with one test: could an agent get this by reading the code? Docs that pass the test stay in a fixed home (ADRs, the glossary, docs/agents/, contracts, human runbooks, or a doc kept on purpose and marked once). Plans, designs and research move to the issue tracker verbatim, are read back, and only then are deleted. How-it-works docs are deleted, ADRs holding several decisions are split, and every link to a removed doc is repointed. It proposes one batch, applies it after one approval, and commits once without pushing. A whole-repo sweep goes on its own branch and worktree. On the Simple install it covers only the docs the person wrote or changed. Use when docs/ has grown, when agents follow plans or stale docs over the code, or when /are-we-done offers the audit chain.'
allowed-tools: Read, Grep, Glob, Bash, Edit, Write, AskUserQuestion, Agent, Skill
---
# docs-audit
Agents treat a repo's docs as truth, and a stale doc beats the code. In Xu & Wu
([arXiv 2610.30571](https://arxiv.org/abs/2610.30571)), 90.1% of agents' choices followed a stale
instruction file over the code; Claude Code named the conflict in 79 of 80 runs and followed the
file anyway. A plan in `docs/` is worse than a stale description: an agent reads "we will do X"
as "X is how it works". Every doc also costs reading time in every session that opens it.
Good looks like a `docs/` an agent can trust: each file holds something the code can't show, and
its name says whether to open it. Everything else lives in the tracker, where a plan is a plan.
The user decides what only they can know: whether an ambiguous plan was built, where a doc that
fits nowhere goes, whether to keep a doc on purpose, what to do with a doc holding a secret, and
the one approval for the whole batch.
Commands, templates and layouts: [REFERENCE.md](REFERENCE.md).
## The one test
**Could an agent get this by reading this repo's code?** If yes, the doc goes. If no, it stays,
but only in one of these homes:
- `CONTEXT.md`: agreed terms, the glossary.
- `docs/adr/NNNN-slug.md`: one decision and its why. A change is a new ADR naming the one it
extends or supersedes.
- `docs/agents/`: configuration other skills read, such as `docs/agents/issue-tracker.md`.
- A contract with code outside this repo (`docs/contracts/`).
- A human procedure for a system the code doesn't describe (a hosting runbook).
- Any other doc the user keeps on purpose. It is marked once, so the next run doesn't ask again:
frontmatter `docs-audit: keep` and `docs-audit-reason: <why>`, merged into any existing
frontmatter; keeping a folder marks each file in it; an `.html` file gets a first line
`<!-- docs-audit: keep — <why> -->`. A marked doc is still checked for broken references.
**What counts as a doc** is what the scan returns: tracked `.md`, `.mdx` and `.html` under `docs/`
at any depth (its READMEs included), root `CONTEXT.md`, and loose markdown at the root. The root
README and its translations (`README.*`), LICENSE, CHANGELOG, CONTRIBUTING, SECURITY,
CODE_OF_CONDUCT, module READMEs and docs-site trees are not docs here; neither are CLAUDE.md,
CLAUDE.local.md, AGENTS.md and GEMINI.md, which `/context-audit` owns. Links in any of them to a
removed doc are still repointed.
**A doc too large to check** (the scan's `skipped: "too large"`, over 5 MB) has no references,
readers or secrets in its entry. It is held: never filed or deleted, and named in the batch as too
large to check.
## What happens to a doc that fails the test
| Kind | Where it goes |
|---|---|
| Plan, design, spec or strategy for work not yet done | A new issue holding the full text, or a comment holding it on the open issue that already tracks it (never replacing that issue's body); then the file is deleted |
| Plan for work already built | The full text as a comment on the issue that tracked it. Built through several build issues or PRs with no plan issue: a new issue, closed at once, naming them; if code cites one of them next to the doc's path, a comment on that one. No issue at all: a new issue closed at once. Then deleted |
| Research or a point-in-time finding | The full text as a comment on the issue that asked the question (often named in the doc), else a new issue, closed at once unless the question is still open; then deleted |
| Read by code (the scan's `readByCode`: a test or module reads, imports or fetches it) | Kept and marked (`docs-audit-reason: read by <file:line>`), or moved to a home with the reading code updated in the same batch, as the user chooses. Never deleted while code reads it, because the code would break. The scan flags any string naming the doc, so open each hit: a path only shown in a message or held as test data is a pointer, not a read |
| How-it-works or code tour | Deleted. A gotcha it holds becomes one CLAUDE.md line or a comment at the trap |
| ADR with more than one decision | Split, below |
| Kept doc over ~8 KB holding several subjects, each of which could be named on its own | Proposed for a split into those parts. A contract or `CONTEXT.md` is split only on the user's yes, since other code cites it by path |
| Twin folders (`design/` and `designs/`) | Emptied, or left holding only marked docs |
| Fits nowhere (a pricing strategy, a GTM plan) | The user is asked where it goes |
The sizes are soft; the test comes first. The "could the code tell an agent this?" read is
judgement: make it yourself, or hand long or many docs to a `general-purpose` agent with each doc's
scan entry. Lookups it needs (where a named file or symbol lives, when the scan says `unchecked`)
go to the `scout` agent (`general-purpose` if it isn't installed, and say so).
**Built or not is decided on evidence**: the state of the issue the plan names, whether the files
and symbols it names exist (the scan's `refs`), and commits that reference its issue. Mixed or no
evidence means asking the user, because only they know. An unresolved symbol is a weak signal,
never proof by itself.
**An issue a doc names may not be that issue.** Issues get moved and renumbered, so a number in
an old doc can now be a PR or an unrelated issue, and `gh issue view` shows a PR without an error.
Before using a named issue, open it: it must be an issue (its URL has `/issues/`), and its title
must match the doc's question or plan. Otherwise search the tracker by the doc's title; if nothing
matches, ask. A named issue in another repo is a separate destination: state its visibility beside
this repo's and ask before filing there.
**Splitting an ADR.** A multi-decision ADR gets one new ADR per decision but one, each naming the
part it supersedes. The old ADR keeps the one decision its title names, worded as in its first
commit (`git log --follow --reverse`). If the title names more than one decision, or one its first
commit doesn't hold (the title was changed later), ask which decision keeps the number. Every other
decision, including others already in that first commit, becomes its own new ADR. A dated amendment that changes what was decided (a new
rule, a reversal, a different owner) is a decision of its own and is split out; one that only
adjusts detail inside the same decision (a count, an added example) stays. An ADR over ~3 KB with
one decision is trimmed of detail the code holds, not split. The old ADR keeps status `accepted`,
or `superseded by ADR NNNN` when a later decision reversed the one it keeps, and gains one line: "Later decisions split out: ADR NNNN–NNNN; full earlier text in <issue>". Its
full old text goes to an issue first. Each new ADR is `accepted`, its first line "Split from ADR
NNNN on <today>; decided <date>". The date is the one the ADR's text gives for that decision; if
it gives none, the oldest commit whose version of the old ADR already states the decision, in any
wording (read the versions oldest first; `git log -S` on today's sentence finds the last rewrite,
not the decision); if that commit only moved or imported the file, "decided by <date>". Detail the code
already holds is dropped. Citations are found by number as well as by link (the scan's
`adr-number` inbound); each is listed in the batch beside its matching new ADR. Only comments and
prose are citations: a hit inside a string literal, an identifier or test data is listed as "not
a citation, unchanged" and never edited. Clear citations are repointed, and the rest keep the old
number, which the stub forwards. Nothing that cited the old ADR stops resolving.
## Filing verbatim
The tracker copy is the only copy once the file is deleted, so it must be exact. The model never
retypes a doc: the `parts` command writes the header and the doc into body and overflow files on
disk, they are posted with `--body-file`, and each is read back and compared with `same`. A doc
over the tracker's body limit continues verbatim in numbered comments. An `@user` or `#N` in the
text notifies that person or links that issue once filed; the text is still filed verbatim, and
the batch just shows those mentions (the scan's `mentions`) before the approval.
Search for an existing issue first, by its `docs-audit source:` marker and then by title, and
again immediately before each create, so two runs don't file twice. Add to an existing issue
rather than duplicate it, unless it already holds this text: when a run's branch was never merged,
the doc is still here and its issue already has every part. Read the issue's body and comments
back and compare each part with `same`; if all match, post nothing and treat the doc as filed. A
body or comment that is the doc alone, filed earlier by hand without the header, counts too:
compare it with the doc file. Use
the repo's issue template when it has one.
**Secrets and visibility.** A pasted secret can't be taken back. A doc with a secret hit from the
scan is held for the user's call, whether it would be filed or kept: redact, file anyway, or keep. Redaction is the only exception to
verbatim, and the redacted copy is what gets filed and compared. The batch states the tracker's
visibility beside the repo's, so a private repo's runbook doesn't land in a public tracker unseen.
**Trackers.** Found the way `/raise-issue` does, in three states: reachable, found but
unreachable, none. When unsure, ask. The connection is checked with a read call before anything is
filed.
- `gh` and `glab` file, read back and delete automatically.
- Jira, Linear and others get each issue printed ready to paste, with its files to attach. A doc
is deleted only after the user confirms it is filed, because nothing here can read it back.
- Found but unreachable: the same printout plus the literal fix. Nothing is deleted.
- No tracker: the same printout plus one question asking where plans should go. Nothing is deleted
until a destination exists.
Once the tracker is confirmed, offer to record it in `docs/agents/issue-tracker.md`.
## The order is a safety rule
Follow it exactly. Every step guards the one before it from being undone.
1. **Uncommitted work is found before anything is filed.** If a doc in the batch, or a file the
batch edits (a README, CLAUDE.md, a commented code file), has uncommitted changes, ask about it
with the other questions in step 2, or hold it. Those changes are the user's and git can't
restore them, and finding them after filing would leave issues posted for a run that stops. On
a whole-repo run, check the tree the run started from as well as the new worktree, which is
always clean.
2. **Ask, then one approval.** Ask only the questions whose answer depends on the user, then show
the whole batch and take one approval: apply all, apply with changes, or not now. Nothing is
filed and no existing file is changed before it.
3. **File** every issue and comment.
4. **Read each one back** and compare with `same`. A mismatch holds that doc; it is not deleted.
5. **Only then change files.** A doc whose text isn't verifiably in the tracker is never deleted.
6. **Branch first.** On the default branch, create a branch before the first change. A whole-repo
run always works on a new `docs-audit/<date>` branch from the default branch, in its own
worktree beside the repo, so a repo-wide purge never lands in a feature PR. That worktree is
made before the scan, so the batch describes the default branch. It is the one thing made
before the approval: it touches no existing file, and on "not now" it and its branch are
removed (REFERENCE §6). The batch also lists other branches that touched the removed or split
docs. Other runs stay on the current branch.
7. **Delete with `git rm -- <paths>` as its own command**, never chained with other work.
8. **Then the new and edited files**: split ADRs, split docs, keep markers, gotcha lines, and
every inbound link to a removed or split doc (READMEs, other docs, CLAUDE.md, code comments)
repointed to the issue or new ADR, or removed. So is every mention of a folder the batch
empties (README tables, CLAUDE.md), found with `git grep -n "docs/<folder>/"`, since the scan
reports links to files only. CLAUDE.md edits are listed in the batch.
9. **One commit of exactly the batch's paths**, naming the issues. Never skip hooks; a failing
hook stops the run. **No push**: that stays with the user's normal flow.
10. Print the summary, with the token line.
## Scope
- **Run directly:** the whole repo.
- **Run from `/are-we-done`'s chain:** the whole repo when the `docs` audit is due (`audit-runs
get`, over 7 days or never); otherwise the docs this branch added or changed against the default
branch, plus the docs they link to.
- **Simple install** (the install track file says `simple`): only the docs the person wrote or
changed, from their own commits plus uncommitted files. Never a whole-repo sweep, and the 7-day
rule doesn't apply, because a person who doesn't read code can't judge a repo-wide purge. Write
the batch and questions in plain words there, keeping the real names.
## Close
**The token line.** One before/after line for the docs in scope, in estimated tokens. It shows the
payoff, and on later runs any regrowth. A declined batch still prints it, with the after figure
marked as projected.
**Mark the run.** After a whole-repo run, applied or declined, run `audit-runs mark docs`, so the
7-day clock restarts. On the Simple track every run is the full run, so it marks the clock too.
Branch-scoped chain runs on the advanced track leave it alone; they didn't sweep the repo.
**Offer the other audits.** Memories and always-loaded context go stale as often as docs, and
mostly unnoticed. So end with one AskUserQuestion offering the installed ones: both (context, then
memory), memory only, context only, or not now. Recommend the ones whose clock is due
(`audit-runs get`), else not now. A yes runs them in that order. The one exception:
skip this offer when the run was started by `/are-we-done`'s chain, which already includes them.