| name | test-strategy |
| description | Analyze testing approach — what to test, how to test, coverage gaps, and test quality. Trigger on /test-strategy, or when planning tests, reviewing test gaps, or debugging flaky tests. |
| user-invocable | true |
| allowed-tools | Read, Grep, Glob, Bash |
Test Strategy
Decide what to test and how. Focus on risk, not coverage percentages.
Workflow
1. Map the test surface
- What are the public APIs / entry points?
- What are the critical paths (auth, payment, data persistence)?
- What has changed recently (high regression risk)?
- What has no tests at all?
2. Test type selection
| Type | When to use | When NOT to use |
|---|
| Unit | Pure logic, utilities, isolated components | When test needs DB/network/filesystem |
| Integration | DB queries, API routes, external service calls | When setup cost > value of test |
| E2E | Critical user journeys, payment flows | For internal implementation details |
| Snapshot | UI output, serialization formats | For large data that changes often |
3. Test quality check
- Meaningful assertions — does it assert the right thing, or just that nothing threw?
- Test isolation — do tests share state that causes flakiness?
- Coverage honesty — does line coverage actually mean behavior coverage?
- Over-mocking — are mocks so thick that the test passes but production breaks?
4. Gap analysis
- Untested error paths (network error, DB timeout, auth failure).
- Untested edge cases (empty results, max input, concurrent access).
- Untested configurations (feature flags, env variants).
- Tests that pass for the wrong reason (overfit to implementation).
5. Flaky test protocol
- Isolate: does it fail consistently on certain conditions?
- Stabilize: fix the root cause, not retry the test.
- Quarantine: move flaky tests to a separate suite if they block CI.
Experience Log
This skill learns from experience. Mechanism:
- Read
.claude/experience/test-strategy.md at skill start to benefit from past lessons.
- Write to
.claude/experience/test-strategy.md after use if you learned something new.
- Format:
YYYY-MM-DD: <lesson> — one line per entry.
- Evolve: If the same issue repeats 3+ times, update this SKILL.md itself.