agentleFS
cachewraithcachewraith/cachewraith-skills/skills/testing/SKILL.md

testing

Skill0 starsChanged 8 days agoMITView on GitHub

Run, write, and debug tests — unit, integration, and end-to-end — in whatever framework the project already uses (Jest, Vitest, PHPUnit, Pytest, Go test, cargo test, RSpec, JUnit). Invoke when the user asks to test something, run the suite, add or fix tests, check coverage, or investigate a failing test. Skip when they want a code review rather than tests, or are asking how a test framework works in the abstract.

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 172 edited versions we read keep these.

  • 2

    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:

    Never guess the runner or invent a command:

    line 13
  2. Very specific:

    Use the project's own command — npm test, composer test, pytest, go test ./..., cargo test — not a hand-rolled invocation.

    line 32
  3. Distinctive:

    Read the actual failure output before changing anything.

    line 85

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

Find the project's test setup, use it, and write tests that would actually catch a regression.

1. Find the setup before writing anything

Never guess the runner or invent a command:

ls package.json composer.json pyproject.toml pytest.ini Cargo.toml go.mod Gemfile pom.xml 2>/dev/null
sed -n '/"scripts"/,/}/p' package.json          # JS/TS, then jest/vitest/playwright config
ls phpunit.xml* tox.ini setup.cfg 2>/dev/null   # PHP / Python

Read CLAUDE.md / AGENTS.md, README.md, and CONTRIBUTING.md for test rules first. Projects routinely have non-obvious requirements — a real database instead of an in-memory one, an env file to source, serial execution, a fixture reset between cases. Those override every default here.

Then read one existing test in full and match its structure, naming, helpers, and assertion style. A test that doesn't look like its neighbours is a worse test even when it passes.

2. Run the suite

Use the project's own command — npm test, composer test, pytest, go test ./..., cargo test — not a hand-rolled invocation; the script usually carries required flags (config path, serial workers, env loading).

Narrow down while iterating, then run the full suite before declaring done — a narrow run hides cross-test breakage.

npx jest --config test/jest-e2e.json -t "sends a friend request"
pytest tests/test_auth.py::test_login -x
go test ./internal/auth -run TestLogin -v

3. What to write

Pick the level that matches what you're protecting:

  • Unit — pure logic, edge cases, branching. Fast, no I/O. Validators, formatters, calculations, state machines.
  • Integration — a service against a real database or dependency. Queries, transactions, locking — anything where the ORM's behaviour is the risk.
  • End-to-end — a real request over the real stack. Status codes, response shape, auth, guard ordering, rate limits.

Where a project has one dominant style, follow it rather than introducing a parallel testing culture nobody maintains.

Test behaviour, not implementation. Assert on what a caller observes — return value, response body, status code, database state, emitted event. A test asserting a private method was called breaks on every refactor and catches nothing.

Cover what actually breaks: the happy path once, then every error path (invalid input, missing auth, wrong owner, not found, conflict), boundaries (empty/one/many, zero/negative/max, first and last page), idempotency (doing it twice, out of order, after it already happened), and concurrency where an invariant depends on it. Error paths are where the bugs are; a suite that only tests success is decorative.

Assertions: one behaviour per test, named for what it guarantees (rejects login for an unverified email, not test login 2). Assert exact wire strings, status codes, and shapes when they are a contract — loose matchers let breaking changes through. No conditional logic in a test; an if tests two things badly.

Fixtures and isolation: each test must pass alone and in any order — shared mutable state is a defect in the suite. Follow the project's reset mechanism exactly (truncate helper, transaction rollback, fresh container); note that a wrapping transaction cannot work when the code under test runs over real HTTP on its own connection. Reset the things that produce mystifying failures elsewhere: rate limiters, caches, recorded mail, clocks, in-memory queues. Build fixtures with a factory, not copy-pasted literals. Mock at the system boundary — third-party HTTP, payments, clocks, randomness — and do not mock your own database into meaninglessness.

4. When a test fails

  1. Read the actual failure output before changing anything; the diff usually names it.
  2. Decide honestly which side is wrong. Fix the code when the test encodes the intended behaviour.
  3. Never weaken an assertion, add a retry, or bump a timeout to turn red green. If a test is genuinely obsolete, say so and delete it deliberately.
  4. Flaky? Find the shared state, ordering assumption, or real timing dependency. Do not paper over it with a sleep.
  5. Reproduce with the narrowest run, fix, then re-run the full suite.

5. Report

The command and the pass/fail counts. If anything failed, the failing test names and the real output — never round a failing run up to "done". What you added coverage for, what you deliberately left uncovered and why, and anything you could not run (missing database, absent credentials) with what it would take to run it.

Download now (ZIP)

  • Other versions192 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 192

    1. modelcontextprotocol/servers★ 92ksame name
    2. lobehub/lobe-chat★ 84ksame name
    3. lobehub/lobehub★ 84ksame name
    4. penpot/penpot★ 62ksame name
    5. meteor/meteor★ 45ksame name
    6. iOfficeAI/AionUi★ 34ksame name
    7. garrytan/gbrain★ 31ksame name
    8. OpenZeppelin/openzeppelin-contracts★ 27ksame name
    9. tursodatabase/turso★ 25ksame name
    10. redis/go-redis★ 22ksame name

    182 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use bundle-dependency-prs, update-library-template and 8 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 6 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 6 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

    • 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

    • 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

  • In this repository11 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.