agentleFS
OrionicsLtdOrionicsLtd/claude-skills/skills/testing/SKILL.md

testing

Skill1 starsChanged 25 days agoMITView on GitHub

Write and organise tests. Use whenever writing, changing or reviewing tests, fixing a bug, or choosing the acceptance tests for a spec. Two levels: unit tests on the pure core, integration tests through the real entry point with fakes only at the I/O edge; no end-to-end tests against live services. Every test must be able to fail and must pass on a clean checkout.

194 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use bundle-dependency-prs, update-library-template 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.
  • MicrosoftSkill

    bundle-dependency-prs

    Fix broken dependency update PRs and aggregate the ones that work into one PR.

    Also in 7 projects that use this

  • MicrosoftSkill

    update-library-template

    Merges the latest Library.Template into this repo (at position of HEAD) and resolves conflicts.

    Also in 7 projects that use this

  • zetaloopSkill

    assign-copilot

    Assigns a GitHub issue to the Copilot coding agent, optionally specifying a custom agent. Use this when asked to assign an issue to Copilot or delegate an issue to CCA.

    Also in 3 projects that use this

  • NVIDIA-NeMoSkill

    build-and-dependency

    Dev environment setup for Megatron Bridge — container-based development, uv package management, lockfile regeneration, adding dependencies, Slurm container usage, and common build pitfalls.

    Also in 3 projects that use this

  • timmo001Skill

    changeset-scope

    Keep all scoped code work contained to the user-defined changeset. Use for implementation, fixes, diagnosis, refactoring, cleanup, and review when explicit instructions, named files, diffs, branches, pull requests, or injected work scopes define the boundary.

    Also in 3 projects that use this

  • JetBrainsSkill

    module-dependencies

    Add or modify IntelliJ module dependencies in `.iml` files.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 175 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No end-to-end tests: none that touch live services, deployed systems, real accounts or paid APIs.

    line 28
  2. Distinctive:

    Never mock the repo's own modules.

    line 38
  3. Distinctive:

    Prefer in-memory fakes and recorded responses to mock objects.

    line 40
  4. Distinctive:

    Watch it fail first: Write the test before the code and run it: it must fail for the right reason.

    line 47
  5. Very specific:

    Derive expected values independently: Write the arithmetic in the test (1000 + 300 - 75 - 100) or use a hand-checked worked example.

    line 52
  6. Distinctive:

    A clean checkout passes the suite: Never read gitignored, hand-kept or live data, the network or the clock.

    line 57

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

Levels

LevelCoversTest doubles
UnitFunctions of the pure core: examples, edge cases, properties.None needed.
IntegrationUnits wired together, driven through the real entry point (CLI in-process or as a subprocess, public API, pipeline stage) on committed fixtures.Fakes or recorded responses at the I/O edge only (see below). Real filesystem in a temp dir.
  • Logic, branches and edge cases go in unit tests; most tests live there.
  • Laws an API must keep (round-trip, idempotence, ordering, conservation) become property-based tests (Hypothesis in Python) alongside examples.
  • A change to what an entry point accepts or does (a command, flag, step or output) gets an integration test that reaches it from the entry point. Test there what only the wiring can break: parsing, step order, what is written or printed, exit codes, errors crossing modules. Don't re-test the units' branches.
  • A bug fix gets a test at the lowest level that reproduces it.
  • No end-to-end tests: none that touch live services, deployed systems, real accounts or paid APIs. They cost money, flake, and can't run on a clean checkout. A check against real data is a script, or a test that skips with a reason when the data is absent and has an offline counterpart.

Test doubles

  • Fake only the I/O edge: network, paid APIs, clock, randomness, and local tools the suite can't assume are installed (feed their recorded output). Tools it can assume, like git, run for real in a temp dir; set environment variables per test.
  • Never mock the repo's own modules. Code that is hard to test without mocking them has logic in the shell; move it into the core.
  • Prefer in-memory fakes and recorded responses to mock objects. Assert on outcomes, not on which methods were called.
  • A recorded response is a real one captured once, trimmed and scrubbed of secrets, and committed.

Every test

  • Watch it fail first. Write the test before the code and run it: it must fail for the right reason. For a bug fix, revert the fix once and see the test fail; for code that already works, break the behaviour once, see the test fail, restore.
  • Test behaviour. Assert what a caller can observe (return values, CLI output, files written), not private helpers or the wording of prompts and docs.
  • Derive expected values independently. Write the arithmetic in the test (1000 + 300 - 75 - 100) or use a hand-checked worked example; never compute the expectation with the code under test or copy numbers from a run.
  • No tests that cannot fail: is not None or type-only asserts, a pure function called twice to prove determinism.
  • A clean checkout passes the suite. Never read gitignored, hand-kept or live data, the network or the clock; use committed fixtures.
  • One behaviour per test, named for it (test_merge_keeps_newest_entry); use table-driven cases (pytest's parametrize) rather than a loop.
  • Layout follows the repo. Where there is none, keep integration tests in their own directory so each level can run alone.

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.