Analyzes any web project and recommends a comprehensive testing strategy: what to test, which test type to use (unit, integration, component, E2E), how to prioritize coverage, and what mocking approach to follow. Can also generate tests based on its recommendations when the user asks. Use this skill when the user asks "what should I test", "create a testing strategy", "what tests does this project need", "analyze test coverage gaps", "which parts of my code need tests", "help me prioritize testing", "review my tests", "generate tests for this module", or any request to plan, evaluate, or create tests for a codebase. Also triggers when the user mentions testing pyramid, test coverage, TDD, test-driven development, or asks about the right type of test for a piece of code.
Analyzes a web project and produces a testing strategy that answers the three questions developers struggle with most: what to test, with which type of test, and in what order of priority. When asked, also generates the tests themselves.
Scan the project for configuration files, dependency manifests, and existing test files to determine:
If the project already has tests, the strategy should build on what exists rather than propose a replacement. If no testing framework is present, recommend one based on the detected stack.
Record the detected stack and testing setup at the top of the strategy document.
Identify the codebase areas that are testable:
Map each area to the test types it needs. Read references/test-type-guide.md for detailed decision criteria.
The testing pyramid is the foundation of the strategy. It defines the ratio of test types:
/ E2E \ Few, slow, expensive — critical flows only
/----------\
/ Component \ Moderate — UI behavior and interaction
/--------------\
/ Integration \ More — module boundaries, APIs, data access
/------------------\
/ Unit Tests \ Many, fast, cheap — business logic and utilities
/______________________\
The pyramid exists because of economics: unit tests are fast, cheap, and precise. E2E tests are slow, expensive, and brittle. A healthy strategy has many unit tests, fewer integration tests, fewer component tests, and very few E2E tests.
Recommended ratios (adapt based on project type):
| Project Type | Unit | Integration | Component | E2E | |---|---|---|---|---| | API / Backend | 60% | 30% | — | 10% | | Fullstack web app | 40% | 25% | 25% | 10% | | SPA with external API | 30% | 15% | 40% | 15% | | Static site with forms | 20% | 10% | 50% | 20% |
This adaptive model reconciles the classic testing pyramid with the Testing Trophy (Kent C. Dodds), which argues that integration tests deliver the most confidence per dollar invested. Both models are valid — the ratios above shift based on where your project's complexity lives, not on dogma. An API-heavy backend leans toward the pyramid; a frontend-heavy SPA leans toward the trophy.
These are guidelines, not rules. The right ratio depends on where the complexity lives.
For each piece of code in the project, use this decision tree to determine the right test type:
Is it a pure function with no dependencies? → Unit test. Fast, isolated, test inputs and outputs.
Does it coordinate multiple internal modules? → Integration test. Test the modules working together with real (or realistic) dependencies.
Does it call an external service, database, or API? → Integration test with mocked external boundaries. The external service is mocked, but internal logic runs for real.
Is it a UI component with user interaction? → Component test. Render the component, simulate user actions, assert on visible output. Don't test implementation details.
Is it a critical end-to-end user flow? → E2E test. Only for flows where failure means business impact: authentication, checkout, data submission, onboarding.
Is it glue code, configuration, or trivial logic? → Don't test it. Testing configuration files, simple getters, or framework boilerplate adds cost without value.
Read references/test-type-guide.md for detailed criteria, examples, and edge cases for each test type.
When time is limited (it always is), test in this order:
Priority 1 — Security and data integrity:
Priority 2 — Core business logic:
Priority 3 — Integration boundaries:
Priority 4 — User-facing behavior:
Priority 5 — Utilities and edge cases:
Read references/coverage-strategy.md for coverage targets, metrics guidance, and how to assess existing coverage gaps.
Mocking is necessary but dangerous. Over-mocking means testing mocks instead of code. Under-mocking means slow, flaky tests.
Mock at the boundary, not inside the unit:
Use the lightest mock that works:
When testing tells you something: If a function is hard to test because it has too many dependencies, that's not a testing problem — it's a design problem. The difficulty of testing is feedback about the code's design. Consider refactoring the code rather than adding more mocks.
Read references/anti-patterns.md for detailed descriptions and fixes. The most critical ones:
This skill operates in two modes:
When the user asks for a testing strategy, analysis, or recommendations, produce a strategy document that includes:
When the user asks to generate, write, or create tests, switch to generation mode:
When generating tests, follow the project's existing test conventions. If no conventions exist, place test files adjacent to the code they test and use the framework's standard naming convention.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer