agentleFS
axiomanticaxiomantic/spellbook/skills/testing-strategy/SKILL.md

testing-strategy

Skill10 starsChanged 3 months agoMITView on GitHub

Test selection and scope guidance: tiers, marks, batching, cross-module regressions. Loaded by the testing rule module. Triggers: 'which tests should I run', 'test scope', 'test tiers'. NOT for: writing tests (use test-driven-development) or fixing broken tests (use fixing-tests).

37 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use react-patterns, api-design and 7 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.
  • benshapyroSkill

    react-patterns

    Modern React patterns for TypeScript applications including hooks, state management, and component composition. Use when building React components, managing state, or implementing React best practices.

    Also in 4 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 10 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 5 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 6 projects that use this

  • MicrosoftSkill

    error-handling

    统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。

    Also in 3 projects that use this

  • CloudAI-XSkill

    database-design

    Designs database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 33 edited versions we read keep these.

  • 6

    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. Distinctive:

    Scope Matches Change: - Test selection mirrors the scope of the code change.

    line 20
  2. Very specific:

    Single file changed: Run only the test file(s) that directly test that module.

    line 34
  3. Distinctive:

    Multi-file task complete: Run unit tests for all changed files in one command.

    line 36
  4. Distinctive:

    All tasks in a work unit complete: Run the full suite once.

    line 37
  5. Distinctive:

    If >5 test files affected: Run the full fast tier rather than listing individually.

    line 38
  6. Distinctive:

    Batching: Write code for task 1, run targeted tests, write code for task 2, run targeted tests, run full suite once at end.

    line 40
  7. Very specific:

    If a project lacks marks, infer tiers from --durations=0 (pytest) or equivalent: >5s is slow, >1s is integration, the rest are unit.

    line 58
  8. Distinctive:

    When the full suite fails after targeted tests passed: check failed test imports against your changed modules, then investigate shared …

    line 62

“Common” is measured: kept by at least 6 in 10 of the 33 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
<analysis> Reference for choosing which tests to run based on change scope, and diagnosing cross-module regressions when targeted tests pass but the full suite fails. </analysis><reflection> Did I match test scope to change scope, and did I avoid running the full suite when targeted tests would suffice? </reflection>

Testing Strategy

Invariant Principles

  1. Scope Matches Change - Test selection mirrors the scope of the code change; a single-file change does not justify a full suite run.
  2. Marks Are Proactive - Tests are marked (slow, gpu, network) at authoring time based on what they require, not how fast they happen to run today.
  3. Full Suite Runs Once - The complete test suite runs once per work unit completion, not after every incremental change.

Test Tiers

TierTimeWhatWhen
Unit<1s eachPure logic, no I/O, no external depsAfter every change
Integration1-5s eachReal resources (DB, filesystem, network)After completing a logical unit of work
E2E / Slow>5s eachFull pipelines, large data, real servicesOnce per feature branch, before PR

Selecting What to Run

  • Single file changed: Run only the test file(s) that directly test that module. src/auth/login.py changed? Run tests/test_login.py.
  • Shared dependency changed (types, config, utilities): Grep for imports of the changed module across test files. Run all direct consumers.
  • Multi-file task complete: Run unit tests for all changed files in one command.
  • All tasks in a work unit complete: Run the full suite once.
  • If >5 test files affected: Run the full fast tier rather than listing individually.

Batching: Write code for task 1, run targeted tests, write code for task 2, run targeted tests, run full suite once at end.

Writing Tests for Speed

Mock expensive resources in unit tests. Use smallest possible inputs. Never sleep in tests. One assertion focus per test. No fixtures heavier than the test itself.

Test Marks

Apply marks proactively when writing tests. A test that calls a GPU kernel is a GPU test even if it is fast today.

MarkMeaning
slow>5 seconds. Skip during rapid iteration.
gpu, hardwareRequires specific hardware. Skip on machines without it.
network / externalCalls external services. Skip in offline/fast modes.
integrationRequires multiple components working together.
smokeMinimal sanity checks. Run first.

If a project lacks marks, infer tiers from --durations=0 (pytest) or equivalent: >5s is slow, >1s is integration, the rest are unit.

Cross-Module Regression

When the full suite fails after targeted tests passed: check failed test imports against your changed modules, then investigate shared mutable state, test ordering, or resource contention.

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.