/docflow:auditfrom docflow
Audits a documentation-led repo against its own conventions: ADR numbering, INDEX sync, plan/coverage, required sections, status validity, cross-references, language mandate, privacy leaks, cross-worktree collisions, and cross-repo federation checks. Reports a punch list and offers to fix mechanical issues.
Ships in docflow. 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.
Check a documentation-led repo against the conventions it declares.
This is the enforcement AGENTS.md cannot guarantee on its own.
Confirm the repo is bootstrapped.
Read CONVENTIONS.md to learn what to enforce: the ADR shape
scheme — a single shape, two shapes declared by a shape: field in
each ADR's metadata block (no number boundary is recorded and none is
read), or the legacy range encoding described in item 4 — status
lifecycle, integration model, multi-agent mode,
language mandate, optional artefacts present (GLOSSARY, domains/),
the canonical glossary shape recorded in §Glossary (optional heading
and prose, then one Term | Definition table),
and any Q10 domain hard rules, and the artefact root (default:
repository root) — resolve adr/, plan/, INDEX.md, _agent/ against it and
honour it in the cross-reference and INDEX-sync checks.
If a federation.md exists, this repo is part of a multi-repo
product. Note its Role (central / home / coordinator
index-holder, or a plain member) and read the recorded identity
scheme; the cross-repo checks (check 12) run from the index-holding
repo.
Legacy range encoding. Some two-shape repos were scaffolded before the shape became a declared field and encode it in the number instead: capability ADRs below a cutoff, technology ADRs at or above it, and the technology template sitting at the boundary as a pseudo-ADR. Two signals identify it, and either one alone is enough:
CONVENTIONS.md §ADR Shapes records a cutoff — a capability range
and a technology range rather than a shape: field; oradr/ holds a template file numbered other than 0000 (e.g.
adr/0100-template.md, or whatever boundary the project chose).Treat the two as one condition, not two findings. When it holds the catalogue is valid, not broken — it predates the declared field. Run the checks below under the legacy rules noted against checks 1, 2 and 4, so a repo that passed before keeps passing, and report the single finding of check 15. A migration onto the declared field is offered in Step 4; nothing is rewritten here.
Report each as PASS / FAIL / N/A with specifics (file + line where relevant):
Templates are not decisions. Every check that walks the catalogue
excludes each adr/0000-*.md file — 0000-template.md and, in a
two-shape repo, 0000-template-technology.md. They are never numbered,
indexed, plan-covered, or section-checked as ADRs. Under the legacy
range encoding the boundary-numbered template is excluded in exactly
the same way: it is a template, not the first technology ADR.
Numbering. ADR filenames contiguous, zero-padded, no gaps, no
duplicates — one sequence for the whole catalogue, whatever each
ADR's shape. Flag any template numbered other than 0000.
Legacy encoding: apply the range rules exactly as they stood —
numbering contiguous within each block with no duplicates, the
gap at the cutoff expected rather than flagged, capability ADRs below
the cutoff and technology ADRs at or above it, and the
boundary-numbered template neither flagged nor counted as an ADR.
INDEX sync. Every ADR appears in INDEX.md; every INDEX row has
a matching file; metadata fields (status, title, date) agree. In a
two-shape repo the table carries a Shape column and its values
agree with each ADR's shape: field (an absent field reads as
capability); a single-shape repo has no such column.
Legacy encoding: the table carries no Shape column — shape is read
from the range — so do not flag its absence.
Plan coverage. Every Accepted ADR has a plan/todo/ item;
every Implemented ADR has a plan/done/ entry. Flag orphans both
ways. After a range migration, resolve an unchanged done entry's old
identity through the migration commit's recorded old-to-new map before
checking coverage. Cite that commit and pair; do not require history to
name today's number. Bind the full old path in the pre-migration tree
to the mapped current file using that commit's tree/rename evidence;
an equal number or title alone never establishes identity. A different
filename sharing the old prefix gains no exemption. Missing mapping or
tree evidence is unverifiable, not proof
of coverage. Unrelated or unmapped missing entries remain findings.
Section completeness. Each ADR has the required sections in the
order its declared shape mandates — read the shape: field:
capability, or an absent field, means the capability order
(Context, Capability statement, User stories / scenarios, …);
technology means the technology order (Context, Decision,
Rationale, Consequences, …). In a single-shape repo every ADR takes
that repo's one order. Flag any shape: value that is neither
capability nor technology. A shape: field in a single-shape repo
is redundant, not wrong — report it as hygiene. Acceptance criteria
are numbered.
Legacy encoding: the shape is the ADR's side of the cutoff — below
it capability, at or above it technology — and no shape: field is
expected. Validate the section order against that, exactly as before,
with the one carve-out the encoding forces and these repos record for
themselves: an ADR below the cutoff that CONVENTIONS.md names as a
documented exception — typically the ADR adopting the method,
which is technology-shaped but has to be first in the sequence — is
checked against the technology order, not flagged. A mismatch the
conventions do not record is still a finding. A shape: field
contradicting the range is a real inconsistency; one agreeing with it
is hygiene, not a failure.
Status validity. Every status: is in the declared lifecycle.
Superseded ADRs name a successor in superseded-by:; the successor
names them in supersedes: (symmetry).
Revision/Approvals. Revision History present; Approvals populated
for ADRs at Accepted or beyond.
Cross-references. Relative adr/NNNN-*.md links resolve to real
files. Glossary anchors (if used) resolve. Preserved plan/done/ entries
and historical commit messages or tags are checked in their historical
context. A retired path explained by the migration commit's old-to-new
map and the full file-identity evidence from check 3 is not a dangling
active link; cite the evidence instead of rewriting
history. This exception never excuses an unresolved current ADR, INDEX,
domain listing or todo reference.
Language mandate. If set, spot-check user-facing docs for the required spellings.
ADR-privacy leaks. Grep source / product directories for ADR
identifiers in user-visible strings — patterns like ADR 0042,
adr-0042, see ADR, ADR titles — in UI copy, API responses,
error messages, customer-facing logs, public docs, release notes.
Report each suspect; this rule is easy to violate by reflex.
Coordination hygiene. _agent/ is the agent operating
contract — who writes what, the one real mutex, and how an
unattended run behaves — and holds nothing git already records.
N/A if the repo has no _agent/ directory (a valid state: a single
writer that is not eligible for the run prompt has none). Otherwise
read the recorded coordination mode. First recognise the legacy marker set
below: it gets one non-failing migration-available finding, and its
recorded hygiene rules remain active until migration. Modern-only file
and derived-state failures below do not duplicate that finding. Check:
prompts/autonomous.md and nothing else. Shared checkout:
ROLES.md, LOCKS.md, prompts/autonomous.md. Separate
worktrees: ROLES.md, prompts/autonomous.md — no lock ledger,
because the branch and its pull request are the claim.
prompts/autonomous.md is prescribed only where the repo is
eligible for it — a recorded verify gate and the plan/todo/
queue the prompt walks. A prompt in a repo with no plan queue is
an unprescribed file: report it, and say the fix is to add the
queue or drop the prompt. Under a single writer, no eligibility
means no _agent/ directory at all. Fail on any other file
under _agent/, and on a
prescribed file the mode does not allow (a lock ledger in
separate-worktree mode, a roles list under a single writer)._agent/ file
whose content duplicates what git, the queue, or the live
branches already say: a log of shipped items, an in-flight or
per-worktree table, a snapshot of branch or queue state ("active
branch", "last shipped", "next item"), or a clause telling the
reader that git wins where the two disagree — that clause is the
file admitting it is a stale copy._agent/LOCKS.md is a live mutex until there is evidence its
owner has finished or abandoned it. Writers claim a file before
editing it, so a claim with no pending change is the normal state
of a writer preparing an edit — never infer staleness from an
absent diff alone. Evidence must be tied to this claim, never
to the actor's history on the file — writers reuse files across
tasks, so a commit older than the row proves nothing about it.
Evidence is one of:
git worktree list for the
worktrees on this machine, the remote branches matching the claim
convention (claim/<item-key>, the queue file name without its
extension), and open pull requests, draft or ready, where a pull-request
host is reachable. Then check it:
WORKLOG.md, worklog/, CURRENT_FOCUS.md,
IN_FLIGHT.md, HANDOFF.md, a merge=union attribute for the
worklog, or a .gitignore entry for the snapshot — report them
as one finding naming the layout and every file in it, not
one finding per file, at non-failing migration available severity.
Include a mode-inappropriate ROLES or LOCKS file as a marker too.
Offer the coordination migration below. Separately offer evidenced
stale-content cleanup; keep valid legacy rules if migration is declined.Cross-worktree collisions (repos that record several writers on separate worktrees, or any audit that spans unmerged branches). These catch semantic conflicts that a line-level git merge cannot, and all three are FAIL, never hygiene — each one merges clean and lands an incoherent catalogue:
plan/todo/ items, (across branches/worktrees) claiming the same
NNNN. Distinct from check 1, which only sees one tree. This is the
collision the concurrency guardrails (G2 pre-merge / G3 gate) guard
against; flag it so the later author renumbers.plan/todo/ items naming the
same owning ADR for the same scope, i.e. two worktrees building
the same thing.merge=union would concatenate them silently.
Cross-check against the identifier blocks the wave reserved — read
them from each branch's pull-request description, or its first commit
message under direct-to-main, and from the claim branch each worktree
pushed. Every collision should correspond to a writer working outside
its reserved block or editing an artefact another claim names. There
is no file to cross-check against: the blocks are stated where the
work is.Cross-repo (federation) checks — only when a federation.md
exists; run from the index-holding repo (Role: central, home,
or coordinator — whichever holds federation-index.md). Reach each
member through the local checkout named in federation-index.md. A member not checked
out locally is reported "unverified this run" — never silently
passed, never a hard failure.
federation.md back-pointer to this index-holder, and
every repo whose back-pointer names this repo is listed in the
index. Flag either half-edge (in-index-without-back-pointer, or
points-here-but-unlisted).repo-id + local number, so the only reachable collision is a
duplicate repo-id. Flag any repo-id that appears on more than
one federation-index.md row or in two members' federation.md
back-pointers.repo-id → Pointer → adr/NNNN-*.md — look up the repo-id's
Pointer in federation-index.md, then the ADR file under that repo.
A repo-id with no index row is a dangling reference. If the row
exists but the checkout is absent, report it "unverified this
run" (not dangling); only an absent ADR in a present checkout
is a true dangling reference. (Same-repo relative links are
check 7.)INDEX.md
metadata; flag rows that are stale, missing, or extra.Coverage (undocumented developments). A heuristic nudge, not a
precise diff: scan the major modules / top-level source directories and
the recent git log for substantial behaviour or an area with no
owning ADR — a large feature, subsystem, or dependency the catalogue
never records. Report each as a prompt to capture it (reconstruct
the decision as an Implemented ADR + plan/done, per the backfill
path), not as a hard failure. Because the audit is doc-centric, keep
this conservative — flag clear, sizable gaps, not every file.
Artefact-root discovery. If a .docflow file exists at the
repository root, its root: line must agree with the artefact root
recorded in CONVENTIONS.md, and it must not redundantly name
.docflow/ (the directory is its own marker — flag the file for
removal). If the artefact root is not .docflow/ and no pointer
file exists, surface it as an offer to add one (external tools
discover the catalogue through it) — never as a hard failure;
migration is offered, not forced.
Legacy shape encoding. N/A unless Step 0 item 4 holds. When it
does, report exactly one finding at severity migration
available: name the signal(s) that identified the encoding (the
cutoff recorded in §ADR Shapes, the boundary-numbered template file,
or both), state that the catalogue is valid and passing under the
range rules, and say that a complete mechanical migration onto the
declared-field scheme is available (Step 4). Never split it into a
second finding — a template numbered off 0000 and a recorded
cutoff are the same condition — and never fail the audit for it.
Item status and reports. Surface every nonempty Stopped field for human attention. Modern queued items carry Claimed by / Blockers / Stopped; done entries carry no live Status section. Check that the Reporting convention and AGENTS pointer both exist or are both opted out, with the same heading/labels. Inspect accessible PR bodies, wave item/summary reports and stop records for Status at a glance, the three labels, exact gate outcomes and outstanding work. Missing/inconsistent blocks are drift; inaccessible reports are unverifiable. Draft PRs may report verification as not run; they must never imply success.
Glossary structure. N/A when GLOSSARY.md is absent — an absent
optional layer is valid and the audit must never create one to satisfy
this check. Otherwise read CONVENTIONS.md §Glossary and inspect what
rule it actually declares, not merely whether the section exists.
A repo can carry a §Glossary that states an older or unrelated glossary
convention; that is not adoption of this canonical table. The canonical
rule is the one this product records: an optional H1 heading and optional
introductory prose, then exactly one two-column table whose header is
Term and Definition, with every entry as its own row. PASS only
when the file is a single canonical table with optional heading/prose, no
term recorded as a heading, bullet or paragraph, and no duplicate
term. Check the duplicate condition as part of the pass test, not after
it, so a canonical table that repeats a term can never report PASS.
<a id="alpha"></a>Alpha and a plain Alpha row
count as the same term. There is no mechanical fix: a duplicate
needs user resolution, is never merged automatically, and is never
counted as clean.GLOSSARY.md migration and the proposed
§Glossary replacement, and the repo may accept either or both. It
does not fail the audit or count as an issue.In every non-canonical case, name any entry whose mapping cannot be preserved without guessing and mark it for user resolution; those are never migrated automatically, and where lossless preservation (for example a heading anchor an incoming link points at) is uncertain, stop for resolution instead of guessing.
Translate the audit verdict into the closing block's Overall vocabulary: verified when all required checks pass; a non-failing migration offer or optional hygiene finding alone does not lower that status. Use partially verified or failed for unresolved failed checks, and blocked or unknown when required evidence is unavailable. Keep the issue count, severity and optional next steps in the explanation, not in place of that status value. Overall covers the complete requested audit, including unrelated findings; do not label it "verified for the migration" while another required check fails. Put the successful migration outcome under This run instead.
Lead with a one-line verdict (clean / N issues). Then the punch list, grouped by severity: blocking (privacy leaks, status/lifecycle violations, broken cross-refs), drift (INDEX out of sync, missing plan files, duplicate glossary terms, or a non-canonical glossary whose §Glossary declares the canonical table it drifted from), hygiene (evidenced stale locks, uncertain lock rows awaiting confirmation, formatting), and migration available (a superseded scheme the repo can move off — check 15 — or a non-canonical glossary with no §Glossary rule, or one whose §Glossary declares a different glossary rule — check 17). A migration-available finding does not count towards the issue count in the verdict and never makes the run dirty: a repo whose only finding is that one is clean, with a migration available.
Offer to fix the mechanical issues automatically: regenerate
INDEX.md, create missing plan/todo stubs, clear the lock rows check
10 found evidence for, prune the stale worktrees and delete the leftover
claim refs check 10 named, fix broken relative links. A worktree is
pruned only on a confirmation naming it — it may hold uncommitted
work — and a claim branch is deleted only where its item has shipped or
the operator says the work is abandoned. For shipped claims, follow
ship-item's cleanup protocol using the source verified for integration;
preserve the claim if that source is unavailable or the ref has changed.
For explicitly abandoned work, lease deletion against the exact tip covered
by the operator's confirmation; a later tip requires fresh confirmation.
Only rows with
that evidence are clearable: clearing a live claim in a shared checkout
removes another writer's only mutex and lets two writers edit the same
file. Uncertain rows are listed for the operator to confirm one at a
time and are never included in a "fix everything" confirmation. Do not auto-edit ADR content, rewrite
acceptance criteria, or remove suspected privacy leaks without the
user confirming each — those need judgement. Commit fixes as
fix(adr): ... / docs: ... with a Rationale: footer where an ADR
is touched.
The glossary migration is not one of these mechanical fixes: never
bundle it into a "fix everything" confirmation, never convert a glossary
without the concrete diff and explicit consent in Step 5, and never create
an absent GLOSSARY.md to satisfy the check.
If check 15 fired, offer the legacy range migration here too — as its own offer, separate from the mechanical fixes above, and never bundled into a "fix everything" confirmation. Step 4 is the procedure.
The migration is offered, never forced. A repo that declines keeps the range encoding, keeps passing under the legacy rules, and is offered again on the next audit. Nothing below is written without the confirmation in 4.2.
Compute the map and show it before touching a single file:
0012 and
technology ADRs 0101, 0102, 0104, the map is 0101 → 0013,
0102 → 0014, 0104 → 0015. Order is preserved; gaps in the old
technology block are closed, not carried over.shape: technology, which is what retires the exception
clause in step 6. Renumbering it would churn the one number every
early commit cites, for nothing.Render the map as an old → new table with each ADR's title, then list
what follows from it: every depends-on, supersedes /
superseded-by, relative adr/NNNN-*.md link, INDEX.md row, domain
README.md listing, and plan/todo/ owning-ADR reference that names a
moved number; the boundary template replaced by
adr/0000-template-technology.md; §ADR Shapes rewritten to the declared
field. Say plainly what is not touched: entire plan/done/ entries, commit
messages, tags, and any reference from outside the catalogue. Those are
history, and history is not rewritten.
Ask for an explicit confirmation of that map. Write nothing without it. Acceptance of the audit report is not acceptance of the migration: ask for it as its own question, and take silence or ambiguity as a no.
git mv each moved technology ADR to its new number, keeping its
slug. Capability files do not move.adr: metadata field and the H1
heading to the new number.shape: on every ADR — the shape each one actually
has, not the block it came from. technology on the moved ones and
on the documented exception that stayed (4.1); capability on the
rest. Stamping the exception capability because it did not move
would put the field at odds with its sections, and the check in 4.4
would fail the catalogue the migration just produced. Write the field
explicitly on all of them: it is the encoding now, and a catalogue
carrying it on only half its ADRs is still readable but no longer
self-describing.depends-on:,
supersedes:, superseded-by:, relative adr/NNNN-*.md links in
any ADR body, INDEX.md rows, domain README.md listings, and the
owning-ADR line — and any other relative ADR link — of every
plan/todo/ item. Rewrite by resolved
identity, not by text search alone — a bare 0101 in prose may be a
quantity, and a number that did not move must not be touched.adr/0000-template-technology.md in its place — the technology
template, shape: technology pre-filled. adr/0000-template.md
stays as the capability template; no template carries any other
number afterwards.CONVENTIONS.md §ADR Shapes to the declared-field form: two
shapes named by the field, an absent field meaning capability, one
contiguous sequence with no boundary, both templates numbered
0000, and a Shape column in INDEX.md. Delete the cutoff, and
delete any clause recording the seed ADR as an exception to the
range — under the declared field the seed is simply
shape: technology, and there is nothing to except. If AGENTS.md
mirrors the section, give it the matching shape hard rules.INDEX.md from the new metadata, with the Shape
column.Rationale: footer the
repo's git contract requires for ADR changes.Re-run Step 1 with the legacy rules off: one contiguous sequence,
each ADR's sections matching its declared shape, a Shape column whose
values agree with the fields, every active relative link resolving, and no
template numbered other than 0000. The catalogue must pass with no
manual edit. If anything fails, the migration is incomplete — finish
it in the same commit rather than leaving a half-migrated catalogue,
which is the one state neither rule set describes.
Preserve every plan/done/ file byte for byte. Resolve its historical
identity for coverage and reference checks using the commit map, as checks
3 and 7 prescribe. A decision's preserved rationale describing the former
scheme is historical context; only the active shape rules and metadata
change. Do not treat this required preservation as an incomplete migration.
This is a separate, consented offer. Like the range migration it is offered, never forced, and it rewrites nothing without the explicit confirmation in 5.2. Accepting the audit report is not accepting this migration; a decline keeps the file byte for byte and never adds a second shape, and the offer returns on the next audit. When the declared §Glossary itself states an older glossary convention, the offer covers the rule and the file together: the repo may accept the file migration, the rule replacement, both or neither, and declining any part leaves that part unchanged.
Render the exact change before touching the file:
Term | Definition row. Compare
the result against an explicit ordered list of the original entries and
prose: every term and its complete definition wording is preserved
verbatim — do not recase, reword, summarise or reorder an entry. Only the
structural escaping (a literal pipe as \|, a hard break as <br>) and
the table packaging change;## Glossary section as a second, labelled
part of the same diff, and state plainly that it is a separate choice;## Delivery, or an H1 term heading after the optional # Glossary
title) exposes an anchor (#delivery) that other files may link
to. Converting the heading to a table row removes that target, and
preserving the link text alone is not enough. Keep the exact existing
slug as an explicit anchor on the row (for example
<a id="delivery"></a>Delivery), using the slug the heading already has
rather than recomputing it. List every heading entry and the incoming
links that reach it in the dry run, and if an anchor cannot be preserved
— an unknown or ambiguous slug, a link that targets a fragment the file
never defined, or two headings that collide — stop and flag it for user
resolution instead of guessing;\|, and keep a genuinely multiline
definition in one cell with <br> rather than extra rows;State plainly that nothing has been written. This is a Markdown shape change only; it introduces no parser or dependency.
Ask for an explicit confirmation of that diff. Write nothing without it; take silence or ambiguity as a no. If the user declines, keep the file untouched, report the declined migration, and add no alternative shape.
On confirmation, rewrite the file to the canonical structure exactly as
shown, preserving every term, its exact definition wording, the entry order,
all meaningful prose, and every heading anchor an incoming link resolves to.
If the accepted diff also replaced the declared §Glossary, write that
replacement in the same commit; if the rule was declined, leave
CONVENTIONS.md unchanged. If any entry or anchor cannot be
preserved losslessly — including an anchor target the dry run could not
confirm — stop and flag it for user resolution rather than committing a
partial migration. Commit once with a docs: or fix:
Conventional Commit whose message names the glossary migration; add the
Rationale: footer only if the repo's git contract requires it for the
files touched. Then re-run check 17: the file must pass as canonical with
no manual edit. A half-migrated file is the one state neither shape
describes — finish it in the same commit.
This is independent of range-number migration. Recognise any legacy worklog file/directory, IN_FLIGHT dashboard, CURRENT_FOCUS snapshot, HANDOFF, mode-inappropriate ROLES/LOCKS, worklog union attribute or snapshot ignore entry. Do not combine its report with unrelated semantic failures.
Name checked scope, unresolved findings, inaccessible evidence and any applied fixes.
End every run, including blocked, failed and stopped runs, with a section headed exactly Status at a glance, containing these three labels:
Routine progress messages need no block. Keep final results brief and distinguish work prepared on a PR from work confirmed shipped.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub evolvehq/docflow --plugin docflow14 skills in this plugin
/add-conventionAssess and add a CONVENTION (a reusable rule, practice, or naming/process standard) to a documentation-led repo — decides FIRST whether it is worth codifying at all, then routes it to the right home (AGENTS.md hard rule, CONVENTIONS.md guidance, GLOSSARY term, or to /new-adr if it is really a one-off decision). Pushes back on premature or duplicate conventions. Use when the user says "add a convention", "make this a rule", "document this practice", "we should always X", or invokes /add-convention. NOT for recording a single architectural/product decision (use /new-adr) and NOT for queueing work (use /new-plan)./agent-waveRun a bounded wave over the plan/todo queue in a documentation-led repo, using available parallel agents or sequential execution. Establishes width, budget and supervision; isolates work and collects verified outcomes. Use for "spawn a wave of agents", "run the queue in parallel", "fan out the work", or "agent wave", not for authoring a decision or queuing a new item./bootstrapScaffold or retrofit documentation-led conventions (AGENTS.md, CLAUDE.md, CONVENTIONS.md, ADR catalogue, plan/ queue, _agent/ coordination) into a repo. Use when the user asks to "set up conventions", "bootstrap ADRs", "scaffold the documentation-led layout", or "add AGENTS.md and a plan queue". Works on fresh repos and existing ones — preserves existing content and merges rather than overwrites. Opens with an express / guided / full depth choice, so a quick conservative setup needs almost no questions.Other plugins' skills for the same job