/sd0x-dev-flow:doc-reviewfrom sd0x-dev-flow
Reviews .md and .mdx documents against a documentation contract with deterministic checks, batch processing, and a 5-dimension rating table. Use for tech spec audits, doc refactoring, and quality checks.
Ships in sd0x-dev-flow. 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.
Read first: references/documentation-contract.md — the split procedure, the
functional-document exemption and the comment-block exemption list that a review of a feature
document or a comment migration judges against (rules/docs-numbering.md and
rules/docs-writing.md are its resident cores). If that Read fails, stop and report it; do not
review from memory.
codex-code-review)test-review)| Command | Description | Use Case |
|---|---|---|
/codex-review-doc | Codex reviews .md docs | Document changes |
/review-spec | Review tech spec | Spec confirmation |
/doc-refactor | Streamline documents | Doc too long |
/update-docs | Research & update docs | After code change |
/codex-review-docTarget set → Deterministic checks → Resolve profiles + batches → Codex review per batch → Rating table + Gate → Loop
All changed documents (.md and .mdx) in one change are one review plan. The plan is the unit; it holds one or more
physical batches, and within the budget it is exactly one batch and therefore one dispatch. Reviewing
file-by-file is what this workflow replaced — it multiplied a three-file change into three whole-
document reviews.
| Condition | Action |
|---|---|
| Paths specified | Use them — all of them, as one plan |
| No path | Every path git status --porcelain=v1 -z --untracked-files=all --no-renames reports — staged, unstaged and untracked, both sides of a rename — filtered to the doc plane: the .md and .mdx suffixes, case-sensitive, as planeOf in scripts/lib/tree-digest.js decides. A status that fails is not an empty set: stop and report it |
| Nothing changed | Report it and stop; there is no document to review |
Never narrow a multi-file change to one file, and never ask the user to pick one. A file the plan
drops is a file nothing reviewed. A path staged in one version and left in another (status MM, AM,
MD, …) is two texts: the dispatch names it and the reviewer reads both git diff --cached -- <path> and
git diff -- <path>, because git diff HEAD shows only the work tree's.
The scripts this workflow names are the plugin's own, whatever the project keeps under scripts/: run
them from the plugin root ("${CLAUDE_PLUGIN_ROOT}/scripts/…"; scripts/… only in the plugin's source
checkout without the plugin loaded), with --root at the project. Two differ: the Step 5 checker takes
its installed copy first, then the plugin's, and scripts/lib/review-dispatch.js (Step 4) is a module —
require it from the plugin root and call decide(...); run as a command it prints nothing.
node "${CLAUDE_PLUGIN_ROOT}/scripts/check-doc-links.js" --root "$(git rev-parse --show-toplevel)" ./<changed document path> …
Run it from that root. The ./ matters: an argument that starts with -- is dropped as an option. Before
treating links as settled, checked must equal the number of paths passed. It reads the work tree, so for
a path with two texts (Step 1) its result says nothing about the staged one: the dispatch says which paths
those are, and the reviewer checks their staged links.
Resolves the repo-local file links it can classify, prints the ones that do not resolve, and
prints unresolved — how many link shapes it declined to classify. Heading fragments are out of
scope: [x](#frag) is dropped uncounted the way an external URL is, and [x](./a.md#frag) is
checked as a link to a.md alone. A dead #fragment is therefore not a finding this step
establishes, and the reviewer is free to raise one.
Scan only the paths that exist in the working tree. A deleted document (the resolver reports it
deleted: true) is omitted from this scan — passing it produces an unreadable failure that
hands the reviewer a defect when the deletion is the change. Its review copy is
git show HEAD:<path>, and the prompt says so per file.
Bash(node:*) and Task are in allowed-tools since review-loop-resilience (2026-08-23): the
fallback dispatch below names scripts/lib/review-dispatch.js and scripts/validate-family-sentinel.js
as steps of this workflow, and a named step should not stall on a permission prompt mid-review. The
earlier deliberate omission protected against unnamed node invocations riding a review's grant;
the boundary is now behavioural — this workflow invokes node only for the scripts its steps name
(the link check, the profile resolver, the dispatch decision, the sentinel validator, the state note).
Advisory input, not a gate: it always exits 0, and its output is fed to the reviewer as
findings already established so the LLM does not spend a pass rediscovering them. markdownlint
does not resolve links, so nothing else answers this.
Pass both fields to the prompt, and never failures alone. It is a scanner, not a CommonMark
parser — this repository ships zero dependencies — so failures: [] settles the link question only
alongside unresolved: 0. With unresolved > 0 that many link shapes went unchecked, and saying
"already settled" over them is the one way this advisory input can cost a review rather than save
one.
node "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-review-profile.js" --plan <plan.json|-> --root "$(git rev-parse --show-toplevel)"
Give it every collected path as one {"path": …} entry: the --files a.md,b.md form splits on commas and
trims each name, so it can send the reviewer to another file. Emits a per-file profile with the reasons it
is not shallower, plus the batch plan. The ## sections a shallow profile is confined to, and whether code
landed with the change, go in the same JSON document, of the same shape the resolver prints:
{ "tier": "standard", "code_changed": false,
"files": [ { "path": "docs/features/x/2-tech-spec.md",
"profile": "living-sync", "sections": ["3. Design"] } ] }
Three things this step decides, and none of them is negotiable afterwards:
record-diff exemption.First review: dispatch per @skills/codex-code-review/references/codex-transport.md § Start with the doc review prompt. See references/codex-prompt-doc.md.
Save the returned threadId — one per batch.
Loop review: dispatch per § Resume with the re-review template. See references/review-loop-doc.md — its Loop Rules carry the thread-rotation clause (central contract).
codex_fail → fallback carries the gate (adapter exit 1 only — @skills/codex-code-review/references/codex-transport.md § Completion state machine: a pending or unknown completion keeps the gate open with no fallback, exit 2 is a configuration error, and an alloc/cleanup failure is a lifecycle error) (@rules/auto-loop.md § Review Dispatch): decide via scripts/lib/review-dispatch.js (contract:'doc'), record [REVIEWER_FALLBACK] plane=doc_review from=codex to=contract-neutral-reviewer reason=<…> | <ISO8601> (sticky for this change), dispatch contract-neutral-reviewer via Task with references/codex-prompt-doc.md as the governing template — batch manifest, profiles and frozen file list included (P3 = one retry on a fresh instance) — and validate the raw report with node scripts/validate-family-sentinel.js doc before adopting the verdict (exactly one of ✅ Mergeable / ⛔ Needs revision, no foreign terminal). Fallback agents are stateless, so each loop round is a fresh dispatch. Carriers exhausted → no gate sentinel, behaviour-layer ⚠️ Need Human, nothing noted.
Stop cat-ing whole existing files into the prompt. Codex has sandbox access; the prompt carries the
file list, each file's profile, and what that profile says to read.
Organize results into rating table + severity-grouped findings + gate. One gate for the plan: a batch
that comes back ⛔ Needs revision blocks the plan.
The conjunction is behaviour-layer, and the state slot cannot hold it. The reminder state
(hook-lightweighting § 3.2) stores one doc_review note and a later note overwrites it — last
write wins, whatever an earlier batch said. Hold the conjunction yourself: fix and re-dispatch
every blocked batch (references/review-loop-doc.md § Loop Rules), and call the plan Mergeable
only when the latest dispatch of every batch passed — never because the final dispatch
happened to. Then self-note the plan's verdict once, not per batch:
CHECKER=".claude/scripts/review-state.js" # installed copy
[ -f "$CHECKER" ] || CHECKER="${CLAUDE_PLUGIN_ROOT}/scripts/review-state.js" # the plugin's own
[ -f "$CHECKER" ] || CHECKER="scripts/review-state.js" # source checkout, plugin not loaded
node "$CHECKER" note doc_review pass # every batch's latest dispatch passed
node "$CHECKER" note doc_review fail # any batch still blocked — increments the rounds count
The note is the declared-provenance record the reminder hooks read; it is advisory and binds to the current tree digest (a later doc edit re-opens the plane by construction). Record a verdict only after the gate has run and its result has been established for the current change. If recording fails, the report still stands; reminders, Git offers, and automatic commit or publish checks may continue to show the gate as open.
A plane pass needs the whole scope. A passing review of named files settles those files. Record a
new doc_review pass only when every doc-plane path it would vouch for was covered — the uncommitted
ones and those in commits a push would publish — by this plan, or by an earlier passing review of the
same content. A clean tree is not an empty scope: with two documents ahead, reviewing one covers one.
When the coverage is not complete, or not known, report the result for the files reviewed and leave
the slot alone; a pass already recorded at the same digest stays valid. This narrows pass only — a
blocking finding is noted fail as above.
Resolved by scripts/resolve-review-profile.js, never chosen by hand at dispatch time.
| Profile | Used when | Reviewer reads | Questions |
|---|---|---|---|
full-design | Design landing pre-implementation; unknown classification; security / data-integrity; any escalation | Whole changed document + linked design context | All five dimensions |
implementation-sync | Current-authority doc updated after code landed | Changed hunks + enclosing ## sections + preamble + link definitions | Does any reviewed section contradict the implementation? Is any affected cross-reference dead? |
living-sync | Current-authority doc, doc-only edit | Changed sections | Accuracy and internal consistency |
record-diff | Design / work / history record | Changed hunks | Is the edit internally coherent and correctly marked as a record? No code-alignment obligation |
executable | Instruction surfaces (skills/**, rules/**) | Changed sections + the file's own contract | Does the instruction still execute? Any conflicting directive? |
New (untracked) files are read whole under any profile — every line is new.
The profile narrows what the reviewer reads, never whether review runs, and no resolver
outcome auto-passes anything (Anchor Register #5, #6). Contract and escalation table:
docs/features/doc-review-phasing/2-tech-spec.md § 3.3–3.4.
| Dimension | Checks |
|---|---|
| Architecture Design | System boundaries, responsibilities, dependencies, extensibility |
| Performance | Bottlenecks, concurrency, caching, resource usage |
| Security | Data leakage, access control, input validation, error handling |
| Documentation Quality | Structure, completeness, accuracy, examples, docs-writing standards |
| Code Consistency | Pseudocode matches codebase, referenced files exist, technical accuracy |
⚠️ @CLAUDE.md auto-loop: fix → re-review → ... → ✅ PASS ⚠️
⛔ Needs revision → fix 🔴 items → /codex-review-doc --continue <threadId> → repeat until ✅ Mergeable.
The round budget is the tier's cap (fast — docs are the tier's primary case — caps at 6; an
explicit ## Max Rounds in rules/auto-loop-project.md overrides it, per rules/auto-loop.md
§ Tiers). Still failing at the cap → report blocker.
🔴 only. 🟡 and ⚪ are non-blocking: log them and proceed.
[NIT_DEFERRED] file:line | issue | reason: sub-threshold-doc | <ISO8601>
That tag and field order are a reporting convention — nothing parses or persists the line
(hook-lightweighting § 3.3: the nit-history store retired with the hook that owned it). The durable
record is the review report and the conversation, where the line is greppable; keep the fixed field
order for exactly that grep. references/codex-prompt-doc.md asks Codex for a ### Deferred Findings section so the report itself carries the deferrals.
Do not batch-fix 🟡/⚪ and re-review to confirm — that spends a round on findings the gate already declared non-blocking. The two exceptions are the same as for code (@rules/auto-loop.md § Sub-Threshold Findings): a one-line fix in a file already open, and a mis-marked security / data-integrity issue that should have been 🔴.
What counts as 🔴 is pinned in references/codex-prompt-doc.md § Severity Calibration — it is the reviewer prompt, not this file, that keeps the loop short.
| Change Type | Must Execute |
|---|---|
.md docs | /codex-review-doc or /review-spec |
| Tech spec | /review-spec |
| README | /codex-review-doc |
references/codex-prompt-doc.mdreferences/review-loop-doc.mdscripts/resolve-review-profile.js — profiles, escalation, batch planscripts/check-doc-links.js — advisory deterministic input. Reports failures
and unresolved: it is a scanner, not a CommonMark parser, and failures: [] settles the
link question only when unresolved is 0Input: /codex-review-doc docs/features/xxx/2-tech-spec.md
Action: Link check → resolve profile → Codex doc prompt scoped to the changed sections → Rating table + Findings + Gate
Input: /codex-review-doc
Action: Collect every changed .md → link check → one plan, one batch, one dispatch → Rating table + Gate
Input: /codex-review-doc (a 25-file feature folder)
Action: Resolver splits the plan loudly into batches, each within budget → one dispatch per batch → one consolidated gate
Input: Review this tech spec for me
Action: /review-spec → Check completeness/feasibility/risks → Output Gate
Input: This document is too long, streamline it
Action: /doc-refactor → Tabularize + Mermaid → Output comparison
What SKILL.md sets; muted values are Claude Code's defaults
Explore), in the background102 skills in this plugin
/adrWrite an Architecture Decision Record (ADR) for a feature — Context / Decision / Status / Consequences / Alternatives, filed as docs/features/<feature>/adr-<NNN>-<title>.md with a 3-digit zero-padded number. Handles the Superseded case: bidirectional linking when a new ADR replaces an old one. Use when: recording why an architectural approach was chosen, documenting a decision so it doesn't get re-litigated, marking a prior decision as superseded. Not for: feature-level technical design (use /tech-spec), task progress tracking (use /create-request), bulk backfill of historical decisions (a separate request — this skill writes one ADR at a time)./agentctl-setupInstall and set up the optional agentctl mod (task scope, refusal before execution, evidence that goes stale, model-free hand-over) — checks the environment, installs after approval, builds the first task line, optional deny rules, uninstall/architecturenpx claudepluginhub sd0xdev/sd0x-harness --plugin sd0x-dev-flowOther plugins' skills for the same job