test-writer
Skill1 starsChanged 2 months agoMITView on GitHub
Generates comprehensive unit and integration tests for a given file or function, auto-detecting the project test framework and matching existing test style.
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, changelog-writer and 9 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
zbruhnkeSkillchangelog-writer
Maintain CHANGELOG.md with properly categorized entries. Use after implementing features, fixing bugs, or making any notable changes. Follows Keep a Changelog format.
Also in 5 projects that use this
glinckerSkillreadme-generator
Generates comprehensive README.md files for software projects by analyzing codebase structure
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
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 repository22 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- adrSkill
- api-designSkill
- architecture-designSkill
- architecture-reviewSkill
- best-practicesSkill
- changelog-generatorSkill
- code-reviewSkill
- database-designSkill
- dependency-auditSkill
- doc-refreshSkill
- example-skillSkill
- full-security-reviewSkill
- git-workflowSkill
- golden-rulesSkill
- incident-reportSkill
- log-correlationSkill
- mvp-readinessSkill
- onboardingSkill
- pre-commitSkill
- requirements-generatorSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
25 rules. 0 are common, 11 are distinctive, and 14 are very specific to this project.
0
Common
Most of the 27 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
When invoked via /test-writer:
- Distinctive: line 16
Identify the target: Ask the user: which file or function should tests be written for?
- Distinctive: line 21
All exported/public functions, classes, and methods
- Very specific: line 26
Jest: look for jest.config.*, or "jest" key in package.json
- Very specific: line 27
Vitest: look for vitest.config.*, or "vitest" in package.json devDependencies
- Very specific: line 28
pytest: look for pytest.ini, pyproject.toml containing [tool.pytest.ini_options], or conftest.py
- Very specific: line 29
Go test: look for go.mod and any existing *_test.go files
- Very specific: line 30
PHPUnit: look for phpunit.xml or phpunit.xml.dist, or phpunit/phpunit in composer.json
- Very specific: line 31
Mocha: look for .mocharc.*, or "mocha" in package.json devDependencies
- Very specific: line 32
RSpec: look for .rspec, spec/spec_helper.rb, or rspec in Gemfile
- Very specific: line 33
JUnit: look for junit in pom.xml or build.gradle/build.gradle.kts
- Very specific: line 34
xUnit / NUnit / MSTest: look for xunit, NUnit, or MSTest package references in *.csproj
- Distinctive: line 35
If multiple are present, ask the user which to use.
- Very specific: line 37
Match existing test style: Use Glob to find existing test files matching /*.test.*, /*.spec.*, /*_test.*, or tests//*.
- Distinctive: line 41
Import paths and module resolution patterns
- Very specific: line 44
If existing tests are co-located (e.g.
- Very specific: line 45
If existing tests live in a tests/ or __tests__/ directory, mirror the source path there.
- Distinctive: line 46
If no existing tests exist, default to co-located.
- Distinctive: line 55
Follow the detected framework's idioms exactly.
- Distinctive: line 58
If the test file does not exist, use Write to create it.
- Distinctive: line 59
If the test file already exists, use Read to review it, then use Edit to append new test cases — never overwrite existing tests.
- Distinctive: line 70
If tests fail, diagnose the root cause (missing mock, wrong import path, API mismatch) and fix before finishing.
- Distinctive: line 74
After writing and running tests, summarize:
- Distinctive: line 101
If the target file has no exports or public surface (e.g.
- Very specific: line 102
Prefer deterministic tests.
“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
Generate comprehensive unit and integration tests for a given file or function, auto-detecting the project test framework and matching the existing test style.
Instructions
When invoked via /test-writer:
- Identify the target. Ask the user: which file or function should tests be written for? Accept:
- An absolute or relative file path (e.g.
src/utils/parser.ts) - A function or method name (ask which file it lives in if ambiguous)
- An absolute or relative file path (e.g.
- Read the target file using Read. Understand:
- All exported/public functions, classes, and methods
- Their parameter types, return types, and documented or inferred behavior
- Dependencies (imports/requires) that will need to be mocked
- Detect the test framework using Glob and Read:
- Jest: look for
jest.config.*, or"jest"key inpackage.json - Vitest: look for
vitest.config.*, or"vitest"inpackage.jsondevDependencies - pytest: look for
pytest.ini,pyproject.tomlcontaining[tool.pytest.ini_options], orconftest.py - Go test: look for
go.modand any existing*_test.gofiles - PHPUnit: look for
phpunit.xmlorphpunit.xml.dist, orphpunit/phpunitincomposer.json - Mocha: look for
.mocharc.*, or"mocha"inpackage.jsondevDependencies - RSpec: look for
.rspec,spec/spec_helper.rb, orrspecinGemfile - JUnit: look for
junitinpom.xmlorbuild.gradle/build.gradle.kts - xUnit / NUnit / MSTest: look for
xunit,NUnit, orMSTestpackage references in*.csproj - If multiple are present, ask the user which to use.
- Jest: look for
- Match existing test style. Use Glob to find existing test files matching
**/*.test.*,**/*.spec.*,**/*_test.*, ortests/**/*. Read 1–2 representative test files to capture:- Describe/context block structure
- Assertion library and style (
expect,assert,should) - How mocks, stubs, and fixtures are set up
- Import paths and module resolution patterns
- Determine the test file location and name:
- If existing tests are co-located (e.g.
src/foo.ts→src/foo.test.ts), follow that pattern. - If existing tests live in a
tests/or__tests__/directory, mirror the source path there. - If no existing tests exist, default to co-located.
- If existing tests are co-located (e.g.
Generate tests covering:
- Happy path: normal, valid inputs produce the expected output
- Edge cases: empty string/array, zero,
null/undefined/None, maximum values, boundary conditions (e.g. off-by-one) - Invalid input: wrong type, missing required fields, malformed data — verify errors are thrown or returned correctly
- Error conditions: simulate dependency failures using mocks/stubs; verify the function handles them gracefully
- All public functions/methods in the target file — do not skip any exported surface
Follow the detected framework's idioms exactly. Use the same describe block nesting, assertion style, and mock setup patterns found in existing tests.
- Write the test file:
- If the test file does not exist, use Write to create it.
- If the test file already exists, use Read to review it, then use Edit to append new test cases — never overwrite existing tests.
- Run the tests using Bash. For JS/TS frameworks, prefer the project's own test script or local binary — do not use
npx, which can download and execute a package from the network if it isn't installed locally:- Jest/Vitest/Mocha:
npm test -- <testfile>ifpackage.jsondefines a test script; otherwisenode_modules/.bin/jest <testfile>(orvitest run/mocha). If neither exists, ask the user before falling back tonpx. - pytest:
python -m pytest <testfile> -v - Go:
go test ./... -run <TestName> - PHPUnit:
vendor/bin/phpunit <testfile> - RSpec:
bundle exec rspec <testfile> - JUnit:
mvn test -Dtest=<TestClass>orgradle test --tests <TestClass> - xUnit/NUnit/MSTest:
dotnet test --filter <TestClass> - Report pass/fail counts and any error output.
- If tests fail, diagnose the root cause (missing mock, wrong import path, API mismatch) and fix before finishing. Do not leave the user with a broken test file.
- Jest/Vitest/Mocha:
Output Format
After writing and running tests, summarize:
## Test Writer — <target file> — <date>
### Framework Detected
<framework name and version if available>
### Test File Written
`<path/to/test-file>`
### Coverage
| Function / Method | Tests Written |
|-------------------|---------------|
| functionName | 4 (happy, edge, invalid, error) |
| anotherFunction | 3 (happy, edge, error) |
### Run Results
Tests: X passed, Y failed, Z total
### Notes
<Any caveats — e.g. "mock for ExternalService is approximate; update if the interface changes">Notes
- This skill writes tests only — it does not modify production code.
- If the target file has no exports or public surface (e.g. it is a CLI entry point), generate integration-style tests that exercise the module end-to-end via its public interface or subprocess.
- Prefer deterministic tests. Avoid
Date.now(),Math.random(), or other non-deterministic values in assertions without mocking them first.
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.

