unit-test-writer
Skill50 starsChanged 21 days agoMITView on GitHub
Writes focused unit tests for a function or module, covering the normal case, edge cases and failures, in the test framework the project already uses. Use when the user asks for tests, wants coverage for new code, or needs a regression test that reproduces a bug.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- dayvisonassis/sdd-skillstheir own version, first seen Oct 12, 2026
- FieryInferno/claude-skillstheir own version, first seen Aug 9, 2026
- minagayid/Agentstheir own version, first seen Jul 5, 2026
- megamott/vibe-skillstheir own version, first seen May 15, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- megamott/vibe-skills★ 28same name
- dayvisonassis/sdd-skills★ 3same name
- minagayid/Agents★ 1same name
- FieryInferno/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 repository26 other files it gives its agents.
- api-endpoint-testerSkill
- changelog-generatorSkill
- commit-message-writerSkill
- cron-explainerSkill
- csv-profilerSkill
- docker-compose-reviewerSkill
- dockerfile-linterSkill
- env-file-auditorSkill
- git-conflict-resolverSkill
- incident-postmortem-writerSkill
- json-diffSkill
- jwt-inspectorSkill
- log-analyzerSkill
- markdown-link-checkerSkill
- meeting-notes-to-actionsSkill
- openapi-summarizerSkill
- pr-description-writerSkill
- python-code-smellsSkill
- readme-doctorSkill
- regex-explainerSkill
- release-checklistSkill
- requirements-auditorSkill
- secure-code-reviewSkill
- skill-authorSkill
- sql-query-reviewerSkill
- todo-extractorSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
7
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 23
Find the conventions: Look at existing tests for the framework (pytest, unittest, Jest, JUnit, Go test), file layout, naming and fixtures.
- Distinctive: line 26
Plan the cases: before writing code:
- Distinctive: line 40
Write the failing test first, from the report.
- Distinctive: line 45
Do not copy the implementation into the test to compute the expected value.
- Distinctive: line 46
Avoid sleeping, real network calls and shared global state.
- Distinctive: line 47
Keep test data inline unless it is large.
- Distinctive: line 56
If the code cannot be tested without a refactor (for example it reads a global), say so and propose the smallest change that makes it …
“Common” is measured: kept by at least 6 in 10 of the 3 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
Unit test writer
Good tests describe behavior. They fail for one reason and say what broke.
When to use
- New code has no tests.
- A bug was fixed and needs a test that would have caught it.
- The user asks to raise coverage on a module.
Steps
- Find the conventions. Look at existing tests for the framework (pytest, unittest, Jest, JUnit, Go test), file layout, naming and fixtures. Follow them. Do not introduce a new framework.
- Read the code under test. List its inputs, outputs, side effects and the errors it can raise.
- Plan the cases before writing code:
- the normal case with realistic input,
- boundaries: empty, one item, maximum, zero, negative, unicode,
- invalid input and the exact error expected,
- one case per branch that has different behavior.
- Write each test small. One behavior per test, a name that states it (
test_returns_empty_list_for_empty_input), arrange, act, assert in that order. - Isolate. Replace network, clock, randomness and the file system with fakes or temporary directories. Tests must not depend on the order they run in.
- Run them. Show the command and the result. Make sure a new test fails when the behavior is broken (change the code or the expectation briefly and check).
For a bug fix
Write the failing test first, from the report. Confirm that it fails for the right reason, then fix the code.
Rules
- Assert on behavior, not on implementation details such as private function calls.
- Do not copy the implementation into the test to compute the expected value. Use a literal.
- Avoid sleeping, real network calls and shared global state.
- Keep test data inline unless it is large.
Example
For parse_duration("1h30m") the plan is: "1h30m" gives 5400, "90s" gives 90, "" raises ValueError,
"1x" raises ValueError, and "0s" gives 0.
Errors
If the code cannot be tested without a refactor (for example it reads a global), say so and propose the smallest change that makes it testable.
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.

