testing-strategy
Skill3 starsChanged 7 months agoMITView on GitHub
Use when defining a project's test approach, when choosing what gets tested at unit vs integration vs e2e level, when setting per-component coverage targets, when reviewing test quality, or when CI is slow / flaky and tests need a strategy reset.
37 other projects use a version of this.
Adopted by
Most recently taken up by
- HMBSbige/skillstheir own version, first seen Oct 3, 2026
- vospr/context-engineering-templatetheir own version, first seen Oct 1, 2026
- lgzarturo/codeconductortheir own version, first seen Sep 30, 2026
- Cure-Consulting-Group/ProductEngineeringSkillstheir own version, first seen Sep 28, 2026
- komluk/scaffoldingtheir own version, first seen Sep 28, 2026
- Ygohel18/skillstheir own version, first seen Sep 27, 2026
Used with
Projects with it also use react-patterns, error-handling and 6 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.
benshapyroSkillreact-patterns
Modern React patterns for TypeScript applications including hooks, state management, and component composition. Use when building React components, managing state, or implementing React best practices.
Also in 4 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 3 projects that use this
OpenAISkillverification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Also in 6 projects that use this
OpenAISkillsystematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Also in 5 projects that use this
CloudflareSkillreceiving-code-review
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
Also in 3 projects that use this
- +3 more from openai
Other versions37 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 37
- anthropics/knowledge-work-plugins★ 26ksame name
- irahardianto/awesome-agv★ 157same name
- AnastasiyaW/codex-claude-code-config★ 153same name
- zakariaf/Flutter-Skills★ 52same name
- shinpr/agentic-code★ 49same name
- addxai/enterprise-harness-engineering★ 44same name
- drafthq/draft★ 40same name
- Hack23/European-Parliament-MCP-Server★ 28same name
- suhailkakar/the-skills★ 26same name
- komluk/scaffolding★ 15same name
27 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.
In this repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-designSkill
- architecture-and-contractsSkill
- brand-and-identitySkill
- code-review-and-qualitySkill
- competitive-analysisSkill
- component-librarySkill
- cross-validationSkill
- database-designSkill
- data-visualizationSkill
- debugging-and-recoverySkill
- demo-narrativeSkill
- design-systemSkill
- documentation-hygieneSkill
- error-handling-and-resilienceSkill
- feedbackSkill
- forge-migrateSkill
- forge-syncSkill
- git-workflowSkill
- gtm-strategySkill
- idea-grillerSkill
- incident-response-and-postmortemsSkill
- incremental-implementationSkill
- interaction-patternsSkill
- observabilitySkill
- page-compositionSkill
- parallel-execution-strategySkill
- performance-and-cost-optimizationSkill
- planning-and-task-breakdownSkill
- redaction-and-cleanupSkill
- refactoring-and-tech-debtSkill
- scalability-analysisSkill
- security-and-complianceSkill
- seed-data-and-fixturesSkill
- shipping-and-launchSkill
- spec-driven-developmentSkill
- tddSkill
- triage-issueSkill
- using-forge-skillsSkill
- visual-polishSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 33 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 41
Every external service mocked at function level (mock the boundary instead)
- Very specific: line 51
Read .forge/prd.md if present.
- Distinctive: line 61
Default ratio: 70% unit / 20% integration / 10% e2e.
- Distinctive: line 69
Never mock the database in integration tests — use testcontainers
- Very specific: line 79
Document each target in .forge/testing-strategy.md with rationale.
- Distinctive: line 87
When a test flakes:
- Distinctive: line 93
No retry-on-fail config in CI.
“Common” is measured: kept by at least 6 in 10 of the 33 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
Overview
Define what gets tested, at what level, with what mocking — before tests proliferate. Output is .forge/testing-strategy.md — the test pyramid for this project (unit/integration/e2e ratio), what each level is responsible for, mocking philosophy, per-component coverage targets, the critical-path inventory, the flake quarantine policy, and CI gate definitions. Consumed by incremental-implementation, tdd, and code-review-and-quality.
When to Use
- A new project is starting and needs test conventions before code lands
- The test suite has grown organically and is slow, flaky, or inconsistent
- Coverage % is being treated as a goal and producing meaningless tests
- A team is mocking everything internally and tests pass while features break
- CI takes >15 minutes and the team is starting to skip tests
When NOT to Use
- Single-task work where
tddis the right skill (write the test, write the code) - Reference implementations or learning projects where tests aren't shipped
- The strategy exists, is followed, and only one component needs adjustment
Common Rationalizations
| Thought | Reality |
| "100% coverage is the goal" | Coverage measures lines hit, not behavior verified. 100% coverage of a deleted file is meaningless. |
| "Mock everything" | Mocking internals tests the mock, not the code. When the implementation changes, mocks lie. |
| "E2E is too slow, skip it" | One e2e test catches what 50 unit tests miss — integration between layers is where most bugs live. |
| "We'll add tests after" | Tests-after test imagined behavior, not actual behavior. They lock in accidents as decisions. |
| "Flaky tests just need a retry" | Retries hide bugs. A flaky test is a heisenbug — quarantine and fix the root cause. |
| "Test the implementation so refactors stay safe" | Refactors should change implementation freely. Tests on internals make refactoring expensive. |
Red Flags
- "100% coverage" as the explicit target
- A test file with
expect(spy).toHaveBeenCalledWith(...)and no other assertions - Every external service mocked at function level (mock the boundary instead)
- Zero end-to-end tests for the primary user journey
- A test that takes >30 seconds and runs on every commit
- A test that passes when the underlying feature is manually broken (snapshot rot, weak assertions)
- A retry config on
pytest/vitest/jestto "fix" flakes
Core Process
Step 1: Identify critical user paths
Read .forge/prd.md if present. List the 3-7 user journeys that, if broken, ship a broken product. Each is an e2e candidate. Everything else is unit/integration.
Step 2: Decide test level per path
| Level | Tests | When |
| Unit | Pure functions, business logic, transformations | Single module, no I/O |
| Integration | Module + its real adapter (real DB, real HTTP via testcontainers) | Boundaries, contracts |
| E2E | Full stack, real browser if frontend | Critical user paths only |
Default ratio: 70% unit / 20% integration / 10% e2e. Adjust based on what's risky.
Step 3: Define mocking boundaries
The rule: mock at the seam, not inside the module.
- Mock the HTTP client, not your service-that-calls-HTTP
- Mock the message broker, not the consumer-that-uses-the-broker
- Mock time, randomness, and the file system at the lowest seam (injected clock, seeded RNG, in-memory FS)
- Never mock the database in integration tests — use testcontainers
Step 4: Set per-component coverage targets
Not "80% across the project." Per-component:
- Pure business logic: 90%+ line + branch coverage
- Adapters (HTTP/DB clients): integration-test coverage (line % less meaningful)
- UI components: behavior coverage (clicks, keyboard, screen reader), not snapshot
- Glue code: lower bar, but every error path tested
Document each target in .forge/testing-strategy.md with rationale.
Step 5: Write golden tests for invariants
Identify 3-10 invariants per critical module (e.g., "ownership isolation never broken", "no negative balance possible", "no orphan rows after delete"). Write a property/golden test per invariant. These survive refactors.
Step 6: Define flake quarantine policy
When a test flakes:
- Quarantine immediately (skip with TODO + owner + deadline).
- Find root cause within 5 business days (timing? shared state? real bug?).
- Re-enable only after the root cause is fixed.
- Quarantine over 5 days = delete or rewrite.
No retry-on-fail config in CI. Flakes are bugs, not noise.
Step 7: Define CI gates
In .forge/testing-strategy.md:
- Which tests run on every push, every PR, nightly
- Total CI budget (e.g., <10 min PR, <30 min nightly)
- What's allowed to block merge (failing tests, coverage drop on critical modules)
- What's monitoring-only (flake rate, suite duration trend)
Step 8: Header
Prepend a forge:meta header to .forge/testing-strategy.md (generated_by: testing-strategy, generated_at: <ISO 8601 UTC with Z>, depends_on: [.forge/prd.md] — paths only, never hashes, generated_from: {.forge/prd.md: <upstream content_hash AT generation time>}, content_hash: <sha256 first 8 of THIS file's body>). See forge-dependency-graph.
Verification
.forge/testing-strategy.mdwritten with per-component coverage targets and rationale- Critical user paths each have at least one e2e test
- Boundary modules (HTTP / DB / queue) have integration tests against real dependencies (testcontainers or similar)
- Pure logic modules have unit tests with >90% branch coverage
- No mock of an internal collaborator (only mocks at seams)
- No test takes >5 seconds without a documented exception
- Flake rate <1% over the trailing 30 days (or quarantine policy active)
- CI runs in <10 minutes for PRs
- No
retries: Nconfig used to mask flakes
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

