test-writing
Skill2 starsChanged 2 months agoMITView on GitHub
Writes, reviews, and prunes tests so the committed suite protects contracts and invariants rather than implementation. Use when writing or reviewing tests, choosing a test seam, scope, or mocks, adding property, fuzz, or regression tests, fixing brittle tests, auditing a bloated suite, or deciding whether a failing test means the code or the test is wrong. Do NOT use for TLA+ model checking (use tla-model).
6 other projects use a version of this.
Adopted by
Most recently taken up by
- zoharp/claude-skillstheir own version, first seen Nov 8, 2026
- NVIDIA/torch-harmonicstheir own version, first seen Oct 13, 2026
- MANVENDRA-github/agentrytheir own version, first seen Jul 6, 2026
- kumar303/pietheir own version, first seen Jun 8, 2026
- galando/piv-speckittheir own version, first seen Jan 22, 2026
- plipowczan/claude-piv-skeletontheir own version, first seen Jan 22, 2026
Used with
Projects with it also use api-design.
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.
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 3 projects that use this
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- NVIDIA/torch-harmonics★ 727same name
- galando/piv-speckit★ 28same name
- plipowczan/claude-piv-skeleton★ 4same name
- kumar303/pie★ 1same name
- MANVENDRA-github/agentry★ 0same name
- zoharp/claude-skills★ 0same name
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.
In this repository27 other files it gives its agents.
- agent-guardrailsSkill
- benchmark-checklistSkill
- blast-radiusSkill
- blog-reviewSkill
- code-reviewSkill
- create-verification-skillSkill
- datavizSkill
- grill-meSkill
- grok-repoSkill
- hammerspoonSkill
- html-lessonSkill
- karpathy-planningSkill
- mechanism-vizSkill
- obsidian-captureSkill
- obsidian-searchSkill
- paper-searchSkill
- readbackSkill
- repo-evalSkill
- route-skillSkill
- sherlockSkill
- show-meSkill
- sketch-conceptSkill
- skill-curatorSkill
- tla-modelSkill
- web-recapSkill
- write-docsSkill
- write-skillSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
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
- Distinctive: line 34
Place the suite where the complexity lives:
- Distinctive: line 47
Hiding failures: No retries or exception handling that turn broken behavior green.
“Common” is measured: kept by at least 6 in 10 of the 5 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.
Files
test-writing
Verify aggressively; commit sparingly. A generated test costs nothing to write and still costs every future refactor and reader. A test that locks in the wrong shape is worse than none: it will be believed, and in an agentic loop the suite is the acceptance criteria being optimized against.
Workflow
- Find the seam. Name the interface that survives a full internal rewrite: for a store,
Open/Read/Write/Save/Restore, not the fetcher, cache, retryer, or chunk layout beneath it. Done when you can say what a rewrite behind it is free to change. An export, flag, or hook that only tests call is not a seam; test through its production caller. - State the oracle first. For each expected value, name its source: requirement, design doc, API contract, reference implementation, or hand computation. Done when no expected value comes from running the code under test.
- Explore ephemerally. Properties, fuzzing, differential runs, fault injection, random operation sequences against a simple model — run them in the loop, in test files you will delete before the report. Done when every exploration file is either admitted by step 4 or gone.
Admit or discard. A test enters the repo only if every answer is yes; the same gate judges existing tests:
- It protects a contract, invariant, failure/recovery semantic, compatibility promise, or a bug that happened.
- Its oracle is independent of the implementation.
- It survives an internal rewrite behind the seam.
- It is the contract's one owner, at the strongest boundary. Another layer earns a test only for a risk the owner cannot reach.
- Its name claims no more than its input exercises.
Exploration found a bug → shrink it to the smallest stable case and admit only that. Found nothing → delete it.
What fails the gate is still verified, by adversarial review instead of a committed test:
code-review(BurntSushi lens) by a reader who did not write the code, whose every finding must name the input that breaks it. A confirmed break re-enters step 3 as a regression.- Write it in long-lasting form. Test logic once; cases as data — table rows,
testdatafiles, txtar archives, scripts. Failures print input, got, and want. Golden files regenerate through an update flag, and every regenerated diff is read. Done when the next regression is a one-line or one-file addition. - See it fail. Break the behavior — revert the fix for a regression, otherwise mutate the line the contract rests on — and run the suite. The test fails for its stated reason, and its failure names one cause. An existing test also going red means yours is a duplicate unless it reaches a risk that owner cannot; drop or move it. For a negative assertion, remove the guard under test: still green means it passed on another guard. Restore the code and rerun green. Done when every kept test has been red for its own reason.
Existing suites
An existing test that fails the gate is suspect, not deletable: it may be the only guard of a contract. Changing, merging, or deleting one requires the user's confirmation — propose each with the evidence in REFERENCE, then apply only what they approve.
Routing
Place the suite where the complexity lives:
- Inside the process — algorithms, parsers, domain rules. Test deeply through the public API; prefer properties or exhaustive small inputs over hand-picked examples.
- At the boundaries — services, glue, orchestration. The service is the unit; test from its edges with realistic fixtures.
- In the state space — storage, replication, recovery, concurrency. Random operation sequences against a sequential model, with crash, restart, and injected faults as operations. For the design itself, use
tla-model.
Widen the boundary until setup gets expensive or the test stops being hermetic, then stop. IO is not the criterion: loopback HTTP, in-process SQLite, and a temp dir are cheap; a shared or remote target is not. A deployed environment earns only wiring and real third-party behavior. Trivial glue gets no test.
Traps
- Repairing the test instead of the code. A failing test is a bug report until shown otherwise. Never weaken an assertion, add a mock, or skip to reach green. Changing a test and its code in one commit needs a stated reason both were wrong.
- Trusting your own oracle. A failing property is a hypothesis: the code, the property, or the generator is wrong. Recheck the property against the spec before calling it a bug.
- Mutating the environment to get green. Seeding rows, flipping flags, restarting services, or draining queues passes nothing that matters. Reproduce a shared-environment failure hermetically, or say you could not.
- Hiding failures. No retries or exception handling that turn broken behavior green; bounded waits on a public completion signal are fine. Inject the clock.
- Mocking by default. Real local dependencies when cheap and deterministic; fakes at unmanaged boundaries; communication mocks only for outbound calls you cannot observe otherwise.
Report (REQUIRED)
End every test-writing task with:
- Kept: each committed test — the behavior it protects, its oracle source, and the break that turned it red.
- Explored: what ran and was discarded, and what it found.
- Proposed: changes to existing tests awaiting confirmation.
See REFERENCE.md for case formats, exploration, state-machine and compatibility tests, pruning evidence, test sizing, and deployed environments.
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
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.

