From test-strategy
Designs optimal test pyramids with unit/integration/E2E ratios. Identifies anti-patterns like ice cream cone, cupcake, hourglass and recommends architecture-specific strategies.
How this skill is triggered — by the user, by Claude, or both
Slash command
/test-strategy:test-pyramid-designThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill when:
Use this skill when:
The Test Pyramid, introduced by Mike Cohn, visualizes the ideal distribution of tests across different levels. More granular tests at the bottom (fast, cheap) and fewer broad tests at the top (slow, expensive).
┌───────┐
/ E2E \ ~10%
/ Tests \ (UI, Acceptance)
/─────────────\
/ Integration \ ~20%
/ Tests \ (API, Component)
/───────────────────\
/ Unit Tests \ ~70%
/ (Fast, Cheap) \ (Methods, Classes)
└─────────────────────────┘
| Level | Speed | Cost | Scope | Confidence | Maintenance |
|---|---|---|---|---|---|
| Unit | Fastest (ms) | Lowest | Single unit | Low | Low |
| Integration | Medium (s) | Medium | Components | Medium | Medium |
| E2E | Slowest (min) | Highest | Full system | High | High |
/\ Unit: 70%+
/ \ Integration: 20%
/ \ E2E: 10%
/ \
/________\ Fast feedback, low maintenance
Characteristics:
██████████ E2E: 60%
████████ Integration: 30%
████ Unit: 10%
Problems:
Fix: Extract unit tests, reduce E2E scope
██████████ E2E: 40%
██████████ Manual: 50%
████ Unit: 10%
Problems:
Fix: Automate critical paths, add integration layer
██ E2E: 10%
██████████ Integration: 70%
██ Unit: 20%
Problems:
Fix: Push coverage down to unit level
/\ Unit: 70%
/ \ Integration: 20%
/ \ E2E: 10%
/______\
Focus on unit tests for business logic.
/\ E2E/Contract: 10%
/ \ Integration: 30%
/ \ Unit: 60%
/______\
More integration tests for service boundaries. Add contract tests between services.
/\ E2E: 10%
/ \ Integration: 35%
/ \ Unit: 55%
/______\
Integration tests for event handlers. Unit tests for event processing logic.
/\ E2E: 15%
/ \ Integration: 25%
/ \ Unit/Component: 60%
/______\
Component tests replace some unit tests. Visual regression testing at integration level.
Alternative for frontend applications:
┌─────┐
│ E2E │ ~5%
┌──┴─────┴──┐
│Integration│ ~50%
┌──┴───────────┴──┐
│ Static │ ~10%
┌──┴─────────────────┴──┐
│ Unit │ ~35%
└────────────────────────┘
Count tests by level:
Level | Count | % Total | Time | Pass Rate
-------------|-------|---------|---------|----------
E2E | 150 | 45% | 30 min | 85%
Integration | 100 | 30% | 10 min | 95%
Unit | 80 | 25% | 30 sec | 99%
| If You Have... | Shape | Priority Fix |
|---|---|---|
| E2E > 30% | Ice Cream Cone | Extract to lower levels |
| Unit < 50% | Inverted | Add unit tests for logic |
| Integration > 50% | Hourglass | Push to unit level |
| Manual > 20% | Cupcake | Automate critical paths |
Based on architecture:
| Architecture | Unit | Integration | E2E |
|---|---|---|---|
| Monolith | 70% | 20% | 10% |
| Microservices | 60% | 30% | 10% |
| Serverless | 50% | 40% | 10% |
| Frontend SPA | 40% | 45% | 15% |
Prioritize by ROI:
Should test:
Should NOT test:
Should test:
Should NOT test:
Should test:
Should NOT test:
src/
MyApp.Domain/ # Business logic
MyApp.Application/ # Use cases
MyApp.Infrastructure/ # Data access
MyApp.Api/ # HTTP endpoints
tests/
MyApp.Domain.Tests/ # Unit tests (70%)
Features/
Orders/
CreateOrderTests.cs
OrderValidationTests.cs
MyApp.Application.Tests/ # Integration tests (20%)
Features/
Orders/
CreateOrderHandlerTests.cs
MyApp.Api.Tests/ # E2E tests (10%)
Features/
Orders/
OrdersEndpointTests.cs
// Build script or CI check
public class TestDistributionTests
{
[Fact]
public void TestPyramidRatiosAreHealthy()
{
var unitTests = CountTestsInAssembly("MyApp.Domain.Tests");
var integrationTests = CountTestsInAssembly("MyApp.Application.Tests");
var e2eTests = CountTestsInAssembly("MyApp.Api.Tests");
var total = unitTests + integrationTests + e2eTests;
Assert.True(unitTests / total >= 0.60, "Unit tests should be ≥60%");
Assert.True(e2eTests / total <= 0.15, "E2E tests should be ≤15%");
}
}
| Metric | Healthy | Warning | Critical |
|---|---|---|---|
| Unit test time | < 1 min | 1-5 min | > 5 min |
| Integration time | < 5 min | 5-15 min | > 15 min |
| E2E test time | < 10 min | 10-30 min | > 30 min |
| Flaky test rate | < 1% | 1-5% | > 5% |
Track coverage by pyramid level:
Inputs from:
Outputs to:
test-strategy-planning skill → Strategy documentautomation-strategy skill → Automation scopenpx claudepluginhub melodic-software/claude-code-plugins --plugin test-strategyDesigns a test pyramid strategy (unit/integration/e2e) when test suites are slow, flaky, or imbalanced. Audits ratios, defines test categories, and builds layers with target distributions (e.g., 80/15/5).
Design test pyramid architecture balancing unit, integration, and E2E tests. Use when establishing test level distribution and automation strategy.
Guides test pyramid structure, coverage targets, and patterns for unit, integration, and E2E tests. Includes AAA pattern, naming conventions, and API test checklist.