agentleFS
thixpinthixpin/claude-config/skills/testing/SKILL.md

testing

Skill8 starsChanged 4 months agoMITView on GitHub

Strategy and rules for writing or improving automated tests. Use when adding tests, improving coverage, fixing flaky tests, setting up a test suite, or deciding what and how to test. Emphasizes deterministic tests, testing behavior over implementation, and a tight validation loop. For diagnosing production failures whose cause is unknown, use the debugging skill. Once the cause is identified, bug-fix returns here for the regression test.

123 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use oss-pr, pr-automation 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.
  • CES-LtdSkill

    oss-pr

    Use when creating a pull request, after committing changes, or when user invokes /oss-pr. Covers branch management, quality checks, commit, push, and PR creation.

    Also in 3 projects that use this

  • CES-LtdSkill

    pr-automation

    PR Automation Orchestrator: poll open PRs, check CI, run review, fix, and merge eligible PRs. Use when: (1) Invoked by daemon via scripts/pr-automation.sh, (2) User says "/pr-automation".

    Also in 3 projects that use this

  • ffsshhttiikkSkill

    cicd

    Continuous integration and delivery pipelines

    Also in 4 projects that use this

  • ffsshhttiikkSkill

    networking

    Practical application and coding skills for Networking

    Also in 3 projects that use this

  • JohnJBorenSkill

    ci-cd

    CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies

    Also in 9 projects that use this

  • Cogni-AI-OUSkill

    dotfiles

    Reference for repository dotfiles, including their purposes, standard configurations, and usage guidelines. You MUST load this skill when configuring, troubleshooting, or understanding repository dotfiles.

    Also in 3 projects that use this

  • +2 more from CES-Ltd
  • +1 more from ffsshhttiikk

The file

We split this skill into the rules it gives an agent

12 rules. 0 are common, 10 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 105 edited versions we read keep these.

  • 10

    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:

    Write tests that fail for exactly one reason, pass deterministically, and survive refactoring.

    line 8
  2. Distinctive:

    Test observable behavior and contracts, not implementation details.

    line 21
  3. Very specific:

    Every bug fix gets a regression test (see the bug-fix skill).

    line 23
  4. Distinctive:

    Follow the project's existing test framework, directory layout, naming, and assertion style — do not introduce a new test framework into a …

    line 24
  5. Distinctive:

    No hidden dependencies on wall-clock time, timezones, locale, random seeds, network, or test execution order.

    line 28
  6. Very specific:

    Treat flaky tests as defects in the test suite: find the nondeterminism instead of masking it with retries or sleeps.

    line 30
  7. Distinctive:

    Never test against a development, staging, or production database.

    line 34
  8. Distinctive:

    Never share a test database between parallel test runs unless the project explicitly supports it.

    line 37
  9. Distinctive:

    Prefer real collaborators inside the process.

    line 44
  10. Distinctive:

    Keep test data minimal and meaningful — only include fields the behavior depends on.

    line 45
  11. Distinctive:

    Prefer the project's existing factories or fixtures over handwritten setup such as raw SQL.

    line 46
  12. Distinctive:

    Do not weaken or rewrite an existing test simply to make it pass.

    line 52

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

Write tests that fail for exactly one reason, pass deterministically, and survive refactoring.

Scope

Use for deciding what to test and writing it: new tests, coverage gaps, flaky tests, test structure, setting up a suite.

Do not use for:

  • Diagnosing why production code misbehaves when the cause is unknown — use debugging. Once the cause is identified, bug-fix returns here for the regression test.
  • Judging non-test production code — use code-quality-review.

What to test

  • Test observable behavior and contracts, not implementation details. A refactor that preserves behavior should not break tests.
  • Prioritize by risk: core business logic and boundary conditions first, then error paths, then integration seams. Do not chase coverage numbers for trivial code (getters, framework glue).
  • Every bug fix gets a regression test (see the bug-fix skill).
  • Follow the project's existing test framework, directory layout, naming, and assertion style — do not introduce a new test framework into a project that has one.

Determinism

  • No hidden dependencies on wall-clock time, timezones, locale, random seeds, network, or test execution order. Inject clocks, seed randomness, and fake external services at the boundary.
  • Each test owns its setup and teardown; tests must pass in isolation and in any order.
  • Treat flaky tests as defects in the test suite: find the nondeterminism instead of masking it with retries or sleeps. If the nondeterminism turns out to be in the production code rather than the test, hand off to debugging.

Databases and external state

  • Never test against a development, staging, or production database. Use the project's test database, or add a disposable one (container or in-process instance) if none exists.
  • Assert in global setup that the target is the test database; never let a missing test configuration fall back to the default database.
  • Reset between tests — transaction rollback, truncation, or a fresh schema. Never rely on data left by another test or manual seeding.
  • Never share a test database between parallel test runs unless the project explicitly supports it.
  • Apply the same isolation rules to caches, queues, object storage, and search indexes — use isolated instances or per-test namespaces.

Structure

  • One behavior per test; name the test after the behavior and expected outcome, following the project's naming convention.
  • Arrange–Act–Assert (or Given–When–Then), kept visually distinct.
  • Prefer real collaborators inside the process; mock only at process or network boundaries. Heavy mocking usually signals the unit under test is doing too much.
  • Keep test data minimal and meaningful — only include fields the behavior depends on.
  • Prefer the project's existing factories or fixtures over handwritten setup such as raw SQL.

Validation loop

  • While developing, run only the affected test file or case; run the broader relevant suite before declaring the work done.
  • Confirm a new test fails for the expected reason before relying on it.
  • Do not weaken or rewrite an existing test simply to make it pass. Fix the production code unless the test itself is incorrect.

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.