Testland
Browse all skills & agents

tdd-stuck-pattern-resolver

Pattern catalog for "I can't write the test first" moments - recognizes common testability blockers (singletons / static dependencies, network in constructors, time / random as hidden inputs, deeply nested construction, untestable boundaries) and proposes the refactor that unblocks TDD (extract interface, dependency injection, seam, ports-and-adapters). Use as TDD coaching when an engineer is stuck on a class of code. For a catalog of what-to-test heuristics with no story use heuristic-test-design-reference, to label a change's shape before planning test effort use code-change-shape-classifier, and for conventions on writing the test well once the code is testable use test-code-conventions.

Install with skills.sh (any agent)

npx skills add testland/qa --skill tdd-stuck-pattern-resolver
View source

tdd-stuck-pattern-resolver

Overview

TDD's "write the test first" rule breaks against certain code shapes. The engineer hits the wall, abandons TDD, writes the code first, then writes the test second (or skips it). The wall isn't TDD - it's the code shape.

This skill is a catalog of common stuck patterns + the refactor that unsticks each. It's a coaching reference, not a prescription - the engineer picks the appropriate refactor for their codebase.

When to use

  • An engineer says "I can't write the test first for this."
  • A pairing session reveals testability gaps.
  • A codebase has many "I'll add tests later" comments.
  • A new engineer is learning TDD and hits common blockers.

For TDD basics, defer to Kent Beck's Test-Driven Development by Example (opens in new window) (the canonical reference). This skill addresses the second-order problem: the code resists TDD.

How to use

  1. When an engineer says "I can't write the test first," name the code shape that's blocking - which of the eight patterns below it matches.
  2. Run the decision tree to route the symptom to a pattern number.
  3. Open the matching references file for the full before/after example and the seam it introduces.
  4. Apply the refactor incrementally - one method or one dependency at a time (strangler fig), never a big-bang rewrite.
  5. Move the substituted dependency to the single composition root, so construction becomes pure assignment.
  6. Write the test first now that the seam exists, passing a fake at the seam.
  7. Repeat per blocker; defer to Beck for TDD basics and test-code-conventions for writing the test well.

The stuck patterns

Each pattern pairs a testability blocker with the refactor that opens a seam. Full before/after code for every pattern lives in the linked references file.

#Stuck patternRefactorFull example
1Singleton / static dependencyDependency injectionreferences/injection-patterns.md
2Network (or other I/O) in constructorPush side effects out of constructionreferences/injection-patterns.md
3Time / random as hidden inputInject the source (now, rand, Clock)references/injection-patterns.md
4Untestable boundaries (file system, OS)Ports-and-adapters (hexagonal)references/boundary-adapter-patterns.md
5Deeply nested constructionFactory + composition rootreferences/structural-patterns.md
6Untestable private methodsTest through the public interface, or extract a classreferences/structural-patterns.md
7Async / Promise-heavy codeSplit into orchestrator + injected stepsreferences/structural-patterns.md
8Code that calls third-party SDKsAdapter (don't mock what you don't own)references/boundary-adapter-patterns.md

Decision tree

Is your test setup more than 10 lines?         → Pattern 5 (composition root)
Is your test using `await fetch` / network?    → Pattern 4 (port/adapter) or Pattern 8 (gateway adapter)
Does your code call `Date.now()` / `Math.random()`? → Pattern 3 (inject)
Are you wanting to mock a singleton?            → Pattern 1 (DI)
Constructor does I/O?                           → Pattern 2 (push out)
Async chain with 5+ awaits?                     → Pattern 7 (orchestrator)
Want to test private methods?                   → Pattern 6 (extract or test through public)

Worked example

An engineer is stuck on processOrder, which reads its data through a global singleton:

function processOrder(orderId) {
  const order = Database.getInstance().findOrder(orderId);
  // ...
}
  1. Route it. The decision tree entry "wanting to mock a singleton" points to Pattern 1.
  2. Open references/injection-patterns.md and apply Dependency Injection: add a db parameter so the caller supplies the dependency.
  3. Move Database.getInstance() to the composition root, the single place that passes it in production.
  4. Write the test first, injecting a fake: processOrder(1, { findOrder: () => ({ id: 1 }) }).

Result: the test runs with no global state touched, and the "I can't write the test first" wall is gone - the blocker was the code shape, not TDD.

Anti-patterns

Anti-patternWhy it failsFix
Skipping the test first because "this is hard to test"Code stays untestable; debt compounds.Apply one of the patterns.
Reflection to access private methodsCouples tests to implementation; refactors break.Test through public interface (Pattern 6).
Mocking 5 globals to test one functionBrittle; tests verify mocks, not behavior.DI + factory (Patterns 1, 5).
"We'll refactor later"Later never comes.Apply pattern incrementally - one method at a time.
Big-bang refactor for testabilityRisky; tests break for unrelated reasons.Strangler fig - incrementally extract; test new code; old code unchanged.

Limitations

  • Patterns are language-agnostic; idioms vary. Java's DI framework (Spring) differs from JS's manual injection.
  • Refactor cost. Some refactors require touching many files; budget accordingly.
  • Architectural-level patterns. Hexagonal architecture is a large commitment; for small projects, simpler patterns suffice.
  • Doesn't replace TDD training. Apply alongside Beck-style TDD coaching, not as a substitute.

References

  • Beck, K., Test-Driven Development by Example (2003) - the canonical TDD reference.
  • Working Effectively with Legacy Code by Michael Feathers (2004) - the canonical "how to add tests to untestable code" reference; introduces the "seam" concept this skill draws from.
  • test-code-conventions - §5 covers the test-double taxonomy this skill references.

Boundary and adapter patterns

View source (opens in new window)

Boundary and adapter patterns

Wrap an external boundary you don't own - the file system, OS calls, or a third-party SDK - behind an interface you do own, then inject a fake in tests. Covers stuck Patterns 4 and 8 of tdd-stuck-pattern-resolver.

Pattern 4 - Untestable boundaries (file system, OS calls)

# Stuck - direct file system access
def load_config():
    with open('/etc/myapp/config.json') as f:
        return json.load(f)

Why it's stuck: test setup requires creating files at fixed paths; tests pollute the filesystem.

Refactor - Hexagonal / Ports-and-Adapters:

# Define a port (interface)
class ConfigSource(Protocol):
    def read(self) -> dict: ...

# Production adapter
class FileConfigSource:
    def __init__(self, path):
        self.path = path
    def read(self):
        with open(self.path) as f:
            return json.load(f)

# Test adapter
class FakeConfigSource:
    def __init__(self, config):
        self.config = config
    def read(self):
        return self.config

# Use the port:
def load_config(source: ConfigSource):
    return source.read()

Tests inject FakeConfigSource({...}); production injects FileConfigSource('/etc/...').

Pattern 8 - Code that calls third-party SDKs

// Stuck - direct Stripe SDK call
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_KEY);

async function charge(amount) {
  return await stripe.paymentIntents.create({ amount, currency: 'usd' });
}

Why it's stuck: SDK instances aren't easily mocked; testing without real network is hard.

Refactor - Adapter (don't mock what you don't own):

interface PaymentGateway {
  charge(amount: number): Promise<{ id: string }>;
}

class StripeGateway implements PaymentGateway {
  constructor(private stripe: Stripe) {}
  async charge(amount: number) {
    const intent = await this.stripe.paymentIntents.create({ amount, currency: 'usd' });
    return { id: intent.id };
  }
}

class FakePaymentGateway implements PaymentGateway {
  async charge(amount: number) {
    return { id: 'fake-charge-' + amount };
  }
}

Tests use FakePaymentGateway; production uses StripeGateway. The team owns the interface; mocking is fine - don't mock what you don't own.

Injection patterns

Substitute a dependency by injecting it at a seam instead of reaching for a global or a hidden source. Covers stuck Patterns 1, 2, and 3 of tdd-stuck-pattern-resolver.

Pattern 1 - Singleton / static dependency

// Stuck - depends on a global database client
function processOrder(orderId) {
  const order = Database.getInstance().findOrder(orderId);   // singleton
  // ...
}

Why it's stuck: the test can't substitute a fake DB without modifying global state.

Refactor - Dependency Injection:

function processOrder(orderId, db) {
  const order = db.findOrder(orderId);
  // ...
}

// Test:
test('processOrder fetches the order', () => {
  const fakeDb = { findOrder: () => ({ id: 1 }) };
  processOrder(1, fakeDb);
});

The DB is now injected; the test passes a fake. Production code calls processOrder(orderId, Database.getInstance()) from the single composition root.

Pattern 2 - Network in constructor

// Stuck - constructor side-effects
class OrderService {
  constructor() {
    this.config = await fetch('/config').then(r => r.json());   // 😱
  }
}

Why it's stuck: instantiating the class to test it triggers the network call.

Refactor - push side effects out of construction:

class OrderService {
  constructor(config) {
    this.config = config;
  }
}

// Composition root:
const config = await fetch('/config').then(r => r.json());
const orderService = new OrderService(config);

// Test:
const orderService = new OrderService({ /* fake config */ });

Construction = pure assignment. Side effects happen at composition.

Pattern 3 - Time / random as hidden input

// Stuck - uses Date.now() and Math.random() directly
function generateInvoice(items) {
  return {
    id: `INV-${Date.now()}-${Math.random()}`,
    items,
  };
}

Why it's stuck: the test can't predict the output.

Refactor - inject the source:

function generateInvoice(items, { now, rand }) {
  return {
    id: `INV-${now()}-${rand()}`,
    items,
  };
}

// Production:
generateInvoice(items, { now: Date.now, rand: Math.random });

// Test:
generateInvoice([item], { now: () => 1000, rand: () => 0.5 });
// Asserts: id === 'INV-1000-0.5'

For more comprehensive control, use a Clock interface (the same injection pattern applies to database connections).

Structural patterns

Restructure how the code is assembled or sequenced so a test can reach the unit under test without rebuilding the world. Covers stuck Patterns 5, 6, and 7 of tdd-stuck-pattern-resolver.

Pattern 5 - Deeply nested construction

// Stuck - chain of constructions
function processOrder(orderId: string) {
  const repo = new OrderRepo(new DbConnection(new ConfigLoader(new FileReader('/etc/...'))));
  return new OrderService(repo).process(orderId);
}

Why it's stuck: test setup needs to construct the whole tree.

Refactor - Factory + composition root:

// Composition root (one place per app)
function buildAppContainer() {
  const reader = new FileReader('/etc/...');
  const config = new ConfigLoader(reader);
  const conn = new DbConnection(config);
  const repo = new OrderRepo(conn);
  const service = new OrderService(repo);
  return { service, /* others */ };
}

// Production:
const { service } = buildAppContainer();
await service.process(orderId);

// Test (just the service, with fakes):
const service = new OrderService(new FakeOrderRepo());
await service.process(orderId);

Production composes once at startup; tests skip the entire chain.

Pattern 6 - Untestable private methods

// Stuck - wants to test a private helper
class OrderProcessor {
    fun process(order: Order) { /* ... */ }
    private fun calculateTotal(items: List<Item>): Double { /* ... */ }
}

Why it's stuck: the test can't reach the private method without reflection (a code smell).

Refactor options:

Default: Test through the public interface. If calculateTotal matters, it affects process(...)'s output; test that. Keeps tests decoupled from implementation. Use the alternatives below only when this default doesn't fit the situation described.

  1. Test through the public interface (the default - use unless the conditions below apply).

  2. Extract to a separate class with public methods - use when the private logic is genuinely independent and reused, or complex enough that public-interface tests can't pin its behaviour:

class TotalCalculator {
    fun calculate(items: List<Item>): Double { /* ... */ }
}

class OrderProcessor(private val totalCalculator: TotalCalculator) {
    fun process(order: Order) {
        val total = totalCalculator.calculate(order.items)
        // ...
    }
}

Then TotalCalculator is tested directly; OrderProcessor tested with a fake.

  1. Make it internal (Kotlin / Scala) - escape hatch when extraction is overkill but reflection is worse; only when the language supports module-private visibility.

Pattern 7 - Async / Promise-heavy code

// Stuck - sequential async operations
async function checkout(cart) {
  const tax = await taxService.calculate(cart);
  const charge = await stripe.charge(cart.total + tax);
  await orderRepo.save({ cart, tax, charge });
  await emailService.sendConfirmation(cart.userId);
  return charge;
}

Why it's stuck: mocking each await; test setup gets long.

Refactor - split into orchestrator + steps:

async function checkout(cart, deps) {
  const { taxService, stripe, orderRepo, emailService } = deps;
  const tax = await taxService.calculate(cart);
  const charge = await stripe.charge(cart.total + tax);
  await orderRepo.save({ cart, tax, charge });
  await emailService.sendConfirmation(cart.userId);
  return charge;
}

Each deps.X is injected; tests pass per-test fakes.

For very complex async chains, consider a state machine or saga pattern - testable as state transitions, not sequential awaits.

Related skills

attack-surface-test-checklist

Maps a code change to the security tests worth running against it. Classifies changed paths and file contents into nine attack surfaces (authentication, session management, input handling, file upload, deserialization, access control, API and web service, cryptography, data protection), attaches the matching OWASP ASVS 4.0.3 verification requirements, OWASP Top 10 2021 category IDs, and OWASP WSTG section numbers to each active surface, then emits a per-surface manual and automated test checklist bounded by what actually changed. Surfaces with no changed lines are excluded rather than carried as filler. Use when a pull request, release branch, or feature is about to be security tested and the team needs a targeted test list instead of a generic application-wide checklist.

code-change-shape-classifier

Classifies a code change set into four shapes (pure-logic, service-layer, ui-heavy, data-heavy) from file-path and file-content signals, computes the shape distribution over a window of git history, and attaches a relative per-layer test cost model (unit 1x, service 3x, UI 10x) so downstream planning works from one shared input. Produces the classification only: it does not prescribe a target unit:service:UI ratio, does not estimate hours, and does not select which tests to run. Use when a pull request, release branch, or epic needs its change shape labelled before test effort, pyramid balance, or coverage depth is decided.

definition-of-done

Pure-reference + checklist-generator for the team's Definition of Done (DoD) - explains the Scrum Guide's DoD definition ("a formal description of the state of the Increment when it meets the quality measures required for the product"), proposes a starter DoD with the 7-10 lines most teams need (code reviewed, unit tests, docs, AC met, deployed to staging, smoke passed, no a11y regressions, telemetry wired, observability in place), and emits a per-PR checklist a reviewer enforces. Use when the team doesn't have a DoD or wants to revise theirs.

dod-adherence-review

Audits an existing Definition of Done checklist line by line against repository evidence (review records, diffs, CI runs, coverage reports, scan output) and tags every line met, not met, or unverifiable, refusing to pass a line on self-attestation or on a claim with no matching diff. Covers the line-pattern-to-evidence mapping for the common checklist shapes (code reviewed, coverage threshold, docs updated, acceptance criteria covered, staging deploy plus smoke, no new accessibility regressions, telemetry wired), the entry-stage versus exit-stage split many teams run, the roll-up verdict rules, and the audit table that gets emitted. Does not author, revise, or soften the checklist. Use when a story or pull request is about to be marked done and a committed Definition of Done exists that nobody has actually checked the work against.

e2e-suite-budget

Caps E2E suite size by computing per-test ROI - (regressions caught × value) ÷ (runtime × flake rate × maintenance) - then ranks every end-to-end test and recommends which bottom-decile ones to retire, move to a lower layer, or fix. Use when CI is slow or E2E-dominated, flaky failures are rising, or quarterly to keep suite size within maintenance capacity. For strategic unit:service:UI layer ratios use test-pyramid-balancer, for the minimal per-deploy critical-path gate use smoke-suite-gate, and for quarantining flaky tests use flaky-test-quarantine; this prunes low-signal tests by ROI.

framework-choice-advisor

Pure reference catalog for picking a test automation framework - covers Playwright / Cypress / Selenium / WebdriverIO / Appium / Espresso / XCUITest / RestAssured / Karate / k6 / Locust with side-by-side tradeoffs on speed, cross-browser, mobile, parallelisation, language support, ecosystem maturity, CI integration; a decision tree for matching project NFRs to framework choice; and reference directory / fixture / CI layouts for the chosen stack. This is the **upstream selection step**: it decides which tool to adopt, not how to configure a tool already chosen, and not how to rebalance the unit / integration / E2E mix of an existing suite. Use when starting a new test-automation suite from scratch, before installing any tool.

heuristic-test-design-reference

Reference catalog of the four canonical heuristic test-design models - Bach's Heuristic Test Strategy Model (HTSM) with SFDPOT product elements, Whittaker's 'How to Break Software' attack patterns, Bolton's FEW HICCUPPS consistency oracles, and the ISO/IEC 25010 quality characteristics - for use when the tester has no user story, no acceptance criteria, and no documentation. This is the zero-documentation case: it does not read from a written story, and it yields test-case ideas rather than session charters. Use as the reference layer when generating coverage for a feature with no documented input.

post-mortem-author

Build-an-X workflow that produces a blameless post-mortem from an incident - captures the timeline (chronological event sequence with sources), root cause analysis (what + why, not who), impact (users / revenue / SLO debt), action items (with owners + due dates + measurable success criteria), and "what went well" (intentional). Per Google SRE: "Blameless postmortems are a tenet of SRE culture." Use after every user-visible incident, not just severe ones.

product-risk-register-builder

Build-an-X workflow that produces a product-level risk register catalogue - per-feature / per-component product risks (functionality, performance, security, usability, compatibility, reliability) that persist across releases, distinct from per-release risk matrices. Walks the author through risk identification by ISO 25010 quality characteristic, scoring per impact × likelihood, and linking each register entry to mitigations + owners + review cadence. Output is a Markdown register the team reviews quarterly and that seeds release-level risk matrices. Use for long-lived product-quality risks; complements risk-matrix for per-release risks.

project-risk-register-builder

Build-an-X workflow producing a project-level risk register - risks to project execution (schedule slippage, environment instability, people / staffing, vendor / dependency, scope creep) rather than the product itself. Walks the author through ISO 31000-aligned identification, impact × likelihood scoring, mitigation strategy (avoid / mitigate / transfer / accept), and ownership; the project manager reviews it weekly. Use for release-execution risk. For product-quality risks use product-risk-register-builder, for the per-release product risk table use risk-matrix, and to sign off accepting one specific risk use risk-acceptance-decision-author.

qa-okr-author

Build-an-X workflow that drafts a QA team's quarterly OKR set - one to three Objectives, each with 3 - 5 measurable Key Results - from the team's current state (risk matrix, defect-trend narrative, test-run history, test-pyramid balance, compliance coverage). Every numeric target cites its source artifact (e.g., a defect-trend baseline's 2026-Q1 escape rate). QA-specific by design - generic OKR generators (Tability, Asana, ClickUp) don't know test metrics; the differentiation is the domain. Produces the OKR set itself - not the test-strategy document it sits inside, and not the risk-score calibration behind the baselines. Use at the start of each quarter to draft the OKR set the manager edits and the team commits to.

qa-vendor-evaluator

Build-an-X workflow that produces a side-by-side **commercial-vendor** evaluation matrix for QA tools - test-management platforms (TestRail / Qase / Xray / Zephyr / TestCollab), no-code platforms (mabl / Testim / Functionize / TestSigma / Reflect), visual regression services (Applitools / Percy / Chromatic), and commercial AI copilots - scoring each on capability fit, cost model, integration depth, vendor lock-in risk, exit cost, contractual posture, and customer-reference data. Scoped to commercial procurement - contract, lock-in, and exit-cost axes - not to choosing an open-source code-first framework on architectural fit. Use for commercial procurement decisions only - refuses to recommend a winner; the team owns the procurement choice.

risk-acceptance-decision-author

Build-an-X workflow that produces a structured risk-acceptance decision document - for risks the team has decided to accept (rather than mitigate / transfer / avoid). Walks the author through the ISO 31000 risk-acceptance criteria (rationale, sign-off, scope, review trigger, exit conditions), captures stakeholder approval, and links to the originating risk register entry. Output is a Markdown decision artefact that lives alongside the risk register and provides audit-defensible justification for the team's acceptance choice. Use when a risk register entry's Strategy column is set to Accept, or an already-accepted risk comes up for its scheduled re-review, an audit, or a post-incident look-back.

risk-coverage-mapper

Build-an-X workflow that produces a risk-to-test-coverage matrix - maps each risk in the product/release register to the tests / cases / monitoring that mitigate it. Walks the author through ingesting risks (from risk-matrix / product-risk-register-builder), inventorying test coverage (test cases via traceability-matrix-builder, automated tests via repo scan, production monitoring via observability dashboards), and computing per-risk coverage depth + identifying orphan risks (no coverage) + orphan tests (not linked to risks). Output is a Markdown matrix + executive summary. Use before a release sign-off or compliance audit, when the team must show which tests, cases, or monitors back each registered risk and which risks have nothing behind them.

risk-matrix

Produces the per-feature / per-release risk-matrix artifact itself: a structured intake (feature, category, impact 1-5 by likelihood 1-5, score), mitigations with owners and due dates, supporting both lightweight (impact by likelihood) and heavyweight (FMEA / Cost of Exposure) methods per RBT canon, output as a Markdown / spreadsheet the team reviews each sprint. Use when building the matrix artifact; to facilitate the live risk-storming meeting use risk-storming-facilitator, to calibrate scores across raters use risk-matrix-calibration, and to map the resulting risks onto test coverage use risk-coverage-mapper.

risk-matrix-calibration

Checks an already-written risk matrix against what actually happened. Maps each row's likelihood rating to observed defect density, test failure rate and code churn, maps its impact rating to the severity mix and escape rate, then classifies each row as over-stated, under-stated, in-agreement, or not calibrated, using stated reporting thresholds so small differences are not treated as findings. Every proposed rating change carries the observation that produced it, and every proposal is handed to the matrix owner rather than applied. Also emits candidate new entries for areas that show up in defect data but have no row. Owns calibration only: choosing a scoring methodology, designing the matrix structure, picking risk categories, mapping risks to test types, FMEA scoring, review cadence and file storage are all out of scope. Use when a matrix has been driving test decisions for at least three releases and nobody has yet checked whether its ratings match the defects, escapes and incidents that followed.

risk-storming-facilitator

Reference guide for planning and facilitating a risk-storming session yourself - meeting structure, participant roster, per-category brainstorm prompts (categories from risk-matrix), affinity grouping, impact by likelihood scoring, and mitigation assignment. Static reference only, not an active runner that writes the matrix file. Use to learn or teach the facilitation pattern, or to run a feature-kickoff session without agent assistance. For the matrix artifact itself use risk-matrix, to calibrate its ratings against real defect data use risk-matrix-calibration, and to map the resulting risks onto test coverage use risk-coverage-mapper.

smoke-suite-gate

Build-an-X workflow for a critical-path smoke suite that runs in <5 minutes - picks the 5-15 highest-business-value journeys (login, hero flow, checkout, payment, primary read), implements as fast E2E or API tests, gates per-deploy, retries on transient failures with quarantine. Use as the canary-precursor or per-deploy verification gate; the team's "if this fails, the build can't proceed" floor.

test-case-from-live-feature

Build-an-X workflow that produces a test-case matrix from a **live, undocumented feature** - running app at a URL, screen recording, screenshot, or verbal brief - by combining structured exploration (Playwright trace / DevTools / accessibility tree) with the heuristic models in `heuristic-test-design-reference` (SFDPOT, Whittaker attacks, FEW HICCUPPS, ISO 25010). Output is a structured case matrix, not an exploratory session charter. Use when there is no story, no AC, and no documentation - only a live feature.

test-case-ideation-from-story

Takes a user story or feature spec and emits a markdown test-case matrix - one row per case (id, title, precondition, steps, expected, tier) covering happy path, alternate paths, boundaries, and negative paths - before any test code is written. Output is the human-reviewable matrix that goes into TestRail / Qase / Xray. Emits the human-reviewable case matrix itself - not Gherkin scenarios written against locked acceptance criteria, and not executable test code. Use as the first artifact a manual tester or three-amigos session produces from a story, ahead of automation.

test-effort-estimation

Turns a list of testable areas plus a change-shape distribution into a PERT three-point test effort estimate, reporting every row as a range around the expected value rather than a single number, requiring a named assumptions ledger across six mandatory categories, and recommending a per-layer ownership split across developer, automation, and exploratory roles. Owns the hours and the ownership recommendation only: it consumes a change-shape distribution rather than producing one, and it does not choose which tests to run or how deep coverage should go. Use when an epic or release has been broken into testable areas and someone is about to commit test capacity for a sprint.

test-pyramid-balancer

Build-an-X workflow that analyzes a repo's test mix (unit / integration / E2E counts + runtimes) and recommends rebalancing toward the test pyramid ratios per the change-set shape - pure-logic-heavy repo wants ~80/15/5; UI-heavy repo wants ~60/25/15. Detects 'ice-cream cone' (E2E-heavy) and 'hourglass' (integration-thin) anti-patterns. Use when the user asks about test distribution, test strategy, test balance, too many E2E tests, slow CI caused by tests, testing best practices, or rebalancing their test suite; also suitable for quarterly calibration of the test mix to codebase reality.

test-strategy-author

Authors a test strategy document (a master test plan) for a project, release, or feature - covers scope, in/out, test types per layer (unit / integration / contract / E2E / perf / security / a11y), risk-based test prioritization that maps top risks to test investment (per `risk-matrix`), tooling stack, environments, exit criteria, and ownership. Use when a team needs the release-readiness artifact stakeholders sign off on before significant test investment, and the reference engineering teams return to when scope or quality questions arise.

tool-selection-decision-record

Defines the output contract for writing down a chosen developer tool as a portable decision record: the observed project signal, exactly one primary recommendation, rationale that names the rejected alternative, what to read next, and a mandatory list of the conditions that would flip the choice. Adapts Architecture Decision Record conventions (context, decision, consequences, status, supersede rather than edit) to tool selection, and refuses any recommendation inferred from a README or a folder name instead of a manifest, lockfile, config file, or existing test directory. Distinct from a catalog or advisor that compares candidate tools on their merits: this owns the shape of the written record, not the comparison. Use when a tool has just been chosen (test framework, build tool, linter, package manager, migration tool) and the choice needs to be recorded so a later reader can see the signal, the rejected alternative, and what would reverse it.