Test Strategy skill for Codex

Pick the test mix from risks, not diagrams. Codex inventories the existing suite, CI timings and recent escaped defects, then maps each risk in the system to the cheapest layer that catches it reliably. The resulting strategy picks a test shape that fits the architecture, sets per-stage CI budgets, says what to stop doing, and proposes three to five incremental changes with measurable outcomes rather than a rewrite.

  • Testing & QA
  • $test-strategy
  • 143 lines
  • 2 files
  • ~1,700 tokens
  • MIT
  • Updated

Install

curl -fsSL codexskills.dev/install.sh \  | sh -s -- test-strategy

Installs to ~/.agents/skills/test-strategy/ for every project on this machine.

104-line POSIX script. No sudo, no telemetry. Read install.sh

Use it in Codex

Start a prompt with $test-strategy, or pick it from /skills. You can also just describe the task: Codex reads the description below and loads the playbook when your request matches.

What Codex reads before loading it

Decides the test mix for a real codebase - pyramid, trophy or honeycomb shape chosen from its architecture and risks, what each layer (static analysis, unit, integration, contract, E2E, manual) must catch, where the current suite is over- or under-invested, CI stage budgets, and a staged plan to get there - and writes it up as a short strategy document. Use when starting a new service, when a suite is slow, flaky or still lets bugs through, when a team argues about unit versus integration versus E2E tests, or when asked what tests a codebase should have.

Use it when

  • Starting a new service or app and deciding what to test where
  • The suite is slow, flaky or still lets defects escape
  • A team disagrees about unit versus integration versus E2E tests
  • Someone asks for a written test strategy

Use something else when

How to check the result

Every listed risk has an owning layer or an explicit acceptance, and each sampled escaped defect maps to a layer in the target strategy that would have caught it.

The mistake it prevents

Applying the classic pyramid to a thin CRUD service, which yields hundreds of mock-only unit tests and no coverage of the SQL and wiring where its bugs actually live.

~/.agents/skills/test-strategy/SKILL.md

--- name: test-strategy description: Decides the test mix for a real codebase - pyramid, trophy or honeycomb shape chosen from its architecture and risks, what each layer (static… license: MIT ---

A test strategy is good when every important risk in the system has a named layer that catches it, each layer is the cheapest one able to catch that risk, the whole suite gives a trusted signal within the team’s CI budget, and the plan to get there is incremental. Pyramid, trophy and honeycomb are outcomes of that analysis, not starting points.

Inspect first

  1. Read AGENTS.md, README, CI workflows and the test directories. Note languages, frameworks and how tests are run and split.
  2. Inventory the current suite with numbers, not impressions:
# counts by type (adapt globs to the repo's conventions)
rg --files -g '*.test.*' -g '*_test.go' -g 'test_*.py' -g '*Test.java' | wc -l
rg --files -g '*.spec.ts' -g 'e2e/**' -g 'cypress/**' | wc -l
gh run list --workflow ci.yml --limit 50 --json conclusion,createdAt,updatedAt   # duration and failure rate; needs network
  1. Collect escaped defects: the last 20-30 production bugs or incidents. For each, ask which layer should have caught it. This is the strongest evidence you will get.
  2. Map the architecture: UI-heavy frontend, API service, data pipeline, library, event-driven system, mobile app; and the external dependencies.
  3. Ask the user for constraints: CI time budget, release cadence, regulated areas, team familiarity with tools.

Risk map first

List the system’s risks, then assign each to the cheapest layer that can catch it reliably.

RiskCheapest reliable layer
Type errors, null handling, unused code, unsafe patternsStatic: type checker, linter, SAST
Business rules, calculations, parsing, state machinesUnit (plus property-based for wide input spaces)
SQL, transactions, migrations, serialisation, framework wiringIntegration with real DB/broker
Breaking another team’s API or being broken by itContract tests
Auth, routing, validation at the HTTP edgeIn-process API/integration tests
Critical user journeys across UI and backendA few E2E tests
Layout and styling regressionsVisual regression on components/pages
Accessibility defectsaxe scans + manual pass
Performance and capacityBenchmarks, load tests with thresholds
Unknown unknowns, UX problemsExploratory testing sessions
Resilience to dependency failureFault injection, chaos experiments

Choose the shape

SystemShape that usually fitsWhy
Library, SDK, algorithm-heavy corePyramid: mostly unit + property-basedLogic is the product; few boundaries
CRUD API / backend serviceHoneycomb: mostly integration with real DB, fewer pure unitsBugs live in queries and wiring, not in trivial functions
React/Vue/Svelte frontendTrophy: static + component/integration tests via Testing Library, thin E2EComponent behaviour is where users feel bugs
MicroservicesIntegration per service + contract tests between them; very few cross-service E2ECross-service E2E environments are slow and flaky
Data pipelinesData-quality checks + transformation unit tests + small end-to-end run on fixture dataData shape is the main risk
Mobile appUnit + UI component tests, a small device E2E smoke suiteDevice E2E is costly to run and maintain

Escape hatch: if escaped defects cluster in one layer the shape says is minor, the evidence wins over the shape.

CI budget

Set targets with the team, then design to them:

StageContentsTarget
Pre-commit / localFormat, lint, type check, affected unit tests< 1 min
PR required checksStatic, all unit, integration, contract, smoke E2E< 10-15 min wall clock
Merge to mainFull E2E, visual, a11y< 30 min
Nightly / scheduledLong fuzzing, load tests, full cross-browser, quarantine jobUnbounded, but reviewed daily

Use sharding and test selection (see test-impact-analysis) before cutting tests that catch real defects.

Diagnose the current suite

SymptomLikely imbalanceMove
Unit tests green, production breaks at DB or API edgesToo many mock-heavy units, too few integrationReplace mock-the-repository tests with real-DB integration tests
CI takes 45+ minutes, mostly E2EE2E covering rules that lower layers couldPush permutations down; keep one E2E per critical journey
Refactors break hundreds of testsTests coupled to implementation (mocks of internals, snapshots)Test through public interfaces
Frequent flaky failuresE2E and timing-dependent testsflaky-test-triage; reduce E2E count
Cross-team releases break each otherNo contract testsAdd consumer-driven contracts
Bugs found only by users in UXNo exploratory testingTime-boxed charters before releases (test-plan-writing)

Workflow

  • Inventory the suite and CI timings; collect escaped defects
  • Build the risk map for this system; mark which risks have no layer today
  • Choose the target shape and justify it with the defect data
  • Define per-layer rules: what belongs there, what does not, tooling, ownership
  • Define CI stages and time budgets
  • Write a staged plan: three to five steps, each shippable on its own, highest-risk gap first
  • Define how success is measured: escaped defects per release, CI time, flake rate, time to diagnose a failure

Do not propose rewriting the suite. Propose the next three changes that move the measurements, and say what to stop doing.

Output template

# Test strategy: <system>
**Context:** <architecture, team size, release cadence, CI budget>
**Evidence:** <suite inventory, CI duration p50/p90, flake rate, escaped defects by layer>

## Risks and the layer that owns each
| Risk | Layer | Tooling | Today |
|---|---|---|---|

## Target shape
<shape + why, with the defect evidence>

## Layer rules
- Unit: <what belongs, what does not>
- Integration: <real deps, isolation strategy>
- Contract / E2E / manual: <scope and limits, e.g. "max 15 E2E journeys">

## CI stages and budgets
## Plan
1. <change> - expected effect - owner - done when
## Stop doing
## Measures of success

Verification

  • Every risk in the map has an owning layer, or is explicitly accepted with a reason.
  • Each of the sampled escaped defects maps to a layer in the target strategy that would catch it.
  • The plan’s first step is achievable in about a sprint and measurable.

Gotchas

  • Copying the test pyramid onto a thin CRUD service produces hundreds of mock-only unit tests that never catch a real bug.
  • Coverage targets are not a strategy; they measure execution, not risk.
  • “Everything through E2E” feels thorough and produces a slow, flaky suite nobody trusts.
  • Strategies without CI budgets drift: each new test is reasonable, the sum is an hour.

What the zip contains

SKILL.md plus the interface file below. Nothing runs on install.

agents/openai.yamlgenerated from this page

Gives the Codex app a display name, a one-line description and a starter prompt for this skill.

interface:
  display_name: "Test Strategy"
  short_description: "Pick the test mix from risks, not diagrams"
  default_prompt: "$test-strategy What tests should this new Go service have, and where should we draw the lines?"

About this skill

Written and maintained by the Codex Skills editors to the same editorial standard as every skill here: a selective description, a real workflow, known pitfalls and a way to verify the work. First published , last updated . MIT licensed. Something wrong or out of date? Tell us.

esc
Just launched

Codex Skills Pro is live

79 premium skills for Codex, each with scripts, references and an evidence report that proves the result.

Bought one by one$882.21
All 79 skills$49
94% off

That's $0.62 a skill, paid once.

Get all 79 for $49Or pick single skills from $4.99 →

Secure checkout by Creem