agentleFS
sxntixgosxntixgo/frugal-skills/skills/writing-tests/SKILL.md

writing-tests

Skill0 starsChanged 4 months agoMITView on GitHub

Enumerates and writes test cases for a change — happy path, edges, boundaries, and error paths — in the project's test framework. Use when adding or improving tests, or when the TDD loop needs to know which cases to write.

39 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use reviewing-code, commits and 3 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.
  • bostonaholicSkill

    reviewing-code

    Code review methodology for evaluating implementation changes. Use when reviewing code changes for quality, design, correctness, and maintainability. Focuses on changes made during implementation using Conventional Comments for clear, actionable feedback.

    Also in 4 projects that use this

  • JetBrainsSkill

    commits

    Use this skill whenever the user asks to commit changes, write or fix a commit message, amend or rename a commit, or do a workflow that includes committing in the IntelliJ repository. This is a thin repo-specific overlay: use IntelliJ commit format, write full commit messages by default, and keep requested suffixes such as IJ-MR trailers in a final separate paragraph.

    Also in 3 projects that use this

  • OpenAISkill

    running-tests

    Guide for running tests in the openai-dotnet repository. Use this when asked to run, debug, or validate tests, or when writing new tests. Explains test modes (Playback, Record, Live), how to identify recorded vs non-recorded tests, environment variable configuration, and what to do when recordings are missing or stale.

    Also in 3 projects that use this

  • VercelSkill

    technical-writing

    Write, edit, review, or audit user-facing documentation for the eve repository. Use for changes under docs/, documentation tied to eve APIs or CLI behavior, docs work based on Slack or support feedback, and requests to make eve docs clearer, more natural, or less AI-patterned while verifying claims against current source, tests, CLI help, public releases, and repository conventions.

    Also in 3 projects that use this

  • GoogleSkill

    improve-codebase-architecture

    Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

    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, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 39 edited versions we read keep these.

  • 4

    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:

    Test observable behavior, not implementation.

    line 8
  2. Distinctive:

    Write those tests in the project's framework, following its conventions.

    line 14
  3. Distinctive:

    Write the list to the checkpoint file before coding tests.

    line 35
  4. Very specific:

    Keep tests independent and deterministic (no shared mutable state, no real clock/network/random — use test doubles at the seams).

    line 42
  5. Distinctive:

    Run the tests. In a TDD flow they must fail first for the RIGHT reason, then pass once the code is written.

    line 47
  6. Very specific:

    Every behavior of the unit has a test across happy/boundary/edge/error.

    line 61

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

Writing Tests

Test observable behavior, not implementation. First enumerate the cases that matter, then write them in the project's existing framework and style.

Scope

This skill DOES:

  • Enumerate the cases for a unit of behavior (happy / edge / boundary / error).
  • Write those tests in the project's framework, following its conventions.

This skill does NOT:

  • Implement or refactor the production code → that's software-development.
  • Chase a coverage percentage for its own sake → cover behavior and risk.

Workflow

Surface these as TodoWrite items. Checkpoint the case list to ./.claude-skills-work/writing-tests/<unit>/cases.md so it survives interruption.

Step 1 — Identify the unit and its contract

State what the unit should do: inputs, outputs, side effects, and the observable "done" behavior. This is what you test — not private helpers or internal state.

Step 2 — Enumerate cases

For the unit, list cases across these categories (see references/test-design.md for the techniques):

  • Happy path — the main expected behavior(s).
  • Boundaries — empty, zero, one, max, off-by-one, first/last.
  • Edges — nulls/undefined, unexpected types, duplicates, ordering, unicode.
  • Error paths — invalid input, dependency failure/timeout, unauthorized. Write the list to the checkpoint file before coding tests.

Step 3 — Write the tests

  • One behavior per test; a clear name that states the expectation ("returns 409 when the email already exists").
  • Arrange–Act–Assert; assert on behavior/output, not internal calls, unless the side effect IS the behavior.
  • Keep tests independent and deterministic (no shared mutable state, no real clock/network/random — use test doubles at the seams).
  • Match the project's framework, file layout, and naming.

Step 4 — Run and confirm

Run the tests. In a TDD flow they must fail first for the RIGHT reason, then pass once the code is written. A test that can't fail tests nothing.

Red flags (stop and correct)

If you notice…Do this
Testing implementation details / private methodsTest observable behavior instead
Only the happy pathAdd boundary + error cases before finishing
Asserting on mock call counts as the pointAssert on the resulting behavior/output
A flaky test (time, network, order)Inject a test double at the seam; make it deterministic
Writing tests to hit a coverage numberCover behavior and risk, not lines
One test asserting many unrelated thingsSplit into focused tests

Done when

  • Every behavior of the unit has a test across happy/boundary/edge/error.
  • Tests are independent, deterministic, clearly named, and run green (or fail correctly first, in TDD).

References (load only when needed)

  • references/test-design.md — techniques: equivalence partitioning, boundary values, choosing test doubles, and what makes a test valuable.

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.