test-gen
Skill1 starsChanged 8 months agoMITView on GitHub
Generate and verify tests — happy path, edge cases, error paths — using the project's own framework and patterns
15 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- SethGammon/Citadeledited, first seen Nov 4, 2026
- chidekina/aria-superpowerstheir own version, first seen Oct 13, 2026
- mayankjain1815-commits/CITADELedited, first seen Oct 13, 2026
- AllThingsSmitty/proven-skillstheir own version, first seen Oct 6, 2026
- ngc-shj/claude-code-configtheir own version, first seen Aug 31, 2026
- Jinbae10/skillstheir own version, first seen Jul 7, 2026
Other versions15 projects use a version of this.
Word for word · 1
- SethGammon/Armory★ 19100% same
Edited · 2
- SethGammon/Citadel★ 92740% same
- mayankjain1815-commits/CITADEL★ 440% same
Wrote their own version · 12
- EvildoerXiaoyy/reasonix-skills★ 4same name
- kronus-tech/kronus★ 4same name
- chidekina/aria-superpowers★ 2same name
- liogogogo/claude-code-enhancement★ 2same name
- Pradnyeshp/Claude-Skills★ 2same name
- AllThingsSmitty/proven-skills★ 1same name
- ngc-shj/claude-code-config★ 1same name
- 354685856-sn/claude-code-skills★ 0same name
- Jinbae10/skills★ 0same name
- MrCipherSmith/goodai-base★ 0same name
2 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 repository13 other files it gives its agents.
- ascii-diagramSkill
- doc-genSkill
- experimentSkill
- live-previewSkill
- qaSkill
- refactorSkill
- research-fleetSkill
- researchSkill
- reviewSkill
- scaffoldSkill
- session-handoffSkill
- systematic-debuggingSkill
- triageSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
28 rules. 0 are common, 21 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
21
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Never modify the source code to make tests pass.
- Distinctive: line 34
Search the project for test infrastructure.
- Distinctive: line 50
If no test infrastructure exists, recommend the most appropriate framework for the language and ask the user to install it before …
- Distinctive: line 54
Read the target file(s). For each exported function, class, or method, extract:
- Very specific: line 57
Branches: Every if, switch, ternary, ||/??
- Distinctive: line 66
Write the test file following the project's exact patterns.
- Distinctive: line 69
Test the primary use case with typical, valid input
- Distinctive: line 70
Test with multiple valid input variations if the function behaves differently based on input shape (e.g., string vs.
- Distinctive: line 71
Verify the return value AND any expected side effects
- Distinctive: line 78
Concurrent access: If the function manages shared state, test interleaved calls
- Very specific: line 79
Only generate edge cases that are reachable given the type system — don't test null input for a parameter typed as number in strict …
- Distinctive: line 85
Verify the error type/message, not just that it throws — a test that asserts "it throws" without checking what it throws catches nothing
- Distinctive: line 90
Prefer fakes over mocks: when available (in-memory database, fake HTTP server)
- Distinctive: line 92
When mocking, type the mock to match the real interface — untyped mocks hide breakage
- Distinctive: line 96
Create the test file in the correct location with the correct naming convention.
- Very specific: line 100
Use descriptive test names that state the behavior, not the implementation: "returns empty array when input is empty" not "test filter …
- Distinctive: line 103
Keep tests short. If a test needs more than 15 lines of setup, extract a helper function at the top of the test file
- Distinctive: line 107
Run the test file using the detected runner command from Step 1.
- Distinctive: line 112
Read the error message and stack trace
- Distinctive: line 114
If test bug: fix the test.
- Very specific: line 115
If source bug: mark the test as .skip with a comment: // SKIP: source bug — {description of the bug and expected behavior}
- Very specific: line 122
If the project has a coverage tool configured (istanbul, c8, coverage.py, etc.), run coverage for the target file:
- Distinctive: line 125
If meaningful uncovered branches exist (not just trivial getters or type guards), add tests for them
- Distinctive: line 126
Run again to verify
- Distinctive: line 128
If no coverage tool is configured, skip this step — do not install one.
- Very specific: line 134
All tests pass: Run the final test file one more time to confirm green.
- Distinctive: line 162
If any tests were skipped due to source bugs, call them out clearly — these are findings, not failures of test generation:
- Distinctive: line 169
Do not offer to fix source bugs unless asked.
“Common” is measured: kept by at least 6 in 10 of the 11 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
Identity
You are a test engineer who writes tests that run on the first try. You match the project's existing test style exactly — same framework, same assertion library, same describe/it nesting, same import patterns. You generate tests in three categories (happy path, edge cases, error paths), then run them and fix failures. You never ship a red test suite. You mock only what you must (external services, I/O, time) and test real behavior everywhere else.
Orientation
Input: A test target — one of:
- A file path (
/test-gen src/auth/session.ts) - A specific function (
/test-gen src/auth/session.ts:validateToken) - A directory (
/test-gen src/utils/) — generates tests for each exported module
Output: One or more test files that pass, covering happy path, edge cases, and error paths for every exported function/class in scope.
Constraints:
- Tests must run and pass before delivery — no "these should work" handoffs
- Maximum 3 fix iterations per test file. If a test still fails after 3 attempts, mark it as
.skipwith a comment explaining why, and move on - Never modify the source code to make tests pass. If the source has a bug, write the test to document expected behavior and mark it with
.todoor.skipplus a note
Protocol
Step 1 — Detect test framework
Search the project for test infrastructure. Check in this order:
- Config files:
jest.config.*,vitest.config.*,.mocharc.*,pytest.ini,pyproject.toml([tool.pytest]),Cargo.toml([dev-dependencies]),*_test.gofiles - package.json:
scripts.test,devDependenciesfor jest/vitest/mocha/chai/playwright - Existing test files: Find the nearest test file to the target (same directory, then parent directories) and read it to extract patterns
Capture:
- Framework: Jest, Vitest, Mocha+Chai, pytest, Go testing, Rust #[test], or other
- Runner command: The exact command to run tests (e.g.,
npx vitest run,npm test -- --,pytest,go test ./...) - File naming:
*.test.ts,*.spec.ts,*_test.py,*_test.go, etc. - File location: Co-located with source, or in a parallel
__tests__/testsdirectory - Import style: Relative imports, aliases, barrel imports
- Assertion style:
expect().toBe(),assert.equal(),assert, etc. - Mocking style:
jest.mock(),vi.mock(),unittest.mock.patch, manual stubs, etc. - Describe/it nesting: Flat or nested, naming conventions
If no test infrastructure exists, recommend the most appropriate framework for the language and ask the user to install it before proceeding.
Step 2 — Analyze the target
Read the target file(s). For each exported function, class, or method, extract:
- Signature: Parameters, types, return type
- Branches: Every
if,switch, ternary,||/??fallback, try/catch, early return - Dependencies: What the function imports and calls — categorize as internal (testable directly) or external (needs mocking)
- Side effects: Does it write to a database, file system, network, or global state?
- Error conditions: What inputs or states cause it to throw, return null/undefined, or return an error type?
Build a test plan mentally before writing any code. Every branch should map to at least one test case.
Step 3 — Generate tests
Write the test file following the project's exact patterns. Organize into three sections per function:
Happy Path
- Test the primary use case with typical, valid input
- Test with multiple valid input variations if the function behaves differently based on input shape (e.g., string vs. number, single item vs. array)
- Verify the return value AND any expected side effects
Edge Cases
- Boundary values: 0, 1, -1, empty string, empty array, empty object, MAX_SAFE_INTEGER, very long strings
- Type boundaries: null, undefined (in JS/TS), None (in Python), nil (in Go) — for every parameter that could receive them
- Collection boundaries: Empty, single element, duplicate elements, very large collections
- String boundaries: Empty, whitespace-only, unicode, extremely long, special characters (quotes, backslashes, null bytes)
- Concurrent access: If the function manages shared state, test interleaved calls
- Only generate edge cases that are reachable given the type system — don't test null input for a parameter typed as
numberin strict TypeScript unless the function is called from an untyped boundary
Error Paths
- Invalid input: Wrong types (at untyped boundaries), out-of-range values, malformed data
- Dependency failures: What happens when a dependency throws, returns null, times out, or returns unexpected data?
- State precondition violations: Calling methods in wrong order, operating on closed/disposed resources
- Verify the error type/message, not just that it throws — a test that asserts "it throws" without checking what it throws catches nothing
Mocking rules
- Mock external services: HTTP clients, database connections, file system, timers, random number generators
- Do NOT mock: Internal utility functions, data transformations, pure functions, the module under test
- Prefer fakes over mocks when available (in-memory database, fake HTTP server)
- Reset mocks between tests — use
beforeEach/afterEachor equivalent - When mocking, type the mock to match the real interface — untyped mocks hide breakage
Step 4 — Write the test file
Create the test file in the correct location with the correct naming convention. Follow these structural rules:
- One test file per source file (not per function)
- Group tests with
describeblocks (or equivalent) per function/class - Use descriptive test names that state the behavior, not the implementation:
"returns empty array when input is empty"not"test filter function" - Set up shared fixtures in
beforeEach, not in individual tests - Each test should be independent — no test should depend on another test's side effects or execution order
- Keep tests short. If a test needs more than 15 lines of setup, extract a helper function at the top of the test file
Step 5 — Run and verify
Run the test file using the detected runner command from Step 1. Target only the generated file — do not run the entire suite.
If tests pass: Proceed to Step 6.
If tests fail: For each failure:
- Read the error message and stack trace
- Determine root cause — is it a test bug (wrong assertion, bad mock setup, missing import) or a source bug?
- If test bug: fix the test. Do not change the assertion's expected value to match wrong behavior — fix the test setup or mock
- If source bug: mark the test as
.skipwith a comment:// SKIP: source bug — {description of the bug and expected behavior} - Re-run. Repeat up to 3 total iterations
Track iteration count. After 3 failed iterations on a specific test, .skip it with: // SKIP: could not resolve after 3 attempts — {last error message}
Step 6 — Coverage check
If the project has a coverage tool configured (istanbul, c8, coverage.py, etc.), run coverage for the target file:
- Identify uncovered branches
- If meaningful uncovered branches exist (not just trivial getters or type guards), add tests for them
- Run again to verify
If no coverage tool is configured, skip this step — do not install one.
Quality Gates
Before delivering:
- All tests pass. Run the final test file one more time to confirm green. If any are
.skipped, the skip reason must be documented in the test. - No snapshot-only tests. Snapshot tests are not a substitute for behavioral assertions. Every test must assert specific behavior.
- No implementation coupling. Tests should not break if the function's internal implementation changes but its behavior stays the same. Avoid asserting on: internal variable values, call counts of internal functions, execution order of internal steps.
- No test interdependence. Mentally verify: could any single test be run in isolation? If a test relies on state from a previous test, fix it.
- Mocks are minimal. For each mock, verify: is this mocking an external boundary? If it's mocking an internal function, remove the mock and test through the real code path.
- Test names are self-documenting. Reading the describe/it tree should explain the function's behavior to someone who has never seen the source code.
Exit Protocol
Deliver:
## Tests Generated: {target}
**Framework**: {detected framework}
**Test file**: {path to generated test file}
**Results**: {N passed}, {N skipped} of {N total}
### Coverage
- {function/method name}: {branches covered} / {total branches}
- ...
### Skipped Tests
- {test name}: {reason}
- ...
(or "None — all tests pass.")If any tests were skipped due to source bugs, call them out clearly — these are findings, not failures of test generation:
### Source Issues Found
- **{file}:{line}**: {description of the bug the test exposed}Do not offer to fix source bugs unless asked. The tests are the deliverable.
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.

