test-writer
Skill0 starsChanged 6 months agoMITView on GitHub
Writes focused, behavior-driven unit and integration tests for a given function, module, or change, covering happy paths, edge cases, and error conditions using the project's existing test framework and conventions. Use when the user asks to write or add tests, improve coverage, write a unit/integration test, or do test-driven development.
28 other projects use a version of this.
Adopted by
Most recently taken up by
- seankoji-com/.agentstheir own version, first seen Nov 8, 2026
- Devolutions/IronRDPtheir own version, first seen Nov 1, 2026
- WST2002/claude-code-skillstheir own version, first seen Oct 17, 2026
- anchildress1/awesome-aitheir own version, first seen Oct 13, 2026
- krishnamallam/upboxtheir own version, first seen Oct 11, 2026
- poshan0126/dotclaudetheir own version, first seen Oct 8, 2026
Used with
Projects with it also use debug-fix, debugger 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.
zebbernSkilldebug-fix
Find and fix a bug or issue — from any source (GitHub issue, error message, user report, or observed behavior)
Also in 4 projects that use this
JohnJBorenSkilldebugger
Systematic debugging workflows, root cause analysis, and troubleshooting patterns
Also in 3 projects that use this
get-proofpilotSkillcontext-budget
Audits Claude Code context window consumption across agents, skills, MCP servers, and rules. Identifies bloat, redundant components, and produces prioritized token-savings recommendations.
Also in 3 projects that use this
nimbalystSkillprd-writer
Create structured Product Requirements Documents (PRDs) with prioritized requirements. Use when writing product specs, feature requirements, or project briefs.
Also in 3 projects that use this
GoogleSkillcode-reviewer
Also in 4 projects that use this
GitHubSkillrefactor
Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.
Also in 4 projects that use this
Other versions28 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 28
- leonardomso/33-js-concepts★ 67ksame name
- Devolutions/IronRDP★ 3.3ksame name
- poshan0126/dotclaude★ 871same name
- TheDecipherist/claude-code-mastery-project-starter-kit★ 337same name
- hamzafarooq/claude-code-starter★ 145same name
- anchildress1/awesome-ai★ 67same name
- anchildress1/awesome-github-copilot★ 67same name
- nimbalyst/skills★ 28same name
- Twigpine/openclaude-skills★ 19same name
- jeremymcs/skills★ 8same name
18 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 repository11 other files it gives its agents.
- a11y-auditorSkill
- api-design-reviewerSkill
- changelog-writerSkill
- conventional-commit-writerSkill
- dockerfile-hardenerSkill
- env-secrets-auditorSkill
- error-message-explainerSkill
- pr-description-writerSkill
- readme-generatorSkill
- regex-builderSkill
- sql-query-optimizerSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 27 edited versions we read keep these.
6
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 13
Write tests that document behavior and catch regressions — not tests that just chase a coverage number.
- Distinctive: line 35
Follow the existing file location, naming, and assertion style.
- Distinctive: line 52
Prefer a few high-value cases over many trivial ones.
- Distinctive: line 64
No real network, clock, randomness, or filesystem unless that *is* the unit under test — inject or mock them.
- Distinctive: line 73
Run the suite. A test that can't fail is worthless: if unsure, temporarily break the code and confirm the test goes red, then restore it.
- Distinctive: line 131
Integration tests: use an ephemeral DB/container or transaction rollback per test for isolation.
“Common” is measured: kept by at least 6 in 10 of the 27 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 Writer
Write tests that document behavior and catch regressions — not tests that just chase a coverage number. Match the project's existing framework and style.
Workflow
- [ ] 1. Detect the test framework and conventions already in use
- [ ] 2. Identify the unit under test and its observable behavior
- [ ] 3. Enumerate cases: happy path, edges, errors, boundaries
- [ ] 4. Write each test: Arrange–Act–Assert, one behavior per test
- [ ] 5. Make tests deterministic and isolated
- [ ] 6. Run them; ensure they pass and actually exercise the codeStep 1 — Match the project
Do not introduce a new test framework. Detect and reuse what exists:
- JS/TS:
vitest,jest,node:test,mocha(checkpackage.jsonand existing*.test.*). - Python:
pytest(default),unittest. - Go:
testing+ table-driven tests. - Rust:
#[cfg(test)]modules; Java: JUnit 5.
Follow the existing file location, naming, and assertion style. Reuse existing fixtures and helpers instead of inventing parallel ones.
Step 2 — Test behavior, not implementation
Assert on observable outputs and side effects (return values, thrown errors, emitted events, DB rows) — not private internals. A good test survives a refactor that preserves behavior.
Step 3 — Enumerate cases
For each unit, cover:
- Happy path: typical valid input → expected output.
- Boundaries: empty, single element, max size, zero, negative, off-by-one.
- Edge values: null/undefined/None, empty string, whitespace, unicode, very large input.
- Error conditions: invalid input raises/returns the right error; failures are handled.
- State/idempotency: calling twice, ordering, concurrency where relevant.
Prefer a few high-value cases over many trivial ones. Every test should be able to fail for a real reason.
Step 4 — Structure each test
- Arrange–Act–Assert with a blank line between phases.
- One behavior per test. Multiple assertions are fine if they describe the same behavior.
- Descriptive names that read as a sentence:
returns 0 for an empty cart,throws when the user is not found.
Step 5 — Determinism and isolation
- No real network, clock, randomness, or filesystem unless that is the unit under test — inject or mock them. Freeze time; seed RNG.
- Each test sets up and tears down its own state; tests must pass in any order and in parallel. No shared mutable globals.
- Mock at the boundary (HTTP client, DB driver), not your own domain logic. Over-mocking produces tests that pass while the app is broken.
Step 6 — Verify
Run the suite. A test that can't fail is worthless: if unsure, temporarily break the code and confirm the test goes red, then restore it.
Examples
Vitest / TypeScript for function discount(total, code):
import { describe, it, expect } from "vitest";
import { discount } from "./pricing";
describe("discount", () => {
it("applies a known 10% code", () => {
expect(discount(100, "SAVE10")).toBe(90);
});
it("returns the original total for an unknown code", () => {
expect(discount(100, "NOPE")).toBe(100);
});
it("never returns a negative total", () => {
expect(discount(5, "SAVE10")).toBeGreaterThanOrEqual(0);
});
it("throws on a negative total", () => {
expect(() => discount(-1, "SAVE10")).toThrow(/total/i);
});
});pytest table-driven style:
import pytest
from app.pricing import discount
@pytest.mark.parametrize("total, code, expected", [
(100, "SAVE10", 90), # happy path
(100, "NOPE", 100), # unknown code -> no change
(0, "SAVE10", 0), # boundary: zero total
])
def test_discount(total, code, expected):
assert discount(total, code) == expected
def test_discount_rejects_negative_total():
with pytest.raises(ValueError, match="total"):
discount(-1, "SAVE10")Anti-patterns to avoid
- Asserting on log output or call counts instead of real behavior.
- Tests coupled to implementation details (private methods, internal call order).
- One giant test covering ten things — failures become undiagnosable.
- Snapshot tests for logic that should have explicit assertions.
- Mocking the thing you're trying to test.
Common edge cases
- Async code: await/return promises; assert on rejections; avoid arbitrary
sleep. - Time-dependent logic: inject a clock or use fake timers; never assert on
now(). - Floating point: compare with a tolerance, not
==. - Integration tests: use an ephemeral DB/container or transaction rollback per test for isolation; keep them separate from fast unit tests.
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.

