name: testing
description: "Use when writing, reviewing, or maintaining tests, verifying code, or preparing code/test changes for handoff."
Testing
Philosophy
Tests before | during | after code → verify, explore, learn, validate.
Test-first is optional.
Code settled → curate tests for original intent, bugs, regressions, safe refactoring.
Keep protection, not construction history.
Prefer few high-leverage integrations covering substantial consumer behavior over many isolated unit checks.
Integrations + useful unit tests generally form the bulk; keep unique edge cases, no fixed ratio.
Coverage + mutation → auxiliary diagnostics, not score targets.
Development: keep local feedback fast; use existing project automation and required gates.
Before completion, handoff, or integration of code/test changes: read suite review.
Also use it for existing-suite reviews; read-only means recommendations, not edits.
Technique adopted + relevant → read its reference before choosing or reviewing that strategy.
Otherwise load only on explicit request.
Establish adoption from tasks, config, tests, or reports; dependency presence alone ≠ adoption.
Do not bulk-load references or automatically introduce tools, gates, or broad campaigns.
Approval tests, golden files/masters, reference output → snapshots.
Module/component, API/service, contract, system/E2E, built-artifact consumers → integration.
Consumer harnesses count even without the integration label; inspect actual boundaries, not names.
Boundaries
Derive expectations from requirements, invariants, or independent examples, not copied implementation logic or configured mock returns.
Local probes may inspect internals; they answer local questions, not broader correctness.
Keep throwaway probe artifacts in OS temp.
Match completion claims to observed consumer behavior; local or synthetic success does not prove live configuration or portability.
Validate prerequisites before interpreting results; invalid setup makes a green result inconclusive.
Preserve supported behavior, known regressions, and relevant failure cases when replacing tests.
Diagnose failures before removal; never weaken assertions, skip failures, or refresh snapshots merely to get green.
Stay within authorized scope; unrelated weaknesses do not authorize edits, new gates, or full CI.
Preserve required project gates.
Investigate failed required checks; establish baseline evidence before calling failures pre-existing.
Fix within scope or obtain explicit approval to broaden scope or defer; do not report completion with unresolved required failures.
---
name: testing
description: "Use when writing, reviewing, or maintaining tests, verifying code, or preparing code/test changes for handoff."
---
# Testing
## Philosophy
- Tests before | during | after code → verify, explore, learn, validate.
Test-first is optional.
- Code settled → curate tests for original intent, bugs, regressions, safe refactoring.
Keep protection, not construction history.
- Prefer few high-leverage integrations covering substantial consumer behavior over many isolated unit checks.
Integrations + useful unit tests generally form the bulk; keep unique edge cases, no fixed ratio.
- Coverage + mutation → auxiliary diagnostics, not score targets.
- Properties + reviewed snapshots → compact oracles for suitable code, replacing repetitive explicit expectations.
## Route
- Development: keep local feedback fast; use existing project automation and required gates.
- Before completion, handoff, or integration of code/test changes: read [suite review](references/suite-review.md).
Also use it for existing-suite reviews; read-only means recommendations, not edits.
- Prompts/model behavior: also read [prompt evaluation](references/prompt-evaluation.md).
Technique adopted + relevant → read its reference before choosing or reviewing that strategy.
Otherwise load only on explicit request.
Establish adoption from tasks, config, tests, or reports; dependency presence alone ≠ adoption.
Do not bulk-load references or automatically introduce tools, gates, or broad campaigns.
- Code/test coverage; statement, line, branch reports → [coverage](references/coverage.md).
- Mutation analysis; mutants, history/incremental runs → [mutation](references/mutation-testing.md).
- Property/generative/QuickCheck-style checks → [properties](references/property-based-testing.md).
- Approval tests, golden files/masters, reference output → [snapshots](references/snapshot-testing.md).
- Module/component, API/service, contract, system/E2E, built-artifact consumers → [integration](references/integration-testing.md).
Consumer harnesses count even without the integration label; inspect actual boundaries, not names.
## Boundaries
- Derive expectations from requirements, invariants, or independent examples, not copied implementation logic or configured mock returns.
- Local probes may inspect internals; they answer local questions, not broader correctness.
Keep throwaway probe artifacts in OS temp.
- Match completion claims to observed consumer behavior; local or synthetic success does not prove live configuration or portability.
- Validate prerequisites before interpreting results; invalid setup makes a green result inconclusive.
- Preserve supported behavior, known regressions, and relevant failure cases when replacing tests.
- Diagnose failures before removal; never weaken assertions, skip failures, or refresh snapshots merely to get green.
- Stay within authorized scope; unrelated weaknesses do not authorize edits, new gates, or full CI.
Preserve required project gates.
Investigate failed required checks; establish baseline evidence before calling failures pre-existing.
Fix within scope or obtain explicit approval to broaden scope or defer; do not report completion with unresolved required failures.