/sd0x-dev-flow:pre-pr-auditfrom sd0x-dev-flow
Runs a 5-dimension confidence audit before committing or opening a PR. Aggregates test quality, coverage, risk, and acceptance criteria traceability into a single score (0-100).
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.
Pre-deploy ultimate verification. Aggregates test quality, coverage, risk, and AC traceability into a single confidence index (0-100).
| Need | Use Instead |
|---|---|
| Code review | /codex-review-fast |
| Post-deploy runtime verification | /feature-verify |
| Periodic project health | /project-audit |
| Just run tests | /verify |
| Just check risk | /risk-assess |
auto-loop done → [user invokes] /pre-pr-audit → /smart-commit → /push-ci → /create-pr
↑
Pre-deploy ultimate verification
❌ git add | git commit | git push — per @rules/git-workflow.md
This skill audits and reports. It does not modify code or commit.
| Arg | Description | Default |
|---|---|---|
--mode fast|deep | Execution depth | fast |
--strict | Non-zero exit on ⛔ PR-Blocked | off |
--json | Machine-readable JSON output | off |
--base <ref> | Compare against ref | HEAD |
sequenceDiagram
participant U as User
participant PA as /pre-pr-audit
participant RA as /risk-assess
participant TR as /codex-test-review
participant CC as /check-coverage
participant ST as State / Artifacts
U->>PA: /pre-pr-audit [--mode fast|deep]
par Phase A: Collect
PA->>ST: [Background Agent] Read precommit/verify state (freshness)
PA->>RA: [Foreground — blocking] risk-analyze.js --json --base <base>
PA->>PA: [Background Agent] Detect changed files + map to tests
end
Note over PA,RA: A2 (/risk-assess) must complete before Phase B — Module Selection depends on top_affected
par Phase B: Targeted
PA->>TR: [Foreground] /codex-test-review (top-N risky modules)
PA->>CC: [Background Agent: coverage-analyst] /check-coverage (deep mode only)
PA->>PA: [Background Agent] AC trace (if request doc exists)
end
PA->>PA: Phase C: Aggregate + hard-fail + gate
PA->>U: Phase D: Report + confidence index
| Step | Dispatch | Action | Source |
|---|---|---|---|
| A1 | Background Agent | Read precommit gate state | node scripts/review-state.js check --format=json(installed copy first: .claude/scripts/review-state.js)— precommit.passed is content-addressed, so no separate freshness check; checker absent → report "no verdict source", never a pass |
| A2 | Foreground (blocking) | Run the /risk-assess analyzer for <base> | bash "${CLAUDE_PLUGIN_ROOT}/scripts/run-skill.sh" risk-assess risk-analyze.js --json --mode fast --base <base>, run from the audited repository (the runner is the plugin's, so its path is never repo-relative) — the JSON itself, not the skill's report, which omits fields needed here: base, risk_level, overall_score, dimensions.blast_radius.top_affected. Exit 1 (High) and 2 (Critical) are results, not failures. No parseable JSON, or a base other than <base> → /risk-assess is unavailable (Module Selection step 5) |
| A3 | Background Agent | Map the change inventory to test files | Inventory → match against test/ patterns |
Change inventory = git diff --name-only <base> ∪ git ls-files --others --exclude-standard. An
untracked module is part of the change; a plain git diff never lists it.
<base> is the --base ref, resolved once at the start (default HEAD) and used everywhere the
change is measured — A2, A3, Module Selection's supplement and its fallback. Measuring one of them
against HEAD while the audit was asked for --base main hides committed changes, and with them
the consumer and output paths § Key Evidence is about.
A2 MUST stay foreground: Phase B Module Selection depends on top_affected from /risk-assess output. A1 and A3 dispatch as background Agents and run in parallel with A2.
| Step | Dispatch | fast | deep | Action |
|---|---|---|---|---|
| B1 | Foreground | top-3 | top-10 + supplement | /codex-test-review on selected modules (see Module Selection) |
| B2 | Background Agent (coverage-analyst) | skip | ✅ | /check-coverage for pyramid balance |
| B3 | Background Agent | skip | ✅ (if request doc) | AC trace: parse ## Acceptance Criteria → map to test evidence |
B2 uses coverage-analyst agent (agents/coverage-analyst.md) for background execution. B3 dispatches as a background Agent for AC parsing. B1 stays foreground as the primary assessment.
dimensions.blast_radius.top_affected array (each: file + dependent_count)dependent_count descending, tie-break file ascending (stable sort)fast) or N=10 (deep)/risk-assess is unavailable, the change inventory sorted by lines changed, descending — git diff --numstat <base> (added + deleted), and for an untracked file its whole line countreferences/scoring-model.mdOutput report per references/output-template.md. Include:
The user-facing summary is what most readers see. It never reads better than the evidence:
| Rule | Detail |
|---|---|
| Final, not raw | The headline number is final_index (raw × cap). The raw score appears only beside its cap — raw 92 × cap 0.6 = 55 — never alone |
| Hard-fails stay on top | Any triggered hard-fail is named in the first lines of the summary with ⛔ PR-Blocked (hard-fail), whatever the score |
| Missing key evidence is listed | Every item of § Key Evidence that is missing appears under Not Verified, in the summary itself — not only in the findings |
| No readiness without key evidence | With any key evidence missing, the gate is at most ⚠️ PR-Caution, whatever the index |
| N/A is not a pass | A check is N/A only when it does not apply to this change. A consumer-path or output-path check that applies but has no evidence is missing: scored as a fail, not excluded. Missing test execution keeps the scoring model's own treatment (Static-only cap 0.6) and is listed as missing too |
| Short forms too | A one-line or --json summary carries the gate, the final index, the cap, the triggered hard-fails and the missing-evidence count (missing_evidence.length in --json) |
| Key evidence | Missing when |
|---|---|
| Test execution | No test run data for the current tree (Execution Integrity has nothing to read) |
| Consumer paths | A changed function, export, schema or CLI flag has callers or readers, and no test exercises the change through one of them |
| Output paths | The change alters something the system emits — a file, report, API response, event, exit code — and no test asserts on that output |
| Risk input | Module Selection used its line-count fallback: /risk-assess did not run, failed, or returned a different base |
| # | Dimension | Weight | Checks |
|---|---|---|---|
| 1 | Execution Integrity | 25% | All tests pass, precommit passed, HEAD freshness, no flaky indicators |
| 2 | Coverage Adequacy | 25% | Unit/Integration/E2E pyramid balance, per-module gap analysis |
| 3 | Test Quality | 20% | AAA compliance, naming, assertion depth, edge cases (per @rules/testing.md) |
| 4 | Risk-to-Test Alignment | 20% | High-risk files have tests, risk level ↔ test depth proportional |
| 5 | Evidence Governance | 10% | AC traceability, exception policy compliance, expiry check |
| Gate | Score | Sentinel |
|---|---|---|
| ✅ Ready | >=85 | ✅ PR-Ready |
| ⚠️ Needs attention | 60-84 | ⚠️ PR-Caution |
| ⛔ Not ready | <60 | ⛔ PR-Blocked |
Before the four exception checks sourced from the testing contract, Read @skills/test-review/references/testing-contract.md; if that Read fails,
stop the audit before scoring and report that no readiness verdict can be given — never emit a
PR-Ready, PR-Caution or PR-Blocked sentinel with the hard-fail checks unrun, and never judge
an exception from memory.
| Override | Condition | Source |
|---|---|---|
| Precommit stale | Not passed after latest edit | Auto-loop state |
| Prohibited domain exception | Security/data-integrity/regression AC uses manual exception | rules/testing.md § Evidence Model |
| Exception cap exceeded | Exception count > AC-count-based cap | @skills/test-review/references/testing-contract.md § Evidence Model |
| Expired exception | Past ISO 8601 expiry date | @skills/test-review/references/testing-contract.md § Evidence Model |
| Invalid reason class | Non-enum reason in exception | @skills/test-review/references/testing-contract.md § Evidence Model |
| Unverified exception | No Codex VALID_EXCEPTION verdict | @skills/test-review/references/testing-contract.md § Evidence Model |
| Evidence stale | Artifacts HEAD SHA ≠ current HEAD | Freshness check |
| Critical untested | /risk-assess HIGH+ on zero-coverage files | Risk alignment |
See references/scoring-model.md for formulas. Summary:
applicable_sum / applicable_count × 100round(raw × cap)⚠️ PR-Caution (§ Summary Integrity)references/scoring-model.md — Scoring formulas, weights, confidence capsreferences/output-template.md — Report format, JSON schema, sentinel strings@skills/test-review/references/testing-contract.md — exception gates, caps and expiry (hard-fail source)@rules/testing.md — evidence core and the domains that never take an exception (hard-fail source)@rules/testing-project.md — Project-specific overridesInput: /pre-pr-audit
Action: fast mode → collect state + risk → test-review top-3 → aggregate → 85/100 ✅ PR-Ready
Input: /pre-pr-audit --mode deep
Action: deep mode → collect + risk → test-review top-10 + coverage + AC trace → aggregate → 72/100 ⚠️ PR-Caution
Input: /pre-pr-audit (all present checks pass; the changed exporter's output file has no test)
Action: raw 96 × cap 1.0 = 96, but output-path evidence is missing → ⚠️ PR-Caution, "Not Verified: output path of exportReport()"
Input: /pre-pr-audit --strict
Action: fast mode → score 55 → ⛔ PR-Blocked → exit code 1
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub sd0xdev/sd0x-harness --plugin sd0x-dev-flow102 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/architectureArchitecture design and documentation. Produces 3-architecture.md with component diagrams, data flow, integration points, and architecture decisions. Reads existing tech-spec as input. Use when: designing system architecture, documenting component interactions, creating architecture docs, producing 3-architecture.md. Not for: tech spec writing (use tech-spec), code implementation (use feature-dev), architecture consulting only (use codex-architect)./askContext-aware Q&A with auto context gathering. Use when: user has a quick question about codebase, git history, rules, docs, or skills during development. Not for: code changes (use feature-dev), code review (use codex-review-fast), deep research (use deep-research), full code trace (use code-explore). Output: structured answer with source attribution./best-practicesIndustry best practices conformance audit with mandatory adversarial debate. Produces audit artifact: verdict (OK/WARN/FAIL) + gap roadmap + debate proof. Use when: auditing current implementation against industry standards, checking compliance with best practices, benchmarking implementation quality, verifying a codebase meets a standard. Not for: broad research/discovery without audit target (use /deep-research), code review (use /codex-review), architecture design (use /codex-architect)./bug-fixBug fix workflow. Use when: fixing bugs, resolving issues, regression fixes. Not for: new features (use feature-dev), understanding code (use code-explore). Output: fix + regression test + review gate.Other plugins' skills for the same job