/shipwright:test-design runs instead · from shipwright
Phase 2 of the test-readiness pipeline. Given a Phase 1 inventory, designs a greenfield test system: framework per layer, local execution architecture, canary contract, test-data strategy, CI shape, coverage targets, and speed budgets. Writes docs/test-readiness/test-system.md.
This skill never runs in Claude Code
It ships in shipwright at skills/, but /shipwright:test-design (a command, or a skill Claude Code finds first) has the same name: typing it, or Claude choosing it, runs that one instead.
Design the target test system. Greenfield. The blueprint Phase 3 reconciles existing tests against.
By the /test-design command. Requires docs/test-readiness/test-inventory.md from Phase 1.
Read docs/test-readiness/test-inventory.md. If missing, abort with a clear "run /test-inventory first" message. Extract:
Based on the stack profile, select one framework per layer. Use the matrix below as the default; override only if the inventory reveals a specific reason (e.g., existing build infra makes one choice radically cheaper).
| Stack | Unit | Integration | Smoke | E2E |
|---|---|---|---|---|
| TypeScript (Bun) | bun test | bun test + testcontainers | supertest / Hono test client | Playwright |
| TypeScript (Node) | Vitest | Vitest + testcontainers | supertest | Playwright |
| Python | pytest | pytest + testcontainers / docker-compose | httpx / FastAPI TestClient | Playwright (Python) |
| Go | go test | go test + testcontainers-go | httptest | Playwright |
| Ruby | RSpec | RSpec + database_cleaner | Rack::Test | Capybara / Playwright |
For every external dependency named in the inventory, prescribe a local substitute. Tests that require a hosted external service with no local substitute are categorically forbidden in this system design.
| Dependency type | Preferred local substitute |
|---|---|
| Postgres / MySQL | Real DB per test run (testcontainers or a dedicated test DB). Pattern: wrap ORM calls in a typed service layer (interface + implementation); integration tests hit a real DB through that interface; unit tests mock the interface. Never mock the DB itself at the SQL or ORM level — that mocks the wrong thing. |
| Redis | testcontainers / in-memory shim |
| S3 / blob storage | localstack / minio |
| Internal HTTP service | Recorded fixture doubles (msw / nock / hand-authored JSON) by default — they're faster and require no service infra. If the service ships a Go/TS client interface, prefer mocking that interface over mocking the wire protocol. Inline service or docker-compose only when recorded fixture doubles are impractical (e.g., bidirectional streaming). |
| Third-party HTTP API | Recorded fixture doubles (msw / nock / hand-authored JSON) — never live. Requires a recorded-fixture maintenance loop (see repo-config/SKILL.md — deferred, not yet implemented) — without periodic re-recording, recorded fixtures go stale silently. |
| SMTP / email | mailhog / capture-only |
| Webhook receiver | local HTTP listener (e.g., smee / ngrok-recorded) |
Rule: no recommendation may rely on the developer manually starting an external service. If docker-compose up is required, the system design lists the exact compose file path the implementation phase will create.
Reference ${CLAUDE_PLUGIN_ROOT}/skills/canary-execution/SKILL.md and include its contract verbatim in the artifact. Specifically:
TEST_TARGET_URL env var as the local/canary mode switchPrescribe a dedicated canary entry point. The artifact must specify a separate npm script (test:canary) or Playwright project (e.g., playwright.canary.config.ts) for running the canary suite. This entry point must never reuse test:smoke. CI wires two distinct jobs: smoke (pre-merge, runs test:smoke, boots local deps) and canary (post-deploy, sets TEST_TARGET_URL, runs test:canary). Document both the script name and the CI job name in the artifact.
Decide and document:
Document:
CI check and the safe-skip rules in ${CLAUDE_PLUGIN_ROOT}/skills/repo-config/SKILL.md.lcov (Bun/Jest/Vitest native), jacoco (JVM), coverage.py (Python),
c8/nyc (Node), or go-cover (Go). Recorded the same way as the other CI pipeline
shape fields — per repo, not a fixed default.coverage/lcov.info) and the
step that uploads it as the shipwright-coverage workflow artifact, on pushes to the
default branch. Take the reporter command and path from the per-language recipe table in
${CLAUDE_PLUGIN_ROOT}/references/coverage-output.md rather than restating it here.One test job by default; splitting is an explicit override. The default CI shape is one test job that runs unit, integration and smoke, replacing a one-job-per-layer default. Per-job overhead (checkout, dependency install, environment setup, and container init for dependencies like Postgres) is fixed cost paid by every job regardless of how little work it does, and job-level queuing delays multiply with every extra job. Keep the speed measurement: the 15-minute budget, and per-layer measurement when a layer's aggregate is over 50% of the budget twice in a row (see speed-budgets/SKILL.md). That trigger prompts investigation; it does not by itself justify a split.
Split into several jobs (per layer or per workspace) only when CI takes too long against the 15-minute budget and measurements show the split saves meaningful time. The projected wall-clock savings must exceed roughly 2x the added fixed per-job overhead (checkout+setup+install, plus container init where applicable), so the split pays for itself at least twice over. Flaky or slow tests are not a reason to split on their own; fix those tests first.
Split jobs follow the safe-skip rules in repo-config/SKILL.md (all of them join the single CI check via needs) and the all-layer coverage contract in ${CLAUDE_PLUGIN_ROOT}/references/coverage-output.md. Repos that already have separate jobs need not merge them.
Naming convention and runner-exclusion config (required): The artifact must specify both a file-naming convention and the runner-exclusion config that enforces it. These two items are inseparable — a naming convention without matching exclusion config is not enforced, and exclusion config without a naming convention is unauditable. Document:
File-naming convention — one suffix rule per entry point:
.canary.ts / .canary.spec.ts — canary entry point only.smoke.ts / .smoke.spec.ts — smoke layer (pre-merge).integration.ts / .integration.spec.ts — integration layer (testcontainers / docker-compose).unit.ts / .unit.spec.ts or default — unit layerRunner-exclusion config — each runner explicitly excludes other layers:
testMatch / include — exclude .canary., .smoke., .integration. from the unit runnertestMatch — scope to .canary.spec.ts or the canary project directory; exclude .unit., .integration. filesexclude — exclude test helpers, fixtures, factory files, and non-source files from line/branch coverage reports--filter or equivalent — use path-based filters aligned with the naming conventionVerification — for each runner, a command that confirms it picks up only its layer's files (e.g., bun test --filter integration --dry-run | grep -v .integration. should return nothing).
Enforce a single coverage floor (≥90% line, ≥80% branch) enforced by standard coverage tooling — no per-tier thresholds in CI. Criticality drives prioritization (write critical tests first), not enforcement: the CI gate does not need to know which files are critical.
| Layer | Minimum CI floor | Notes |
|---|---|---|
| unit | ≥90% line, ≥80% branch | Critical-path files should aim higher, but enforced via team practice, not separate CI gates |
| integration | every named boundary covered | Measured by code path, not line count |
| smoke | every public route 200/4xx covered | Route coverage, not code coverage |
| E2E | every top-5 journey covered | Journey coverage |
The floor is measured across all layers. The single floor applies to the coverage figure computed over every layer the repo runs (unit, integration, smoke), not to any one layer's report. The CI shape from Step 6 must therefore publish all-layer coverage: when layers are split into separate jobs, each job emits its own lcov report and the shipwright-coverage artifact contains every layer. Runner exclusions (Step 5) only decide which tests a job runs; they must never narrow what the artifact measures. The contract lives in ${CLAUDE_PLUGIN_ROOT}/references/coverage-output.md ("All-layer coverage") — cite it, do not restate it.
The line floor is a rising minimum, checked inside CI. Publish coverage first, then add tests until line coverage reaches 90%. The enforced minimum starts at current line coverage, fails below it, and is raised by tasks that add coverage until it reaches 90%. Check it where all layer reports come together: in the single test job, or with split jobs in a coverage-check job on PRs and the default branch that CI needs. Default-branch runs always run every coverage layer and publish a complete report; a PR either runs every layer or skips all layers and the check together. Never compare partial coverage with the full minimum; a missing or failed report fails the check. See repo-config/SKILL.md ("Coverage minimum") and coverage-output.md.
Why a single floor: per-tier thresholds require a maintained criticality mapping in CI. As files are added, moved, or grow in importance, the mapping decays silently. A single floor enforced by the language's built-in coverage reporter avoids this maintenance burden while still directing attention to critical paths during planning.
Reference ${CLAUDE_PLUGIN_ROOT}/skills/speed-budgets/SKILL.md and include the default budget table. May tighten per repo; never loosen.
Also output the parallelization plan: worker count and sharding strategy per layer that makes the suite targets achievable.
List the test-support code the implementation will need:
Reference ${CLAUDE_PLUGIN_ROOT}/skills/repo-config/SKILL.md and include a Repo configuration section in the artifact covering:
main — required status checks (the single CI check, per repo-config/SKILL.md), required reviews, admin enforcement decisionTEST_CANARY_API_KEY, per-external service auth tokens (for recorded-fixture recording), staging/prod deploy credentialsstaging, production with reviewer gates.github/pull_request_template.md with a Closing Checklist that requires the verification-command outputWithout this section, the test pipeline is advisory. The Phase 4 roadmap will auto-pair workflow tasks with branch-protection tasks per the pairing rule in repo-config/SKILL.md.
Load template at ${CLAUDE_PLUGIN_ROOT}/assets/templates/test-system.md.tmpl. Fill in. Write to docs/test-readiness/test-system.md.
Every run is recorded through the shared cron-run recorder, and the numbers live in the run
record, never in the artifact (see "System-cron contract" in
docs/task-store.md). /shipwright:test-readiness owns the
single run record for the repo and merges this phase's metrics into it; this skill reports
them in its final output as a metrics object, for example:
{ "sections_changed": 0, "layers": 0, "ci_jobs": 0 }
That covers how many blueprint sections changed, plus the layer and CI-job counts. The artifact keeps only detail (blueprint).
docs/test-readiness/ artifact. Git history holds
the prior versions, and the run record holds the counts./test-design against org/repo" line — no dates,
commit stamps or worktree names, so an unchanged artifact stays byte-stable and opens no docs
PR (only a material change does; see /shipwright:test-readiness).What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub app-vitals/shipwright --plugin shipwright27 skills in this plugin
/agent-readinessScore one repo against the agent-readiness catalogue (docs/readiness.md) with the deterministic scorer, post one ReadinessSnapshot and record one run. Requires --repo org/repo. No model judgment, no task creation, no repo files./canary-executionCross-cutting contract for the test-readiness pipeline. Defines how canary-eligible test code runs in two modes — `local` (boot dependencies inline, hit localhost) and `canary` (skip the boot, hit a deployed `TEST_TARGET_URL`) — via a dedicated entry point separate from the local smoke runner. Specifies eligibility rules (read-only or self-cleaning, smoke/E2E only, critical/high tier only, zero DB-dependent tests) and the deploy-gate budget (<60s wall time). Referenced by the inventory, system-design, migration, and roadmap skills.
/duplication-fixRead a repo's ready_to_propose duplication patterns from the task store (PatrolFinding) and queue them as routed task-store tasks (auto, review or plan), one task per pattern, each carrying a strangler-fig (build -> coexist -> eliminate) execution plan. Requires --repo org/repo and duplication-scan to have run first./duplication-scanDiscover emerging duplicate/similar code patterns in one repo via judgment-driven comparison, track them across runs in the task store's PatrolFinding ledger, and list only stabilized open patterns in docs/patrols/duplication.md. Requires --repo org/repo. Report only — no code changes./entropy-fixRead the entropy-scan handoff for one repo and route PR-worthy violations as task-store tasks (auto / review / plan), one task per rule. Requires --repo org/repo and /entropy-scan to have run first./entropy-scanScan one repo for principle deviations and write docs/patrols/entropy.md. Requires --repo org/repo. Report only — no code changes.Other plugins' skills for the same job