agentleFS
aethroxaethrox/doctrine/skills/test-strategy/SKILL.md

test-strategy

Skill18 starsChanged 3 months agoMITView on GitHub

Suite-level testing decisions that sit above individual tests, where test data comes from (synthetic factories vs anonymized production snapshots), the flaky-test quarantine policy, and where the integration/e2e boundary actually belongs. Use when deciding how a test suite should source its data, what to do with a flaky test, or whether a given seam needs a full integration test, a contract test, or a unit test with a double is enough. Does not cover the red-green-refactor cycle or test-double taxonomy; see the tdd skill for those.

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use test-data-management, security-and-hardening and 1 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.
  • petrkindlmannSkill

    test-data-management

    Create and manage test data with factory patterns, fixture strategies, data anonymization, and synthetic data generation. Covers Fishery (TypeScript), FactoryBot (Ruby), Factory Boy (Python), database seeding, cleanup strategies, and GDPR-compliant data handling. Use when: "test data," "fixtures," "factories," "seed data," "synthetic data," "test database," "data anonymization." Not for: migration/integrity testing of the DB itself — use database-testing; environment provisioning and database branching strategy — use test-environments. Related: test-environments, database-testing, api-testing, unit-testing.

    Also in 3 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

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 22 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Treat it as the exception, not the default: a suite that leans on production snapshots for routine tests has usually skipped building …

    line 18

“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

Where a test gets its data from and what happens when it goes flaky are suite-level policies, decided once and applied consistently, not improvised per test or per failure. This skill covers the decisions that sit above the individual red-green-refactor cycle (see tdd for that): test data sourcing, flaky-test handling, and the integration/e2e boundary.

Phase 1: Test data

Default to synthetic data generated at test runtime: factories or fixtures that build exactly the shape a test needs, checked into the test itself or a shared factory module. This is fast, requires no external data source, and its content is fully under the test's control (see tdd Phase 2, expected values need an independent source of truth, and hand-built synthetic data is that source).

Reach for a production data snapshot only when synthetic data genuinely can't reproduce the bug pattern or edge case under test; real-world data has irregularities and relationship patterns synthetic generators tend to smooth over. When a snapshot is used:

  • Anonymize before it leaves production, never after: mask or replace identifying fields (names, emails, IDs) while preserving format and referential integrity (a masked customer ID still matches the same masked customer's masked orders), so the data stays realistic enough to be useful without staying identifying.
  • Version the snapshot alongside the code that depends on it, the same way tdd's FIRST properties require a test to be repeatable; a snapshot that silently changes between CI runs breaks that guarantee.
  • Treat it as the exception, not the default: a suite that leans on production snapshots for routine tests has usually skipped building proper factories, and inherits every compliance and staleness problem synthetic data doesn't have.

Phase 2: Flaky test policy

A test that fails intermittently with no code change is not evidence of a real bug until proven otherwise, but it also cannot be allowed to sit red-flaking-green forever; it trains people to ignore CI failures, which is worse than not having the test.

  1. Quarantine, don't delete. Move the test out of the required-check set so its failure no longer blocks a merge, but keep it running and keep recording its result; quarantine preserves the signal, deletion destroys it.
  2. File a ticket at quarantine time, not later: the failure pattern observed, the test's original author as default owner, and a stay limit (two to four weeks is a reasonable default).
  3. Before the stay limit expires, the test is either fixed (root-caused with the same rigor as diagnosing-bugs, most commonly a Phase 3 anti-pattern from tdd, shared mutable state, unpinned time, an unmocked network call) or formally retired with the reasoning written down. A test that silently ages past its stay limit without either outcome is exactly the state this phase exists to prevent.
  4. Track quarantine as a first-class suite health metric; a suite with an ever-growing quarantine list is accumulating debt the team has stopped noticing.

Phase 3: Where the integration/e2e boundary goes

A test earns its place at the integration or e2e layer only if a unit test with a double genuinely cannot verify the behavior, not by default, and not because it was easier to write against the real thing:

SituationRight layer
Logic is internal to one module, no real I/O involvedUnit test (tdd)
Behavior depends on how this service and another service actually agree on a shape (a request/response contract)Consumer-driven contract test (see api-design-standards Phase 4): cheaper than a full integration test and fails for the same reason a real breaking change would
Behavior depends on real infrastructure semantics a fake can't reproduce (a real database's transaction/locking behavior, a real message queue's ordering guarantees)Integration test against a real (or realistic containerized) instance of that dependency
The thing under test is the user-visible flow across the whole systemEnd-to-end test: kept deliberately few, per tdd's pyramid, since each one is slow and names a symptom rather than a cause when it fails

Before adding an integration or e2e test, ask whether a contract test or a unit test with the right double (tdd Phase 3) would catch the same class of bug, if it would, that's the cheaper and faster test to maintain, and the heavier one is redundant coverage.

Done when

  • Test data is synthetic by default; any production snapshot in use is anonymized with referential integrity preserved and versioned alongside the code.
  • Every flaky test is either green, quarantined with a ticket/owner/stay-limit, or formally retired; none are silently tolerated in the required-check set.
  • Every integration or e2e test exists because a unit test or contract test genuinely couldn't cover it, not by default.
  • Generated prose uses commas, colons, periods, or reworded sentences instead of em dashes.

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.