Skip to content
Back to skills

Test Readiness

ASecurity

Orchestrates the full test-readiness pipeline (phases 1–5) for one repo, in its own worktree + branch. Runs test-inventory → test-design → test-migration → test-roadmap → test-fix in sequence, starting from the first stale artifact. Queued per repo by the admin system-cron scheduler; when all of the repo's phase artifacts are fresh it skips phases 1-4 but still files rows that were waiting on an approval. Records every run through the shared cron-run recorder. Requires `--repo org/repo`.

  • 16 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 2, 2026
ai-agentsgobashgit

Works with

  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add app-vitals/shipwright --skill test-readiness --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Test Readiness?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Test Readiness
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/app-vitals-test-readiness/badge)](https://www.skillsdirectory.com/skills/app-vitals-test-readiness)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: test-readiness
description: >
  Orchestrates the full test-readiness pipeline (phases 1–5) for one repo,
  in its own worktree + branch. Runs test-inventory → test-design →
  test-migration → test-roadmap → test-fix in sequence, starting from the
  first stale artifact. Queued per repo by the admin system-cron scheduler;
  when all of the repo's phase artifacts are fresh it skips phases 1-4 but still files rows that were waiting on an approval. Records
  every run through the shared cron-run recorder. Requires `--repo org/repo`.
argument-hint: "--repo org/repo [--full] [--publish] [--dry-run]"
---

# test-readiness skill

## Purpose

Drive the complete test-readiness pipeline from the first stale phase to
publication. This skill is the scheduler-facing entry point — it picks up where the
staleness guard left off and runs all necessary phases to bring the docs current.

It follows the system-cron contract in [docs/task-store.md](../../../../docs/task-store.md):
one task per repo, one run record per run (every count and metric lives there, via the shared
recorder in Step 5), artifacts that carry only detail (inventory rows, blueprint, migration
buckets, roadmap tasks — no refresh logs or count lines), a docs PR only on material change,
and follow-on tasks routed auto / review / plan by `/shipwright:test-fix`.

## When invoked

By a task the admin system-cron scheduler queues for each repo, whose prompt is
`/shipwright:test-readiness --repo {repo} --full --publish`. The flags below
decide what actually happens.

## Arguments

Apart from the required `--repo`, flags are additive — with no other flags the
run is staleness-gated with phase 5 in dry-run.

| Flag | Effect |
|------|--------|
| `--full` | Skip the staleness check entirely and run all phases 1→5 regardless of artifact freshness. Without it, the staleness gate decides the starting phase; when everything is fresh, phases 1-4 are skipped and only phase 5 runs. |
| `--publish` | The queue-for-real switch. Run phase 5 as a **real publish** — forward real-queue mode to `/shipwright:test-fix` so it writes task-store tasks unattended (no confirmation gate — test-fix never has one, matching entropy-fix/error-fix). Without it, phase 5 runs `--dry-run` (preview only, no task-store writes). |
| `--repo org/repo` | **Required.** The one repo to process. Naming a repo explicitly is the opt-in, so the `docs/test-readiness/` opt-in check does not apply. Finds the clone under `repos/` or clones it. The staleness gate still applies (unless `--full`), so a fresh repo skips phases 1-4 (phase 5 still checks for waiting rows). A missing `--repo` is a usage error (see Step 1). |
| `--dry-run` | Explicit preview: phase 5 runs `--dry-run`. This is the default when `--publish` is absent. |

## Staleness check

**Skipped entirely when `--full` is passed** (the scheduled default) — all phases
1→5 run. The check below only applies when `--full` is absent.

Before running any phase, re-read the phase artifacts (scoped to the current
repo/worktree — see Step 1) to determine the earliest stale phase. The
artifacts and their canonical paths (relative to the repo root):

| Phase | Artifact path |
|-------|--------------|
| 1 — test-inventory | `docs/test-readiness/test-inventory.md` |
| 2 — test-design | `docs/test-readiness/test-system.md` |
| 3 — test-migration | `docs/test-readiness/test-migration.md` |
| 4 — test-roadmap | `docs/test-readiness/test-readiness-plan.md` |

Threshold: 24 hours (default). If the file is missing or older than 24 hours,
it is stale. All phases from the first stale one through phase 4 run; phase 5
(publish) always runs — after phase 4 because the roadmap needs re-publishing, and
when every artifact is fresh because rows held for an unmerged test approach
(see Step 3) may now be approved.

## Process

The skill runs for exactly one repo, given by `--repo org/repo`. Steps 2-3 run
in that repo's own worktree + branch, Step 4 (Report) prints the summary, and Step 5
(at the end of this file) records the run.

### Step 1: Resolve the repo

`--repo org/repo` is required. If the invocation does not include it, print
the following and stop without scanning `repos/` or doing any work:

```
Usage: /shipwright:test-readiness --repo org/repo [--full] [--publish] [--dry-run]
```

Find the repo's clone by matching each `repos/*/`'s `git remote get-url origin`
against `org/repo`; if none matches, clone it
(`git clone https://github.com/{org}/{repo}.git repos/{repo}`). The local
directory is `repos/{dirname}`, which need not equal the `org/repo` string.
Naming the repo explicitly is the opt-in, so a repo without a
`docs/test-readiness/` directory is still processed. Step 2's staleness gate
still decides whether anything runs, so a fresh repo skips phases 1-4 (phase 5 still checks for waiting rows).

**For the repo, set up (or reuse) a worktree + branch and run Steps 2-4 there** — never edit `repos/{dirname}` directly (see this
repo's own root `CLAUDE.md` for the worktree convention).

**Open-PR supersession check (run first, before any branch is created).**
A prior day's docs-refresh PR touching the same `docs/test-readiness/*.md`
files may still be open — e.g. stuck on review, CI, or awaiting a human.
Branching fresh from `origin/main` every day regardless creates a second PR
competing for the same files; if the new one merges first, the stuck PR
becomes permanently unmergeable (confirmed: a same-pattern collision turned
an older open docs-refresh PR CONFLICTING once a newer one merged). Before
creating a new branch, query for an existing **open** PR on any
`docs/test-readiness-refresh-*` branch (any date, not just today) for this
repo:

```bash
gh pr list --repo {org}/{repo} --state open \
  --json number,headRefName,createdAt
```

`gh` has no glob support for head-branch matching, so filter the JSON result
client-side, keeping only entries whose `headRefName` starts with
`docs/test-readiness-refresh-`. This check is distinct from, and runs
**ahead of**, the same-day-reuse check below — it looks for *any* earlier-day
open PR, not just today's.

- **No matching open PR found:** fall through to the fresh-branch flow below,
  unchanged.
- **Exactly one earlier-day open PR found:** reuse that PR's branch instead
  of branching fresh. Check out the existing branch into a worktree (or reuse
  an existing worktree for it if one is already present) and merge current
  `origin/main` into it:
  ```bash
  git -C repos/{dirname} pull
  git -C repos/{dirname} worktree add \
    $SHIPWRIGHT_WORKTREE_DIR/{dirname}-docs-test-readiness-refresh-{existing-date} \
    {existing-branch-name}
  cd $SHIPWRIGHT_WORKTREE_DIR/{dirname}-docs-test-readiness-refresh-{existing-date}
  git merge origin/main
  ```
  - **Merge succeeds cleanly:** proceed to Steps 2-4 in this worktree as
    normal — the branch and its open PR are now caught up with `main` and
    will absorb this run's updates instead of being superseded by a
    competing PR.
  - **Merge conflict:** do not attempt to resolve it automatically. Abort the
    merge (`git merge --abort`), **skip Steps 2-4 for that repo only**, and
    report the conflict explicitly and distinctly in Step 4's aggregated
    summary (see Step 4 below) — do not fold this into the "skipped — all
    artifacts fresh" case, since the repo was not fresh, it was blocked.

**Fresh-branch flow (no earlier-day open PR found, or same-day rerun):**

```bash
git -C repos/{dirname} pull
git -C repos/{dirname} worktree add \
  $SHIPWRIGHT_WORKTREE_DIR/{dirname}-docs-test-readiness-refresh-{YYYYMMDD} \
  origin/main -b docs/test-readiness-refresh-{YYYYMMDD}
```

Branch naming: `docs/test-readiness-refresh-<YYYYMMDD>` (today's date). If a
worktree/branch with that name already exists (e.g. a same-day rerun), reuse
it rather than recreating — check `$SHIPWRIGHT_WORKTREE_DIR` for an existing
`{dirname}-docs-test-readiness-refresh-{YYYYMMDD}` directory first. This
same-day-reuse check is separate from the open-PR supersession check above:
this one matches on today's exact branch name only, regardless of PR state;
the supersession check above matches on any earlier-day PR still open on
GitHub.

All relative paths in Steps 2-4 (`docs/test-readiness/*.md`, phase artifact
mtimes, git history, etc.) resolve against that repo's worktree, not the bare
clone under `repos/`. Commit each repo's phase results (in its own worktree,
on its own branch) before moving to the next repo — one repo's work must not
block or be blocked by another's.

### Step 1.5: Record coverage

Before the phase loop, in the repo's worktree, run:

```bash
bun run "${CLAUDE_PLUGIN_ROOT}/scripts/coverage-summary.ts" --repo {org}/{repo} --record
```

This runs on every invocation, regardless of phase staleness, including when
every phase artifact is fresh and Step 2 would otherwise run nothing. It never
blocks the phases: a non-zero exit, a `not_reporting` result or any other
failure is logged and the run continues to Step 2. The artifact contract is in
`plugins/shipwright/references/coverage-output.md`.

### Step 1.6: Measure suite and coverage metrics

Measure four run-record metrics: `suite_wall_seconds`, `suite_budget_seconds`,
`clean_checkout_pass` and `coverage_gate_pass`. This never blocks the phases: any
failure here is logged, the metrics are omitted from the run record, and the run
continues to Step 2.

1. **Fresh checkout** — clone (or `git worktree add` a detached copy of) the repo's `HEAD`
   into a temp directory. Run the repo's documented install + test command (from its
   README / CLAUDE.md) there, timing it. `suite_wall_seconds` is the elapsed wall time;
   `clean_checkout_pass` is true when the command exits 0. Remove the temp checkout after.
2. **Budget** — `suite_budget_seconds` defaults to 900 (the 15 min Full-PR-pipeline
   budget in `skills/speed-budgets/SKILL.md`).
3. **Coverage gate** — run `check-coverage-gate.ts` with its defaults (90% line / 80% branch)
   on the coverage reader's result; `coverage_gate_pass` is 1 for verdict `READY`, else 0
   (a missing verdict is 0).
4. **Assemble** — pass the results to the assembler; it prints the four finite numbers:

```bash
bun run "${CLAUDE_PLUGIN_ROOT}/scripts/test-readiness-metrics.ts" \
  '{"suiteWallSeconds":312,"cleanCheckoutPassed":true,"coverageGateVerdict":"READY"}'
```

An unmeasured wall time makes the assembler exit non-zero; omit all four metrics then
rather than recording a guess. Keep the output for Step 5.

### Step 2: Determine the starting phase

If `--full` is set, start at phase 1. Otherwise check mtime of each phase
artifact in order (1 → 4), scoped to the current repo's worktree; the first
artifact that is missing or older than 24 hours marks the starting phase, and
if all are fresh for this repo, skip phases 1-4 and run only phase 5 (Step 3), so rows
held for an unmerged new test approach are filed once the proposal is on the default branch.
Do not exit early here. Without `--publish` that phase 5 is still a dry run.

### Step 3: Run phases sequentially

From the starting phase through phase 5, in the current repo's worktree:
- Phase 1: `/shipwright:test-inventory`
- Phase 2: `/shipwright:test-design`
- Phase 3: `/shipwright:test-migration`
- Phase 4: `/shipwright:test-roadmap`
- Phase 5: `/shipwright:test-fix --origin-cron test-readiness` — add no further
  flag (real queue) when this skill was invoked with `--publish`; otherwise add
  `--dry-run` (preview only, no task-store writes). `test-readiness` is the
  system-cron definition id, hard-coded here (the scheduler passes nothing), so
  follow-on tasks are stamped `originKind: "cron"` / `originRef: "test-readiness"`
  and can be counted per cron. Manual runs of this skill are stamped the same way.

**Held rows (new test approaches).** Phase 5 holds rows that need a new test layer or
approach, and rows that depend on them, until the proposal is on the default branch
(`test-fix` Step 4.6). Approval is judged against the default branch — never the working branch
— including when an earlier refresh PR is still open and its unmerged artifacts are in this
worktree. Rows following existing patterns are queued right away. In the normal flow the
proposal is approved when the PR's task reaches merged, deployed or released, through the repo's
normal review and merge process; add no human hold to the PR. Keep test-fix's held list
(`{T-NNN} — {outcome} — waiting on: ...`) for Step 3.5 and Step 4. Existing duplicate checks
apply, so a later run never files a row twice.

Each phase reports its `metrics` object (see its "Run metrics" section); keep them, they
become the run record's metrics in Step 5 — nothing from them is written into the artifacts.

Run each skill using the Skill tool. If any phase fails for this repo, report
the failure for that repo and stop running further phases **for that repo
only** — do not run subsequent phases for it, as each depends on the previous
artifact. Record the failed phase number, name and its error output, then
proceed to Step 3.5 — the artifacts of the phases that succeeded are still
committed and published, not discarded.

After phase 5 (or an early stop due to failure) completes for the current
repo, proceed to Step 3.5 to commit and open a PR with the refresh results.

### Step 3.5: Commit and Open PR

Runs after phase 5 **and** after an early stop, even when a later phase failed,
as long as at least one phase produced artifacts for this repo. Commit only
the artifacts of the completed phases, push the branch to origin and open (or
update) a PR for the phase-artifact refresh. If no phase produced artifacts
(the first phase failed), skip the commit and PR and go to Step 4.

**Docs PR only on material change.** Before committing, decide per completed phase artifact
whether it changed materially, using the shared checker
`${CLAUDE_PLUGIN_ROOT}/scripts/check-patrol-docs.ts` (the same one the patrol skills and
`research-docs --auto` use). For each artifact that already exists in `HEAD` (a new file is
always material), write its committed version to a temp file and compare:

```bash
git show HEAD:{artifact-path} > /tmp/{slug}.current.md
bun ${CLAUDE_PLUGIN_ROOT}/scripts/check-patrol-docs.ts {artifact-path} /tmp/{slug}.current.md
```

Read `materiallyChanged` from the JSON and ignore `violations` and the exit code (the 150-line,
count-table and run-history rules are for single patrol docs; these artifacts have their own
shape). A timestamp-only change or a pure reorder is not material. Discard every artifact that
is not materially changed (`git checkout -- {path}`). If **no** artifact is materially changed,
open no PR: skip the commit, push and PR steps below, record `docs_pr: 0` and go to Step 4.
Otherwise stage and commit only the materially changed artifacts and set `docs_pr: 1`.

**Discard the failed phase's output before committing.** A phase that dies
mid-write can leave a truncated or partial artifact on disk. Never commit it:
committing it would publish a broken artifact, and because Step 2's freshness
gate is mtime-based the file would also read as fresh, so the broken phase
would be skipped on the next run. Restore or remove whatever the failed phase
left behind, then stage only the completed phases' artifacts:

```bash
git checkout -- {failed-phase-artifact-paths}   # restore tracked files it modified
git clean -f -- {failed-phase-artifact-paths}   # remove untracked files it created
git add {completed-phase-artifact-paths}
```

Let `{failed}` be the failed phase (`{N} {name}`, e.g. `4 test-roadmap`) and
`{error}` its error output, or empty when every phase succeeded.

**Push the branch:**

```bash
git push --set-upstream origin {branch-name}
```

Where `{branch-name}` is either:
- The fresh-branch case (from Step 1's fresh-branch flow): `docs/test-readiness-refresh-{YYYYMMDD}` (today's date)
- The reused-branch case (from Step 1's open-PR supersession flow): the existing earlier-day branch name checked out in this worktree

**Check for an existing open PR on this branch:**

```bash
gh pr list --repo {org}/{repo} --head {branch-name} --state open --json number
```

If this command returns a result (PR already exists for this branch), the push
already updated the open PR. This handles the reused-branch case from Step 1,
where an earlier-day PR is still open and absorbs today's updates via the
merged `origin/main` and the newly-pushed phase artifacts. If a phase failed,
also name it in that PR's title and body, and record it as a comment:

```bash
gh pr edit {pr-number} --repo {org}/{repo} \
  --title "docs: test-readiness refresh ({YYYYMMDD}) — partial, phase {N} {name} failed" \
  --body "Automated test-readiness phase-artifact refresh (partial).

Completed phases: {list}
Failed phase: {N} {name}
Error: {error}"
gh pr comment {pr-number} --repo {org}/{repo} \
  --body "Partial refresh: phase {N} {name} failed. Completed phases: {list}. Error: {error}"
```

If no phase failed, reset that PR's title and body to the non-partial form,
since an earlier-day run may have marked it partial and the PR would otherwise
keep misreporting a failure its artifacts no longer have:

```bash
gh pr edit {pr-number} --repo {org}/{repo} \
  --title "docs: test-readiness refresh ({YYYYMMDD})" \
  --body "Automated test-readiness phase-artifact refresh"
```

Then proceed to Step 4.

**If no PR exists (fresh-branch case only), create the label and open the PR:**

Create the idempotent `shipwright` label with `--force`, which upserts rather than
erroring if the label already exists (matching the pattern applied across Shipwright
skills — see `plugins/shipwright/commands/research-docs.md` Step A7.5 for the
consistency rationale):

```bash
gh label create shipwright \
  --description "Opened by a Shipwright agent" \
  --color 4F8EF7 \
  --force

gh label create cron:test-readiness \
  --description "Opened by a Shipwright agent" \
  --color 8B5CF6 \
  --force
```

Then open the PR with the shipwright and cron:test-readiness labels:

```bash
gh pr create \
  --title "docs: test-readiness refresh ({YYYYMMDD})" \
  --body "Automated test-readiness phase-artifact refresh" \
  --label shipwright \
  --label cron:test-readiness
```

When a phase failed, the title and body must name the failed phase and its
error instead:

```bash
gh pr create \
  --title "docs: test-readiness refresh ({YYYYMMDD}) — partial, phase {N} {name} failed" \
  --body "Automated test-readiness phase-artifact refresh (partial).

Completed phases: {list}
Failed phase: {N} {name}
Error: {error}" \
  --label shipwright \
  --label cron:test-readiness
```

**Waiting rows in the PR body.** When test-fix held any rows, add a `## Waiting on approval`
section to the PR body (on create, and on `gh pr edit` for the reused branch) listing each as
`{T-NNN} — {outcome} — waiting on: {layer or approach}`, with a line saying they are filed on a
later run once this proposal is merged. Omit the section when nothing is held. It is
information only: add no label, required review, hold or checklist item — approval is the repo's
normal review and merge.

After the PR is open (or updated in the reused-branch case), proceed to Step 4. The PR body
carries no counts or refresh log; those are in the run record.

### Step 4: Report

After the repo has been processed, print one summary: which phases
ran and, if a phase failed, the failed phase (number and name) and its error
(or "skipped — all artifacts fresh" / "skipped — reuse-merge conflict, needs manual resolution" for
the open-PR supersession case above), and the number of task-store tasks
created or updated (from phase 5 output) for that repo. The reuse-merge
conflict status is reported distinctly from "skipped — all artifacts
fresh" — the two mean different things (blocked vs. nothing to do) and must
not be folded together, so a human scanning the summary can immediately spot
the repo that needs manual conflict resolution on its open PR. Also list the waiting rows (held for a new test approach, as returned by phase 5) under a
"Waiting" heading, with what each is waiting on. Likewise a
repo with a failed phase is reported with its failed phase and error, never
folded into a clean run.

## Failure handling

If a phase fails:
- Log which phase failed and include any error output.
- Do not run subsequent phases for that repo.
- Still run Step 3.5 so completed phases' artifacts are committed and a PR is
  opened or updated, with the failed phase and its error named in the PR
  title/body (or a comment on an existing open PR).
- List the failed phase and its error for that repo in the Step 4 summary so
  the run log shows the failure.
- Step 5 still records the run, with `outcome: "failed"`.
- A failure in the skill itself is always logged.

## Notes

- This skill handles its own staleness check (step 2) **unless `--full` is
  passed**. With `--full` (the scheduled default) every phase runs; without it, a
  fresh set of artifacts skips phases 1-4 but phase 5 still runs.
- Phase 5 (`test-fix`) has no confirmation gate — the scheduled prompt passes `--publish`,
  which forwards real-queue mode so it writes task-store tasks unattended.
  The publish step is idempotent (it dedupes on already-active T-NNN
  task-store IDs per repo), so a daily real run queues tasks for new work —
  including doc-layer tasks — without creating duplicates.

## Step 5: Record the run (last step)

The last step of every invocation, whatever happened before it. Every run appends exactly one `RepoCronRun` through the shared recorder, including no-op and failed runs (system-cron
contract point 3 in [docs/task-store.md](../../../../docs/task-store.md)). The cron id is
`test-readiness`, hard-coded like the `--origin-cron` value in Step 3. Write the result file
(temporary, never a `state/` file), then record against the repo's worktree `HEAD`:

```bash
bun ${CLAUDE_PLUGIN_ROOT}/scripts/cron-run-recorder.ts record \
  --cron test-readiness --repo {org/repo} --commit "$(git rev-parse HEAD)" \
  --result /tmp/test-readiness-result.json
```

The result file is `{ "outcome": "ok" | "no_op" | "failed", "metrics": {...} }`:

- `outcome`: `no_op` when every artifact was fresh and phase 5 filed nothing, or nothing changed
  and nothing was queued; `failed` when a phase failed or the reuse-merge conflict blocked the repo; else
  `ok`.
- `metrics`: numbers only — `phases_run`, `phases_failed`, the phases' own counts
  (`rows_added`, `rows_removed`, `rows_reverified`, bucket counts, roadmap task counts), test-fix's
  `queued`, `auto`, `review`, `plan`, `skipped`, `flagged`, `suppressed`, `held`, and `docs_pr` (1 if a
  docs PR was opened or updated), and the four Step 1.6 suite metrics `suite_wall_seconds`,
  `suite_budget_seconds`, `clean_checkout_pass` and `coverage_gate_pass`. Without `--publish`, phase 5 is a dry run and the queue counts
  are 0.

A failed run is still recorded with the metrics gathered so far (a failed phase, or the
reuse-merge conflict, is also named in the Step 4 summary). If the recorder itself fails, log it
and report it in the summary; never fall back to a local state file.

Files in this skill

  • SKILL.content.test.ts3.9 KB
  • SKILL.md11.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.