plugins/frontend-toolkit/skills/test-strategy/SKILL.md
Apply the Testing Trophy (mostly integration tests with RTL + MSW, sparing E2E with Playwright) and set coverage thresholds. Use before new feature work, after bug fixes, when CI coverage falls below target, or when tests are flaky or break on every refactor. Not for wiring coverage gates + Playwright into the GitHub Actions matrix (use cicd-pipeline) or auditing WCAG a11y compliance (use accessibility-audit).
npx skillsauth add jaykim88/claude-ai-engineering test-strategyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Follow the Testing Trophy: write integration tests mostly, supported by unit tests for pure logic and minimal E2E for critical journeys. Establish CI thresholds so coverage doesn't silently degrade.
Universal — the Testing Trophy ROI model and 3-handler-per-endpoint convention apply to any framework; only the test runner and component-rendering library differ.
Run coverage analysis (validation loop)
Unit tests — pure functions & custom hooks
Integration tests — the bulk
getByRole > getByLabelText > text > getByTestId doubles as an a11y signal: if you can't query by role, the component is probably inaccessibleE2E — critical user journeys only
Component-level a11y checks
Keep tests deterministic (flake kills suites)
vi.useFakeTimers) for debounce/throttle/intervals; never an arbitrary setTimeout/sleep to "wait for" somethingfindBy* / waitFor (not getBy* before data resolves); userEvent is async, await itMath.random, freeze Date.now, mock every request (a test that hits the real network is flaky by definition)CI configuration
[e2e] label)Explicit non-targets
| Tier | Examples | Action SLA |
|---|---|---|
| Critical | 0% coverage on auth / payment / data-integrity paths; no E2E for the primary user journey; tests fail intermittently | Block release; fix immediately |
| Major | Business-logic coverage < 50%; missing error/empty MSW handlers; tests assert implementation details (break on refactor); no Storybook a11y on shared components | Fix this sprint |
| Minor | Utility coverage < 80%; missing CI flake detection (--repeat-each); no visual-regression on critical pages; unused test helpers | Schedule within 2 sprints |
Default coverage target if no project-specific target is set: branch coverage ≥ 70% overall; ≥ 90% for security-critical paths.
--repeat-each*.test.ts (unit) / *.test.tsx (integration with RTL) / e2e/*.spec.ts (Playwright)src/mocks/handlers.ts exporting one handler per endpoint (happy / error / empty variants).github/workflows/ci.yml includes vitest run --coverage with threshold + playwright test for critical journeystest(<scope>): <description> for test additions; fix(<scope>): <description> + test for regression-driven additionsvitest run --coverage)screen.getByRole, userEventnpx playwright test --repeat-each=10 for flake detection)vi.useFakeTimers() for timers; await userEvent.*; findBy*/waitFor for async; stub Math.random / vi.setSystemTimeexpect(page).toHaveScreenshot() or Chromatic (Storybook)@testing-library/vue); MSW works identically; Playwright for E2E@testing-library/svelte; MSW or Vitest's built-in vi.fn() for mocks; Playwright for E2E (built into SvelteKit's default template)@testing-library/angular); MSW for HTTP mocks; Playwright or Cypress for E2Ecomponent-quality — extracted hooks/components need accompanying testscicd-pipeline — wire coverage threshold + Playwright into the GitHub Actions matrixaccessibility-audit — Storybook a11y addon runs as part of the test pipelinedevelopment
Audit and optimize third-party scripts — analytics, tag managers, chat widgets, embeds — with the right loading strategy, performance budget, facades, and CSP/consent controls. Use when adding a script, when TBT/INP regress, when a GDPR/CCPA consent requirement arises, or before shipping. Not for first-party bundle size (use bundle-optimization) or broad Core Web Vitals diagnosis (use rendering-performance).
development
Inventory and prioritize technical debt — TODO/FIXME/HACK, any usage, deprecated APIs, untested logic — with impact × effort matrix. Use at quarter start, before a refactoring sprint, when a new teammate joins, or when feature velocity slows. Not for actually paying down debt (use code-refactoring) or recording a migration approach (use decision-records) — this only inventories and prioritizes.
development
Decision framework for choosing the right state location — URL, server cache, local component, or shared/global store. Use when state-sync bugs appear, prop drilling gets deep (3+ levels), filters/tabs lose state on reload, or quarterly review. Not for form state specifically (use form-ux) or when the state is actually server data (use api-caching-optimization).
development
Apply Next.js Metadata API per route — title template, og:image, generateMetadata for dynamic pages, JSON-LD structured data, robots, sitemap, canonical, hreflang. Use when adding a new route, when search visibility drops, when rich results are needed, or before shipping. Not for choosing a route's render mode (use render-strategy-decision); align generateMetadata with that route caching choice.