agentleFS
HMBSbigeHMBSbige/skills/skills/testing-strategy/SKILL.md

testing-strategy

Skill1 starsChanged 44 days agoMITView on GitHub

Use when a code change needs a testing approach chosen or revised, or when writing or changing nontrivial tests whose falsifiability, boundary, doubles, or regression value needs review, especially for bug fixes lacking regression coverage, stable APIs suited to test-first work, legacy code needing characterization, prototypes or UI/configuration/integration work needing acceptance-style validation, or repositories with explicit strict TDD rules. Choose from contract stability, available test seams, and risk; for strategy-only requests, recommend evidence without implementing changes; skip trivial edits whose required checks are already obvious.

54 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use api-contract-design, deploy-checklist and 10 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.
  • MohOneXSkill

    api-contract-design

    Designs and reviews API contracts (REST, RPC, GraphQL, library interfaces) for evolvability, backward compatibility, and failure semantics. Use when defining new endpoints/interfaces, versioning an API, reviewing a schema, or deciding how breaking changes propagate to clients.

    Also in 3 projects that use this

  • AnthropicSkill

    deploy-checklist

    Pre-deployment verification checklist. Use when about to ship a release, deploying a change with database migrations or feature flags, verifying CI status and approvals before going to production, or documenting rollback triggers ahead of time.

    Also in 4 projects that use this

  • xenitV1Skill

    react-patterns

    Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.

    Also in 4 projects that use this

  • AnthropicSkill

    tech-debt

    Identify, categorize, and prioritize technical debt. Trigger with "tech debt", "technical debt audit", "what should we refactor", "code health", or when the user asks about code quality, refactoring priorities, or maintenance backlog.

    Also in 4 projects that use this

  • MicrosoftSkill

    error-handling

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

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

  • +4 more from anthropics
  • +1 more from microsoft

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 11 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 44 edited versions we read keep these.

  • 11

    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:

    Bug fix: Prefer a focused regression test that reproduces the symptom before the fix when practical.

    line 12
  2. Distinctive:

    Stable API or well-defined behavior: When an executable test is the cheapest clear expression of the contract, prefer test-first …

    line 13
  3. Distinctive:

    Strict TDD repository: Follow its documented red-green-refactor rules and commands.

    line 17
  4. Distinctive:

    When implementation is requested and authorized, implement the smallest coherent change.

    line 23
  5. Distinctive:

    Before retaining a test, name a realistic production defect it would catch.

    line 32
  6. Distinctive:

    Test externally observable behavior at stable boundaries.

    line 33
  7. Distinctive:

    Test this code's boundary contract, not the framework's mechanics.

    line 35
  8. Distinctive:

    Use real collaborators when inexpensive and deterministic.

    line 36
  9. Distinctive:

    Avoid assertions that only prove mock choreography or private implementation details.

    line 37
  10. Distinctive:

    Do not absorb unrelated baseline failures, warnings, or test debt into the task.

    line 40
  11. Distinctive:

    Do not default to the full repository suite when focused and relevant module checks are sufficient.

    line 41

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

Testing Strategy

Choose the testing approach that produces useful evidence without turning one methodology into a ritual.

Select the approach

  • Bug fix: Prefer a focused regression test that reproduces the symptom before the fix when practical. For intermittent, environmental, or external failures, use the most reliable controlled reproduction instead.
  • Stable API or well-defined behavior: When an executable test is the cheapest clear expression of the contract, prefer test-first development at the narrowest stable public boundary. Otherwise implement first and verify afterward.
  • Legacy or poorly understood code: Characterize only behavior that should remain stable around the change. Treat current output as a drift baseline, not a correctness oracle; do not lock in a reported or known defect. For a bug fix, assert the intended behavior separately.
  • Exploratory prototype or unsettled interface: Allow a time-boxed implementation spike. Before retaining, merging, or shipping it, identify the behavior that is now contractual and add the smallest durable checks; otherwise keep it explicitly non-production or discard it.
  • UI, visual output, configuration, generated artifacts, migrations, or external integrations: Use the strongest fitting evidence, such as rendering, screenshots, schema validation, builds, integration environments, logs, or focused manual acceptance. Automate checks that will remain valuable.
  • Strict TDD repository: Follow its documented red-green-refactor rules and commands. Do not infer strict TDD from this skill alone.

Apply the strategy

  1. Identify the observable behavior, risk, stable test seam, and existing repository commands.
  2. Establish the pre-change signal appropriate to the selected strategy: a failing regression, a test-first example, a characterization baseline, or an acceptance criterion.
  3. When implementation is requested and authorized, implement the smallest coherent change. Keep unrelated cleanup outside the behavior-changing step.
  4. For implementation work, run the focused check, then expand to related module or integration checks in proportion to coupling and risk.

For strategy-only or review requests, do not implement changes. Return the recommended approach, evidence, scope, and any validation that would remain before completion.

When implementation already exists in a dirty worktree, preserve it and apply the selected strategy to the current change. Add a regression or characterization test only when it is the fitting durable signal; otherwise use the selected acceptance, rendering, integration, configuration, or controlled-reproduction evidence. If proving the historical failure is valuable, use an isolated base revision or another non-destructive method; otherwise state that the pre-fix failure was not independently demonstrated.

Keep tests useful

  • Before retaining a test, name a realistic production defect it would catch. If none can be named, redesign or remove it. For high-risk behavior, confirm falsifiability with a pre-fix run, targeted revert, or mutation that fails for the intended reason when practical.
  • Test externally observable behavior at stable boundaries; do not impose one test per method.
  • Test behavior, not source presence or change alone. Exact text is a valid assertion only when it is part of the external contract; otherwise execute the script, configuration, generated artifact, or agent-facing instruction and assert outputs, side effects, schema, exit status, or consumer behavior. Do not assert constants or private structure merely to detect edits.
  • Test this code's boundary contract, not the framework's mechanics. Characterize an upstream assumption only when the implementation materially depends on it.
  • Use real collaborators when inexpensive and deterministic. Use narrow doubles at slow, nondeterministic, destructive, or external boundaries.
  • Avoid assertions that only prove mock choreography or private implementation details.
  • Reuse existing test frameworks and seams. Do not add a new framework, harness, public API, or dependency-injection layer solely to test one change unless recurring risk justifies its maintenance.
  • Derive expected outcomes from requirements, a real reproduction, a specification, or an independent oracle rather than the implementation under test. Review snapshots instead of accepting updates mechanically.
  • Do not absorb unrelated baseline failures, warnings, or test debt into the task. Report them separately unless they block trustworthy validation.
  • Do not default to the full repository suite when focused and relevant module checks are sufficient. Run broader gates when repository policy, shared infrastructure, coupling, or release risk warrants them.

At completion, bind each material claim to evidence from the current relevant state, reuse current evidence when that state is unchanged, and state which checks were not run. Use verification-before-completion when it is available; otherwise apply these rules directly.

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.