QA Router
Route validation work through the repository's actual test and CI contracts.
Use this skill to choose gates, write deterministic tests, reproduce CI, and
triage flakes without inventing a parallel testing workflow.
First Reads
Before invoking a runner or editing configuration, read:
- root and nested
AGENTS.md or equivalent contributor instructions;
README.md, testing docs, and setup/runbook prerequisites;
- root and relevant package
package.json scripts or language task config;
- CI workflow files and validation/routing manifests;
- runner configuration, test setup, fixtures, and the nearest existing tests.
Discover the repository's package manager and task runner. Do not assume Bun,
npm, uv, Cargo, Make, or another tool from file extensions alone.
Rules
- Prefer repository scripts over raw runner binaries. Scripts may own env,
project selection, code generation, sharding, setup, or cleanup.
- Start with the narrowest command that reproduces the changed behavior or
failure, then run the wider gate selected by touched files and CI policy.
- A command not run is
UNVERIFIED, never passed.
- Tests must be deterministic: no live providers, wall-clock sleeps, order
dependence, uncontrolled randomness, or shared mutable leakage.
- Do not add test-only branches, flags, or exports to production code. Extract
a real pure seam only when it improves production design too.
- Test behavior and contracts, not incidental implementation details.
- Restore mocks, timers, environment, network interception, files, databases,
and global state after each test.
- Never weaken an assertion, add retries, serialize a suite, or increase a
timeout until the nondeterminism is understood.
- Official runner docs and source are authority for configuration or current
API behavior. Refresh them through
context7-research or opensrc when
installed (otherwise use the runner's local docs, --help, and source);
use deep-researcher only for broader, evidence-heavy uncertainty.
- Preserve authorization, denied-path, tenant/account-isolation, destructive,
migration, and public-contract coverage.
Lanes
Gate selection
Read references/validation-routing.md. Map touched files and risk to the
repository's named lint, format, type, unit, integration, E2E, build, docs,
security, generated-output, platform, and release gates. Never derive a new
matrix when the repo already owns one.
Test authoring
- Read neighboring tests and runner setup before adding a file.
- Use the existing naming, project, environment, fixture, and location rules.
- Build minimal deterministic fixtures with explicit identities, time, random
seeds, locale, timezone, and network boundaries when relevant.
- Cover the success path plus the material denial, invalid-input, empty/error,
retry/idempotency, and cleanup behavior introduced by the change.
- Prefer public behavior or stable boundary assertions over private calls and
snapshots of irrelevant markup.
- For browser tests, wait for user-visible state or network completion rather
than sleeping. Keep auth and storage state generated by repository tooling.
- For integration tests, use local emulators/fakes/transactional fixtures; do
not mutate live services.
CI reproduction
- Capture the exact workflow, job, step, command, environment, shard/project,
runner version, and first actionable error.
- Reproduce the owning script locally with equivalent committed config.
- Match CI-specific environment only as needed; never print secrets.
- Separate code failure from missing prerequisite, platform drift, generated
output drift, resource pressure, and provider outage.
- Patch the verified cause, rerun the narrow command, then rerun the owning CI
gate or closest safe local equivalent.
Flake triage
Read references/failure-triage.md and classify evidence before fixing:
- Timing: race, fake-timer misuse, animation/eventual state, missing await.
- Order: state leaked between tests or suite-order assumptions.
- Parallelism: shared ports/files/database rows, unsafe global fixtures,
resource contention, or shard collisions.
- Network: uncontrolled request, provider variability, DNS/rate limit, or
incomplete interception.
- Leak: timers, processes, handles, DOM, mocks, environment, files, or DB
state survive cleanup.
Retries are diagnostic evidence, not a default fix.
Companion Routing
vitest-dev for Vitest architecture, projects, fixtures, performance, and
flakes.
pytest-dev for pytest fixtures, markers, parametrization, speed, and flakes.
bun-dev for Bun-native test/runtime behavior and Bun repository posture.
context7-research for current official library/runner documentation.
opensrc for implementation details, package internals, and version diffs.
deep-researcher for broad, cited investigation across multiple authorities.
Load only the companion required by the discovered stack.
Failure Procedure
- Record the exact failure and first actionable error.
- Reproduce with the narrowest owning command.
- Classify the failure and test the leading hypothesis.
- Read the owning script, config, setup, fixture, and production boundary.
- Patch only the verified cause.
- Rerun the narrow reproduction until stable.
- Stress the suspected flake dimension when appropriate: repeat, randomize
order, vary workers/shards, or check leaked handles using supported options.
- Run the wider gate selected by touched files and CI policy.
- Report commands, results, skipped gates, and residual
UNVERIFIED gaps.
Severity
- HIGH: required gate failure; missing proof for security/data/public
contract behavior; deterministic reproduction of a release-blocking defect;
or a flake that makes required CI untrustworthy.
- MEDIUM: meaningful coverage, isolation, speed, or CI-parity weakness that
risks regressions but does not currently block the required gate.
- LOW: localized test clarity or maintenance issue with bounded risk.
Review Output Format
## QA Report
- Scope and touched risk:
- Repository authorities read:
- Selected gates and why:
- Failure reproduction / tests authored:
- Root cause and classification:
- Files changed:
- Narrow verification:
- Wider verification:
- Skipped gates and why:
- Flake confidence:
- UNVERIFIED gaps:
Do not report a flake fixed from one passing rerun. State the repetition or
stress evidence used and the remaining confidence limit.
1---2name: qa-router3description: Validation routing and test-failure triage for any repository. Use to select the right gates, author deterministic tests, reproduce CI failures, or diagnose flaky suites.4license: MIT5---67# QA Router89Route validation work through the repository's actual test and CI contracts.10Use this skill to choose gates, write deterministic tests, reproduce CI, and11triage flakes without inventing a parallel testing workflow.1213## First Reads1415Before invoking a runner or editing configuration, read:16171. root and nested `AGENTS.md` or equivalent contributor instructions;182. `README.md`, testing docs, and setup/runbook prerequisites;193. root and relevant package `package.json` scripts or language task config;204. CI workflow files and validation/routing manifests;215. runner configuration, test setup, fixtures, and the nearest existing tests.2223Discover the repository's package manager and task runner. Do not assume Bun,24npm, uv, Cargo, Make, or another tool from file extensions alone.2526## Rules2728- Prefer repository scripts over raw runner binaries. Scripts may own env,29 project selection, code generation, sharding, setup, or cleanup.30- Start with the narrowest command that reproduces the changed behavior or31 failure, then run the wider gate selected by touched files and CI policy.32- A command not run is `UNVERIFIED`, never passed.33- Tests must be deterministic: no live providers, wall-clock sleeps, order34 dependence, uncontrolled randomness, or shared mutable leakage.35- Do not add test-only branches, flags, or exports to production code. Extract36 a real pure seam only when it improves production design too.37- Test behavior and contracts, not incidental implementation details.38- Restore mocks, timers, environment, network interception, files, databases,39 and global state after each test.40- Never weaken an assertion, add retries, serialize a suite, or increase a41 timeout until the nondeterminism is understood.42- Official runner docs and source are authority for configuration or current43 API behavior. Refresh them through `context7-research` or `opensrc` when44 installed (otherwise use the runner's local docs, `--help`, and source);45 use `deep-researcher` only for broader, evidence-heavy uncertainty.46- Preserve authorization, denied-path, tenant/account-isolation, destructive,47 migration, and public-contract coverage.4849## Lanes5051### Gate selection5253Read `references/validation-routing.md`. Map touched files and risk to the54repository's named lint, format, type, unit, integration, E2E, build, docs,55security, generated-output, platform, and release gates. Never derive a new56matrix when the repo already owns one.5758### Test authoring5960- Read neighboring tests and runner setup before adding a file.61- Use the existing naming, project, environment, fixture, and location rules.62- Build minimal deterministic fixtures with explicit identities, time, random63 seeds, locale, timezone, and network boundaries when relevant.64- Cover the success path plus the material denial, invalid-input, empty/error,65 retry/idempotency, and cleanup behavior introduced by the change.66- Prefer public behavior or stable boundary assertions over private calls and67 snapshots of irrelevant markup.68- For browser tests, wait for user-visible state or network completion rather69 than sleeping. Keep auth and storage state generated by repository tooling.70- For integration tests, use local emulators/fakes/transactional fixtures; do71 not mutate live services.7273### CI reproduction74751. Capture the exact workflow, job, step, command, environment, shard/project,76 runner version, and first actionable error.772. Reproduce the owning script locally with equivalent committed config.783. Match CI-specific environment only as needed; never print secrets.794. Separate code failure from missing prerequisite, platform drift, generated80 output drift, resource pressure, and provider outage.815. Patch the verified cause, rerun the narrow command, then rerun the owning CI82 gate or closest safe local equivalent.8384### Flake triage8586Read `references/failure-triage.md` and classify evidence before fixing:8788- **Timing:** race, fake-timer misuse, animation/eventual state, missing await.89- **Order:** state leaked between tests or suite-order assumptions.90- **Parallelism:** shared ports/files/database rows, unsafe global fixtures,91 resource contention, or shard collisions.92- **Network:** uncontrolled request, provider variability, DNS/rate limit, or93 incomplete interception.94- **Leak:** timers, processes, handles, DOM, mocks, environment, files, or DB95 state survive cleanup.9697Retries are diagnostic evidence, not a default fix.9899## Companion Routing100101- `vitest-dev` for Vitest architecture, projects, fixtures, performance, and102 flakes.103- `pytest-dev` for pytest fixtures, markers, parametrization, speed, and flakes.104- `bun-dev` for Bun-native test/runtime behavior and Bun repository posture.105- `context7-research` for current official library/runner documentation.106- `opensrc` for implementation details, package internals, and version diffs.107- `deep-researcher` for broad, cited investigation across multiple authorities.108109Load only the companion required by the discovered stack.110111## Failure Procedure1121131. Record the exact failure and first actionable error.1142. Reproduce with the narrowest owning command.1153. Classify the failure and test the leading hypothesis.1164. Read the owning script, config, setup, fixture, and production boundary.1175. Patch only the verified cause.1186. Rerun the narrow reproduction until stable.1197. Stress the suspected flake dimension when appropriate: repeat, randomize120 order, vary workers/shards, or check leaked handles using supported options.1218. Run the wider gate selected by touched files and CI policy.1229. Report commands, results, skipped gates, and residual `UNVERIFIED` gaps.123124## Severity125126- **HIGH:** required gate failure; missing proof for security/data/public127 contract behavior; deterministic reproduction of a release-blocking defect;128 or a flake that makes required CI untrustworthy.129- **MEDIUM:** meaningful coverage, isolation, speed, or CI-parity weakness that130 risks regressions but does not currently block the required gate.131- **LOW:** localized test clarity or maintenance issue with bounded risk.132133## Review Output Format134135```markdown136## QA Report137- Scope and touched risk:138- Repository authorities read:139- Selected gates and why:140- Failure reproduction / tests authored:141- Root cause and classification:142- Files changed:143- Narrow verification:144- Wider verification:145- Skipped gates and why:146- Flake confidence:147- UNVERIFIED gaps:148```149150Do not report a flake fixed from one passing rerun. State the repetition or151stress evidence used and the remaining confidence limit.