testing-strategy
Skill213 starsChanged 2 days agoMITView on GitHub
Use when planning or reviewing tests for a code change, choosing between unit, focused regression, integration, contract, end-to-end, performance, security, property-based, or agent-evaluation checks; classify change risk first and select the smallest evidence set that proves the behavior. Do not use for a single obvious test command, pure documentation changes, or a full security audit without a testing question.
We split this skill into the rules it gives an agent
14 rules. 0 are common, 10 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 41 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Keep execution environments reusable, but separate their evidence profiles: staging-smoke, security-proof, release-attestation, and …
- Very specific: line 13
Use harness-feedback when a gate is reported as overloaded or misplaced.
- Distinctive: line 20
Run the fast gate first. If it fails, fix the cause before adding more tests.
- Distinctive: line 21
Add a focused regression test for a confirmed bug or a changed invariant.
- Distinctive: line 22
Test real boundaries only when the change crosses them.
- Distinctive: line 23
Keep security-proof and release-attestation checks out of staging-smoke unless the acceptance criteria explicitly require that evidence.
- Very specific: line 27
When a verified stage becomes the input to another stage, seal that boundary with commit/tree, contract, input/output digests, and a fresh …
- Distinctive: line 71
Performance/security: only when the change or release claim needs it.
- Distinctive: line 73
Agent eval: test task completion, tool selection, recovery, and safety on a versioned golden set.
- Distinctive: line 93
If a higher-level test finds a failure with no lower-level failure, add the smallest lower-level reproducer and keep the higher-level test …
- Distinctive: line 96
Do not run unit, integration, E2E, benchmark, and security suites by default just because they exist.
- Very specific: line 98
Do not use retries, sleeps, snapshots, or skip/xfail to make red tests look green.
- Distinctive: line 100
Do not claim release readiness from a fast suite alone.
- Distinctive: line 108
Do not treat a new external blocker as a failed upstream candidate.
“Common” is measured: kept by at least 6 in 10 of the 41 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Testing Strategy
Testing is an evidence-selection problem, not a contest to run the largest
suite. Choose the smallest set that can falsify the changed behavior, then add
one higher-level check only when it covers a boundary the lower level cannot.
Keep execution environments reusable, but separate their evidence profiles:
staging-smoke, security-proof, release-attestation, and nightly-stress.
Use harness-feedback when a gate is reported as overloaded or misplaced.
Workflow
- Freeze the acceptance criteria as observable outcomes.
- Inspect the changed files and classify the risk.
- Select the lowest useful test level from the matrix below and name the profile.
- Run the fast gate first. If it fails, fix the cause before adding more tests.
- Add a focused regression test for a confirmed bug or a changed invariant.
- Test real boundaries only when the change crosses them.
- Keep security-proof and release-attestation checks out of staging-smoke unless the acceptance criteria explicitly require that evidence.
- For high-risk or long-horizon work, use a fresh-context verifier and store the command, revision, result, and skipped checks in a durable artifact.
- When a verified stage becomes the input to another stage, seal that boundary
with commit/tree, contract, input/output digests, and a fresh verdict. Mark an
unavailable external prerequisite as
BLOCKED; do not rerun unrelated accepted code merely because the following environment is unavailable.
Compact Matrix
| Change | Required evidence | Usually deferred |
| Docs, comments, formatting only | Link/lint check when relevant | Runtime suite |
| Pure function, local refactor | Fast checks + focused unit/regression tests | Full E2E, mutation |
| Parser, serializer, file, DB, API adapter | Fast + focused + one real boundary/integration check | Browser E2E unless user flow changes |
| Auth, permissions, migrations, concurrency, public API, deployment | Fast + focused + integration/contract + targeted smoke; independent review for non-trivial changes | Full load test unless performance is in scope |
| UI or user journey | Fast + component/focused checks + one stable E2E smoke | Large browser matrix |
| Release or performance claim | All applicable lower levels + fixed benchmark/security/release evidence | Nothing that is part of the claim |
The Stop hook runs the project's fast/default suite only when the working tree
contains code or test changes. Projects with a complex suite may declare
.claude/test-policy.json:
{
"fast": ["python", "-m", "pytest", "-q", "tests/unit"],
"integration": ["python", "-m", "pytest", "-q", "tests/integration"],
"release": ["python", "-m", "pytest", "-q"]
}fast is the automatic Stop gate. integration is additionally selected for
high-risk changes when present. release is explicit or CI-only; do not make
every edit pay the release-suite cost. Optional profiles make the separation
explicit; a staging profile must not contain release-signing requirements.
Test Kinds
- Unit: isolated behavior and invariants; fast and numerous.
- Focused regression: a minimal test that was red before a fix and green after it. Keep it when it protects a real contract.
- Integration: one real boundary such as a database, filesystem, queue, or external adapter. Use a local/test dependency, never production.
- Contract: provider/consumer schema and serialization expectations.
- Smoke/E2E: a small number of real user or release paths; keep them stable.
- Property/fuzz: invariants over generated inputs; use for parsers, normalizers, state machines, and edge-heavy algorithms.
- Performance/security: only when the change or release claim needs it; preserve a fixed workload and baseline.
- Agent eval: test task completion, tool selection, recovery, and safety on a versioned golden set. Deterministic assertions come first; an LLM judge is an additional signal, never the sole proof of code correctness.
Agent Evidence Contract
An agent must report: revision, changed scope, commands actually run, exit status, relevant counts, environment constraints, and checks not run with a reason. “Tests passed” without command output or a durable evidence file is not proof. A generated test is a candidate until it reproduces the failure or asserts a stable contract; do not add broad snapshot tests merely to inflate coverage.
For a confirmed bug use bug-reproducer: reproduce first, then fix, then run
the same test again. For a large/high-risk change use proof-verify: a fresh
context must produce the final verdict. For a safe structural refactor use
refactoring-safely and characterization tests before the transformation.
Anti-Duplication Rules
- If a higher-level test finds a failure with no lower-level failure, add the smallest lower-level reproducer and keep the higher-level test only if it proves a distinct boundary.
- Do not run unit, integration, E2E, benchmark, and security suites by default just because they exist. Route by changed boundary and risk.
- Do not use retries, sleeps, snapshots, or
skip/xfailto make red tests look green. A flaky test needs a cause, a bounded quarantine reason, or a fix. - Do not claim release readiness from a fast suite alone.
- Null-return check: if the test would still pass when every function under
test returned nothing (
None, empty, default), it asserts nothing; delete or rewrite it. Cheapest negative control for a new test: stub the unit to return nothing and confirm the test goes red. Source: https://github.com/unclebob/ub-mode ("Test Behavior, Not Implementation"). Second probe from the same source (pstack test-behavior): change the internals without changing behaviour; a test that fails is pinned to implementation, rewrite it against the public result. - Do not treat a new external blocker as a failed upstream candidate. Verify the stage that changed; promote the same sealed input when the prerequisite arrives.
Gotchas
- A green test suite proves only the exercised behavior; it does not prove absence of defects.
- Mocks can hide serialization and wiring failures. Keep one real boundary test for each important adapter.
- End-to-end tests are valuable but expensive and flaky; they should protect journeys, not duplicate every branch already tested below.
- Mutation testing is a periodic test-quality audit, not a per-edit gate. On
Windows, verify the tool's runtime requirements before adding it to CI.
For one Python function or a hook fix, use our own probe:
python ~/.claude/claude-code-config/scripts/mutation_probe.py FILE.py --function NAME --test "CMD" [--dir-env VAR] [--work-root DIR](exit 0 all killed, 3 survivor, 2 not checked). A survivor means a missing test case or dead code: add the case or delete the code, then rerun. - Agent trajectories need task-outcome checks and tool-call checks, not only final-text similarity.
- A VM harness is an execution environment, not a release profile. Reuse the
VM for staging and security checks, but attach signing and artifact identity
checks only to
release-attestation.
Troubleshooting
| Symptom | Likely cause | Action |
| Stop gate runs in a docs-only change | Project has no Git-visible status or a broad override | Check git status; keep the default command scoped in .claude/test-policy.json |
| Fast suite passes, integration fails | A real boundary was changed or mocked away | Add/fix the boundary test; do not weaken the fast gate |
| E2E is flaky | Timing, shared state, browser/environment dependency | Make state isolated and waits explicit; reduce E2E to a stable smoke |
| Generated test passes without exposing the bug | Test asserts implementation details or never goes red | Reproduce the pre-fix failure and assert the user-visible invariant |
| Agent claims completion with skipped checks | Missing evidence contract or verifier | Record the skip reason and run proof-verify for high-risk work |
| Agent says the harness is too strict or blocks smoke | Profiles are coupled or a gate is misplaced | Invoke harness-feedback; capture the blocker, split profiles, and rerun the reduced smoke |
| A later audit asks to repeat a green earlier stage | Proof identity was not recorded, or its source/input changed | Check the stage receipt; reuse a sealed matching receipt or record a superseding stage |
Other versions51 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- AnastasiyaW/claude-code-config★ 20999% same
Wrote their own version · 50
- anthropics/knowledge-work-plugins★ 34ksame name
- chthollyphile/folia-major★ 7.4ksame name
- Community-Access/accessibility-agents★ 409same name
- irahardianto/awesome-agv★ 157same name
- Blushyes/reef★ 84same name
- shinpr/agentic-code★ 51same name
- addxai/enterprise-harness-engineering★ 44same name
- drafthq/draft★ 40same name
- zakariaf/Flutter-Skills★ 32same name
- Hack23/European-Parliament-MCP-Server★ 30same name
40 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use deploy-checklist, react-patterns and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
AnthropicSkilldeploy-checklist
Pre-deployment verification checklist. Use when about to ship a release, deploying a change with database migrations or feature flags, verifying CI status and approvals before going to production, or documenting rollback triggers ahead of time.
Also in 4 projects that use this
xenitV1Skillreact-patterns
Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.
Also in 4 projects that use this
AnthropicSkilltech-debt
Identify, categorize, and prioritize technical debt. Trigger with "tech debt", "technical debt audit", "what should we refactor", "code health", or when the user asks about code quality, refactoring priorities, or maintenance backlog.
Also in 4 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 5 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 8 projects that use this
OpenAISkillobservability
Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.
Also in 3 projects that use this
- +4 more from anthropics
In this repository60 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-harness-designSkill
- agents-best-practicesSkill
- diffusion-engineeringSkill
- flux2-klein-promptingSkill
- flux2-lora-trainingSkill
- forensic-prompt-compilerSkill
- ml-research-labSkill
- notebooklm-grounded-researchSkill
- vlm-segmentationSkill
- feature-newSkill
- harness-designSkill
- layer-newSkill
- plan-swarm-reviewSkill
- pixel-art-storyboardSkill
- pixel-art-studioSkill
- architecture-firstSkill
- architecture-qualitySkill
- bug-reproducerSkill
- code-complexitySkill
- control-cliSkill
- control-uiSkill
- deep-reviewSkill
- deslopSkill
- distill-feedbackSkill
- harness-feedbackSkill
- proof-verifySkill
- refactoring-safelySkill
- repo-mapSkill
- root-cause-deliverySkill
- system-and-data-designSkill
- thermo-nuclear-code-quality-reviewSkill
- verify-thisSkill
- workflow-orchestrationSkill
- frontend-designSkill
- motion-framerSkill
- ui-designSkill
- ui-ux-pro-maxSkill
- ios-developmentSkill
- lean-codeSkill
- cross-harness-continuationSkill
- deepseek-provider-contractSkill
- desktop-sessions-discoverySkill
- epistemic-challengeSkill
- gemini-delegateSkill
- harness-auditSkill
- observability-monitoringSkill
- remote-compute-opsSkill
- plan-to-ticketsSkill
- product-meaning-extractorSkill
- remotion-production-guideSkill
- script-evaluatorSkill
- video-narrative-arcSkill
- video-post-productionSkill
- article-structure-reviewSkill
- cavemanSkill
- humanize-englishSkill
- humanize-russianSkill
- owner-voiceSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

