agentleFS
aks-buildsaks-builds/quality-skills/skills/test-strategy/SKILL.md

test-strategy

Skill5 starsChanged 6 months agoMITView on GitHub

When the user wants to design, audit, or evolve a test strategy — the shape of their test pyramid, the balance of unit / integration / E2E / contract / perf / accessibility tests, what shifts left vs right, what each layer is and isn't responsible for, and how to gate releases. Use when the user mentions "test strategy," "test pyramid," "test trophy," "test ice cream cone," "shift-left," "shift-right," "risk-based testing," "test gates," "balance our test suite," "where to draw the testing line," or "what tests should we write." For specific test-data approach see test-data-management. For environments see test-environment-management. For flake see flaky-test-management.

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use incident-response, observability and 3 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.
  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 5 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 4 projects that use this

  • LLl0k0laDSkill

    security-and-hardening

    Use when handling user input, authentication, data storage, or external integrations. Use when building any feature that accepts untrusted data, manages user sessions, or interacts with third-party services.

    Also in 3 projects that use this

  • mrgoonieSkill

    context-engineering

    Master context engineering for AI agent systems. Use when designing agent architectures, debugging context failures, optimizing token usage, implementing memory systems, building multi-agent coordination, evaluating agent performance, or developing LLM-powered pipelines. Covers context fundamentals, degradation patterns, optimization techniques (compaction, masking, caching), compression strategies, memory architectures, multi-agent patterns, LLM-as-Judge evaluation, tool design, and project development.

    Also in 4 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. 0 are common, 12 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 22 edited versions we read keep these.

  • 12

    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
  1. Very specific:

    Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering.

    line 14
  2. Distinctive:

    If the file does not exist, ask: architecture, deployment cadence, team makeup, what specific pain is prompting the strategy review.

    line 22
  3. Distinctive:

    No I/O (or in-memory only).

    line 82
  4. Distinctive:

    Run in milliseconds; thousands run in seconds.

    line 83
  5. Distinctive:

    Don't catch: integration mismatches, real-network behavior, infra issues.

    line 85
  6. Distinctive:

    Run in seconds to minutes.

    line 90
  7. Distinctive:

    Use Testcontainers / fakes for infra (cross-reference testcontainers).

    line 91
  8. Distinctive:

    Run on schedules, not every commit, against a representative environment.

    line 116
  9. Distinctive:

    Should be a continuous concern, not a phase.

    line 130
  10. Distinctive:

    Not every feature warrants equal testing.

    line 157
  11. Very specific:

    Read qa-context.md for architecture, languages, cadence, compliance.

    line 203
  12. Distinctive:

    Document the strategy somewhere accessible (this skill's output, a doc, an ADR).

    line 210
  13. Distinctive:

    When helping with strategy, ask:

    line 224
  14. Distinctive:

    All language unit-test skills (jest-vitest / pytest / junit-testng / xunit-nunit / go-test / rspec) and platform skills (playwright / …

    line 247

“Common” is measured: kept by at least 6 in 10 of the 22 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test Strategy

You are an expert in designing test strategies — deciding what to test where, what to test how, and what not to test at all. Your goal is to help teams build a testing approach proportional to their risk, language stack, and constraints rather than a one-size-fits-all pyramid copied from a blog post. Don't fabricate strategy patterns or invented categorical bins. Anchor recommendations in well-known frameworks (test pyramid, testing trophy, risk-based testing) and in the specific context the user describes.

Initial Assessment

Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:

  • Architecture — monolith, microservices, mobile app, embedded system, ML / data pipeline. Strategies differ.
  • Team shape — engineer-owned tests, dedicated QA, hybrid. Determines authoring patterns.
  • Existing pyramid — what's already in place, what's broken, what's missing.
  • Compliance constraints — regulated industries (healthcare, finance, automotive) drive specific test categories.
  • Release cadence — multi-deploy-per-day vs quarterly release. Affects how much can ride on E2E gates.

If the file does not exist, ask: architecture, deployment cadence, team makeup, what specific pain is prompting the strategy review.


The pyramid (and its critics)

Mike Cohn's pyramid says: many fast, focused unit tests at the base; fewer slower integration tests in the middle; very few expensive end-to-end tests at the top.

         /\
        /  \      End-to-End (few)
       /----\
      /      \    Integration (some)
     /--------\
    /          \  Unit (many)
   /____________\

It's still a useful shape for most stacks. The critics (e.g., Kent C. Dodds with the "testing trophy") argue for more weight on integration in frontend / React projects:

       _____
      |     |     End-to-End
      |-----|
      |     |
      |     |     Integration
      |     |
      |-----|
      |     |     Unit
       |---|
       |   |      Static (types, lint)
       -----

Both are heuristics. Pick the shape that matches your stack's failure modes. A backend with rich domain logic favors the pyramid; a React UI with heavy component composition favors the trophy.

The ice cream cone (anti-pattern)

Many real-world suites are inverted:

   /------------\
  /              \   E2E + manual (most)
 /----------------\
  \              /   Integration (some)
   \            /
    \----------/
     \        /     Unit (few)
      \------/

Slow, brittle, expensive. Recommend climbing back down the pyramid by pushing tests into faster layers.


What goes where — concrete bins

Unit tests (cross-reference jest-vitest / pytest / junit-testng / xunit-nunit / go-test / rspec)

  • Pure functions, classes, modules.
  • No I/O (or in-memory only).
  • Run in milliseconds; thousands run in seconds.
  • Catch: logic bugs, type errors at runtime, boundary mistakes.
  • Don't catch: integration mismatches, real-network behavior, infra issues.

Integration tests

  • Multiple modules together; often with real DB / queue / cache.
  • Run in seconds to minutes.
  • Use Testcontainers / fakes for infra (cross-reference testcontainers).
  • Catch: wiring bugs, ORM / serialization issues, configuration drift.

Contract tests (cross-reference pact-contract-testing)

  • Between services / between consumer and provider.
  • Bind both sides to a stable shape.
  • Catch: cross-team API breakage before deploy.

Component tests (UI specifically)

  • Render a single component, drive it, assert behavior.
  • Faster than full E2E but exercises rendering.
  • Cross-reference cypress (component) / jest-vitest (with RTL / VTU).

End-to-end (UI or full-stack)

  • Drive the real product through its real interfaces (browser, mobile, or API).
  • Slow, fragile if poorly designed.
  • Reserve for golden-path customer journeys — checkout, login, the small set of flows whose breakage would visibly hurt customers.
  • Cross-reference playwright / cypress / selenium / appium / detox / maestro.

Performance tests (cross-reference k6 / jmeter / gatling / locust / artillery)

  • Validate latency / throughput / error rate against SLO.
  • Run on schedules, not every commit, against a representative environment.

Accessibility tests (cross-reference accessibility-testing)

  • WCAG conformance, screen-reader behavior, keyboard nav.
  • Both automated (axe / Lighthouse) and manual review.

Visual regression (cross-reference visual-regression)

  • Pixel / DOM-snapshot diffs. Catches visual regressions automated tests miss.

Security tests (cross-reference security-testing)

  • SAST, DAST, dependency scanning, authn / authz tests.
  • Should be a continuous concern, not a phase.

Chaos / resilience (cross-reference chaos-engineering)

  • Inject failures (latency, dropped connections, dead dependencies) and verify the system degrades gracefully.

Mutation testing (cross-reference mutation-testing)

  • Measures test quality — does the suite catch deliberate code-level bugs?
  • Gap-finding tool, not a release gate.

Shift-left and shift-right

Shift-leftShift-right
WhatCatch problems earlier — at PR time / pre-mergeValidate in production via monitoring, canaries, A/B
ExamplesUnit / integration / contract / SAST / lintSynthetic monitoring (cross-reference production-testing), feature flags, canaries
Trade-offMore confidence pre-deploy; risk of slow feedback loopFaster delivery; trust that prod observability catches issues

Modern shops do both. Shift-left for what you can know early; shift-right for what only production traffic reveals.


Risk-based testing

Not every feature warrants equal testing. Allocate based on:

  • Likelihood of failure — complex code, recent changes, churn, junior author, deep dependency chain.
  • Impact of failure — revenue, safety, compliance, customer trust.

High-risk × high-impact = invest heavily in coverage. Low-risk × low-impact = minimal smoke testing. The risk matrix is the single best tool for arguing against "we need 100% coverage on everything."


Release gates

A gate is a hard check before code can ship. Typical gates:

GateWhere
Lint / typecheckPre-commit + PR
Unit testsPR required check
Integration testsPR required check
Contract testsPR required check (consumer side); deploy gate (can-i-deploy, cross-reference pact-contract-testing)
Smoke E2EPR required check (small subset only)
Full E2EPost-merge / pre-deploy / scheduled
Performance smokePre-deploy or scheduled
Security scanPR required check
Accessibility scanPR required check (or warn)

Don't gate on slow / flaky tests in PR CI — they train the team to ignore failures. Reserve PR gates for fast, reliable signals. Cross-reference ci-test-orchestration.


Common Pitfalls

  • Copying a pyramid shape that doesn't fit the stack — frontend-heavy projects often need more integration / component testing than the classic pyramid suggests.
  • Treating "100% coverage" as a goal — high coverage with weak assertions is worse than lower coverage with strong ones. Cross-reference code-coverage and mutation-testing.
  • Letting E2E grow unbounded — at 500+ E2E tests, the suite becomes a maintenance liability that overshadows the bugs it catches.
  • No contract tests in a multi-service shop — every cross-service deployment is a guess.
  • No accessibility / security / performance considerations at all — these are quality dimensions, not optional bolt-ons.
  • Mixing CI gates for different signal qualities — a flaky test as a required gate erodes trust in all signals.
  • Strategy that doesn't account for the team that has to maintain it — a beautiful pyramid an under-resourced team can't sustain is worse than a pragmatic ice cream cone the team actually maintains.
  • No exit criteria for tests — tests get added but never deleted. Suite size grows monotonically; signal-to-noise degrades.

Building or auditing a strategy

From scratch

  1. Read qa-context.md for architecture, languages, cadence, compliance.
  2. Identify the 5-10 highest-risk × highest-impact flows. These get the most investment.
  3. Pick a pyramid shape that matches the stack (true pyramid for backend-heavy, trophy for frontend-heavy).
  4. Decide which test types belong (unit, integration, contract, E2E, perf, a11y, security).
  5. Define gates per type: which run on PR, which on merge, which on schedule.
  6. Define ownership — who maintains each layer.
  7. Set quality bar: coverage targets, flake budget, run-time SLOs for the suite itself.
  8. Document the strategy somewhere accessible (this skill's output, a doc, an ADR).

Auditing an existing strategy

  1. Map current tests by type and run frequency.
  2. Identify gaps (no contract tests? No a11y?) and over-investments (1000 E2E tests?).
  3. Measure suite health: run time, flake rate, recent failures, age of oldest skipped test.
  4. Triage: keep, fix, delete. Be willing to delete.
  5. Update gates accordingly.

Task-Specific Questions

When helping with strategy, ask:

  1. Architecture — monolith, microservices, mobile, embedded, ML?
  2. Stack — primary languages and frameworks?
  3. Release cadence — multi-per-day, weekly, quarterly?
  4. Team — engineer-owned tests, dedicated QA, hybrid?
  5. What's the current pyramid shape, and is it healthy?
  6. Compliance constraints driving specific test categories?
  7. What's the specific pain — slowness, flake, gaps, all of the above?

Related Skills

  • qa-context — the foundation strategy is built on.
  • test-design-techniques — how to write good cases within the chosen layer.
  • test-data-management — strategy for the data those tests need.
  • test-environment-management — where those tests run.
  • flaky-test-management — the most common reason a strategy is failing.
  • ci-test-orchestration — how gates are actually enforced.
  • pact-contract-testing — the missing layer in many multi-service strategies.
  • code-coverage / mutation-testing — for measuring strategy effectiveness.
  • bdd-anti-patterns — for placing or rejecting BDD in the strategy.
  • All language unit-test skills (jest-vitest / pytest / junit-testng / xunit-nunit / go-test / rspec) and platform skills (playwright / cypress / selenium / appium / detox / maestro) are the building blocks.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.