write-tests
Skill7 starsChanged 7 months agoMITView on GitHub
Generates comprehensive unit and integration tests for a specified file or function. Auto-detects the test framework, follows existing patterns, and covers happy path, edge cases, error conditions, and async behavior. Use when adding tests to untested code or TDD-ing a new module.
33 other projects use a version of this.
Adopted by
Most recently taken up by
- dzhng/skillstheir own version, first seen Oct 4, 2026
- dzhng/jevgreptheir own version, first seen Oct 2, 2026
- dzhng/duet-agenttheir own version, first seen Oct 2, 2026
- aprameyak/coding-skillstheir own version, first seen Oct 2, 2026
- getsentry/sentry-javascripttheir own version, first seen Sep 27, 2026
- NarekManukyan/flutter-mobx-kittheir own version, first seen Sep 17, 2026
Used with
Projects with it also use audit-choices, close-spec and 10 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.
dzhngSkillaudit-choices
Audit the choices an implementing agent made, not its diff — a pure decision audit that traces the session's history into a choices ledger, changes no code, and never blocks an unsupervised run. Working code still embeds architecture the user never chose; surface it because future work inherits it. Use when the user wants to review the decisions the AI made on their behalf, before merging or committing AI-implemented work, when integrating a delegated subagent's pass, or when a fix "works" but might be a point fix.
Also in 3 projects that use this
dzhngSkillclose-spec
When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).
Also in 3 projects that use this
LucasMatuszewskiSkillaudit-agents
Audit and maintain agent configuration files (.claude/agents, AGENTS.md, CLAUDE.md, agent-memory). Checks for duplicates, outdated info, naming conflicts, wrong technical facts, and files over 200 lines. Fixes all issues and commits.
Also in 3 projects that use this
Halcyon666Skillwrite-skills
Creates high-quality Agent Skills (SKILL.md files) that follow the open Agent Skills specification. Use when asked to create a skill, write a SKILL.md, package agent instructions, build a reusable capability, or turn a workflow into a shareable skill. Produces spec-compliant, concise, well-structured skills optimized for agent discovery and execution.
Also in 3 projects that use this
isLinXuSkilleval-skills
AI Agent Skill unit testing framework. A framework-agnostic toolkit for discovering, scaffolding, selecting, evaluating, and reporting on AI skills. Use this skill to assess skill quality before production, compare candidate skills on the same benchmark, enforce quality gates in CI/CD, and generate human-readable evaluation reports.
Also in 3 projects that use this
TrecekSkillaudit-tests
Audit the test suite for useless tests, consolidation opportunities, over-mocking, weak assertions, and other test quality issues. Use when user says "audit tests", "audit test suite", "review tests", or "test quality check". Generates an improvement plan in temp/ with explanations for each proposed change.
Also in 3 projects that use this
- +6 more from dzhng
Other versions33 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 33
- getsentry/sentry-javascript★ 8.8ksame name
- huggingface/OpenEnv★ 2.6ksame name
- dzhng/jevgrep★ 2.3ksame name
- NeoLabHQ/context-engineering-kit★ 1.7ksame name
- dzhng/skills★ 978same name
- microsoft/semantic-link-labs★ 584same name
- atherio-danp/cde-dotnetcc★ 109same name
- getsentry/abacus★ 77same name
- alamops/skills★ 52same name
- dzhng/duet-agent★ 46same name
23 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 repository45 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- a11y-auditSkill
- api-designSkill
- architecture-reviewSkill
- business-blueprintSkill
- business-logic-auditSkill
- changelogSkill
- ci-pipelineSkill
- code-coverageSkill
- competitive-analysisSkill
- convert-codeSkill
- create-componentSkill
- db-migrationSkill
- debugSkill
- dependency-auditSkill
- deploy-checklistSkill
- design-flowSkill
- docker-setupSkill
- env-setupSkill
- error-monitorSkill
- estimateSkill
- explain-codeSkill
- fix-issueSkill
- generate-docsSkill
- git-cleanupSkill
- grill-meSkill
- handoffSkill
- legal-pagesSkill
- memory-importSkill
- memorySkill
- microcopySkill
- migrate-frameworkSkill
- onboardSkill
- optimizeSkill
- pr-summarySkill
- refactorSkill
- reference-appSkill
- review-prSkill
- security-scanSkill
- seo-scaffoldSkill
- tddSkill
- web-launch-checkSkill
- wireframeSkill
- write-skillSkill
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 31 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 26
Read the file or function to be tested
- Distinctive: line 50
Write tests covering ALL of the following categories:
- Distinctive: line 77
Verify mock calls (called with correct args, correct number of times)
- Distinctive: line 79
Do NOT mock the unit under test
- Distinctive: line 83
Test names are full English sentences describing the scenario
- Very specific: line 84
Use beforeEach/setUp for shared setup.
- Distinctive: line 95
Place the file following the project's test directory convention.
“Common” is measured: kept by at least 6 in 10 of the 31 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
Write Tests
Detect Project Test Environment
Package/Project Files
!ls package.json pytest.ini pyproject.toml setup.cfg tox.ini go.mod Cargo.toml *.csproj *.sln Gemfile build.gradle pom.xml mix.exs deno.json 2>/dev/null
Existing Tests
!find . -type f \( -name "*.test.*" -o -name "*.spec.*" -o -name "test_*" -o -name "*_test.*" -o -name "*_spec.*" -o -name "*Test.*" -o -name "*Spec.*" \) -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/vendor/*" 2>/dev/null | head -20
Test Config
!cat jest.config.* vitest.config.* pytest.ini pyproject.toml setup.cfg .rspec 2>/dev/null | head -50
Instructions
Step 1: Analyze the Target
- Read the file or function to be tested
- Identify all public APIs, functions, methods, and classes
- Map out the code paths: conditionals, loops, error throws, early returns
- Identify external dependencies that need mocking
Step 2: Determine Test Framework
Based on the detected project files:
- JavaScript/TypeScript: Jest, Vitest, Mocha, or Playwright (check package.json)
- Python: pytest, unittest (check pyproject.toml, pytest.ini)
- Go: standard
testingpackage - Rust: built-in
#[cfg(test)]module - C#/.NET: xUnit, NUnit, or MSTest
- Ruby: RSpec or Minitest
- Java: JUnit 5 or TestNG
- Elixir: ExUnit
Step 3: Follow Existing Patterns
- Find the nearest existing test file for a similar module
- Match the structure: describe/it, test classes, test functions
- Match the mocking approach: jest.mock, unittest.mock, testify, etc.
- Match the assertion style: expect, assert, should
- Match the file naming convention and directory placement
Step 4: Generate Tests
Write tests covering ALL of the following categories:
Happy Path
- Normal inputs produce expected outputs
- Standard use cases work correctly
- Return values and side effects are verified
Edge Cases
- Empty inputs (null, undefined, empty string, empty array, zero)
- Boundary values (min, max, off-by-one)
- Unicode and special characters where relevant
- Large inputs (performance boundary)
Error Conditions
- Invalid inputs produce appropriate errors
- Thrown exceptions match expected types and messages
- Error callbacks/handlers are invoked correctly
- Graceful degradation for partial failures
Async Behavior (if applicable)
- Promises resolve/reject correctly
- Async/await error handling
- Concurrent operations
- Timeout and cancellation
Mocking
- Mock external dependencies at module boundaries
- Verify mock calls (called with correct args, correct number of times)
- Reset mocks between tests
- Do NOT mock the unit under test
Step 5: Test Quality Rules
- One assertion concept per test (multiple asserts OK if testing one thing)
- Test names are full English sentences describing the scenario
- Use
beforeEach/setUpfor shared setup;afterEach/tearDownfor cleanup - Tests must be deterministic — no random data, no time-dependent assertions
- Tests must be independent — no shared mutable state between tests
Step 6: Output
Generate a complete, ready-to-save test file with:
- A header comment explaining what is tested
- All necessary imports
- Properly structured test suites
- The target coverage goal (aim for >80%)
Place the file following the project's test directory convention.
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.

