writing-tests
Skill43 starsChanged 2 months agoMITView on GitHub
Generic test writing discipline: test quality, real assertions, anti-patterns, and rationalization resistance. Use when writing tests, adding test coverage, or fixing failing tests for any language or framework. Complements language-specific skills.
16 other projects use a version of this.
Adopted by
Most recently taken up by
- PostHog/posthogtheir own version, first seen Oct 4, 2026
- PostHog/posthog-fosstheir own version, first seen Oct 4, 2026
- JetBrains/intellij-communitytheir own version, first seen Oct 3, 2026
- ZeroTokenClaw/agents-skillstheir own version, first seen Sep 21, 2026
- schmitthub/clawkertheir own version, first seen Sep 8, 2026
- ZaxbyHub/opencode-swarmtheir own version, first seen Sep 5, 2026
Used with
Projects with it also use create-tasks and reviewing-code.
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.
NTCodingSkillcreate-tasks
Creates well-formed tasks following a template that engineers can implement. Triggers on: 'create tasks', 'define work items', 'break this down', creating tasks from PRD, converting requirements into actionable tasks, feature breakdown, sprint planning.
Also in 3 projects that use this
augmntSkillreviewing-code
Provides structured code review with prioritized feedback. Use when reviewing PRs, analyzing code quality, checking for bugs, or auditing changes. Triggers on "review this", "check this code", PR reviews, or code quality questions.
Also in 3 projects that use this
Other versions16 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 16
- PostHog/posthog★ 40ksame name
- JetBrains/intellij-community★ 21ksame name
- cashew-labs/libretto★ 904same name
- PostHog/posthog-foss★ 721same name
- ZaxbyHub/opencode-swarm★ 485same name
- NTCoding/claude-skillz★ 352same name
- schmitthub/clawker★ 54same name
- lox/agent-skills★ 15same name
- witi-projects/Skills★ 2same name
- augmnt/webdev-skills★ 1same name
6 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.
In this repository28 other files it gives its agents.
- agent-native-architectureSkill
- brainstormingSkill
- code-reviewSkill
- cpp-systemsSkill
- c-systemsSkill
- debuggingSkill
- document-reviewSkill
- frontend-designSkill
- git-worktreeSkill
- linux-bash-scriptingSkill
- md-docsSkill
- meta-promptingSkill
- nodejs-backendSkill
- orchestrating-swarmsSkill
- php-laravelSkill
- pinescriptSkill
- planningSkill
- postgresqlSkill
- python-servicesSkill
- react-frontendSkill
- receiving-code-reviewSkill
- reflectSkill
- rust-systemsSkill
- simplifying-codeSkill
- terraformSkill
- test-auditSkill
- verification-before-completionSkill
- writingSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 16 edited versions we read keep these.
6
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
- Distinctive: line 20
Prefer real internal objects, real temporary files, and real test databases.
- Distinctive: line 23
Run the narrow checks during edits and the applicable complete checks before handoff.
- Very specific: line 27
When choosing cases, fixture shape, mock boundaries, or unit/integration/E2E balance, read test-design.md.
- Distinctive: line 29
When reviewing generated tests, changing snapshots, testing async timing, or seeing mocks substitute for behavior, read test-smells.md and …
- Distinctive: line 33
When byte equivalence or a generated corpus is the contract, read generated-corpus-techniques.md.
- Distinctive: line 34
When stuck, considering skipping tests, or assembling a test-work handoff, read test-completion.md.
- Distinctive: line 38
Verify public behavior and edge paths, independence between tests, reviewed expectation changes, and each claimed capability.
“Common” is measured: kept by at least 6 in 10 of the 16 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
Writing tests
Produce tests that prove the requested behavior and fail when that behavior breaks. Follow user scope and the repository's actual contracts; this skill does not authorize implementation, external actions, or changes to acceptance criteria.
Procedure
- Discover the repository's runner, pinned wrapper, configuration, neighboring tests, and CI command before writing tests. Learn both focused and full-suite commands. Use project tooling rather than a global default; keep tracked scripts portable and apply personal wrappers only to the outer invocation.
- Derive cases from user requirements, implemented behavior, and claims intended for the handoff. Map each acceptance criterion to a discriminating case that a plausible wrong implementation fails. Name tests by observable behavior; keep one behavior per test and make fixtures adversarial on the axis under test.
- For bug fixes, write the reproducer, observe the intended failure, apply the smallest fix, and observe green. For new features, follow the selected test posture in vertical slices: default to tests-after (one small implementation slice, then its test); with an explicit test-first choice, write one test, then the minimal implementation that passes it. Repeat by slice; writing all tests first and all implementation afterward (horizontal slicing) is an anti-pattern that produces tests for imagined behavior. Refactor after green. Never alter a specification, assertion, fixture, snapshot, or expected output merely to make the implementation pass.
- Prefer real internal objects, real temporary files, and real test databases. Mock only external boundaries, at the last owned adapter; framework-maintained fakes are appropriate where the framework recommends them. Check the real contract and side effects before mocking.
- Assert consumer-visible outcomes rather than private structure, mock calls, or framework behavior. Include relevant boundary, invalid-input, concurrency, and failure cases. If error handling catches, logs, substitutes, or rolls back, assert its observable result as well as error visibility.
- Prove absence/isolation assertions with a run-unique forbidden violation and observe that specific assertion fail. Confirm the control mutation actually landed and its build completed before evaluating it. Remove the control, restore the artifact, and verify green.
- Run the narrow checks during edits and the applicable complete checks before handoff. Inspect passed/executed counts; an empty or skipped suite is not positive evidence.
Select the detail needed
- When choosing cases, fixture shape, mock boundaries, or unit/integration/E2E balance, read test-design.md.
- For bug reproducers, mutation controls, or assertions that something must not happen, read regression-proof.md.
- When reviewing generated tests, changing snapshots, testing async timing, or seeing mocks substitute for behavior, read test-smells.md and the applicable fix ladder in anti-patterns-extended.md. To audit whether existing tests detect regressions, use ia-test-audit.
- For weak aggregates, vacuous assertions, race reproduction, or controls that may never reach their subject, read oracle-smells.md. It routes to the longer catalogs when those failure shapes apply.
- For container state, sandboxing, timeouts, environment relocation, or process/stream isolation, read isolation-and-sandbox-traps.md.
- For wrappers, filters, conformance oracles, skip conditions, or misleading green summaries, read false-pass-oracle-traps.md.
- When byte equivalence or a generated corpus is the contract, read generated-corpus-techniques.md; compare against an independent implementation across value shapes and nesting.
- When stuck, considering skipping tests, or assembling a test-work handoff, read test-completion.md. Before arguing against a needed test, read rationalization-table.md.
Verify and report
Verify public behavior and edge paths, independence between tests, reviewed expectation changes, and each claimed capability. Mentally remove a guard, flip a branch, or drop a side effect and confirm a test detects it. Prefer a unit suite fast enough for frequent use (under 30 seconds).
Report what the tests exercised, actual results, failures, and omissions. Distinguish fixtures from live proof. Use the applicable PHP/Laravel or React/TypeScript skill for framework conventions; this generic skill does not replace them.
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.

