test-gen
Skill1 starsChanged 27 days agoMITView on GitHub
Generate high-quality tests for existing or new code. Always use this skill when asked to write tests, add test coverage, or generate any kind of test: unit, integration, or end-to-end. Use when the user says "write tests for this", "add coverage", "test this function/class/module/endpoint", "generate unit tests", or when a PR or feature is missing test coverage. Read this skill before writing a single test case.
We split this skill into the rules it gives an agent
15 rules. 0 are common, 15 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
15
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 22
If the contract is unclear, clarify it first.
- Distinctive: line 26
Unit tests: verify a single function or class in isolation
- Distinctive: line 32
Integration tests: verify that components work correctly together
- Distinctive: line 36
Use a real dependency (test DB, in-memory queue) where possible.
- Distinctive: line 38
End-to-end tests: verify a complete user-visible workflow
- Distinctive: line 43
When in doubt, prefer the lowest level that actually exercises the behavior you care about.
- Distinctive: line 55
Don't test the framework or language itself.
- Distinctive: line 59
Over-mocking: If a test mocks more than 2-3 things, ask whether it's testing behavior or just verifying that functions were called in the …
- Distinctive: line 69
Use Arrange-Act-Assert (or Given-When-Then for BDD-style):
- Distinctive: line 77
Keep each section short and obvious.
- Distinctive: line 79
Test names should describe the scenario and expected outcome:
- Distinctive: line 99
When testing code that talks to a database, API, or queue:
- Distinctive: line 101
Use a real (test/in-memory) instance, not a mock, whenever practical
- Distinctive: line 102
Test the boundary behavior: what happens when the external system returns an error, times out, or returns unexpected data?
- Distinctive: line 103
Don't test the ORM or HTTP client itself: test your code's behavior given what those return
“Common” is measured: kept by at least 6 in 10 of the 12 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 Gen
Good tests verify behavior, not implementation. They should break when something the user cares about breaks, and only then.
Before writing tests: understand the contract
The contract of a piece of code is what it promises to callers: given these inputs and preconditions, it will produce these outputs or effects. Tests should verify the contract, not the internal mechanics.
Ask before writing:
- What are the public entry points? (functions, methods, endpoints, events)
- What does each promise to callers?
- What are the preconditions (what must be true for the code to work correctly)?
- What are the postconditions (what must be true after it runs)?
- What invariants must always hold? (e.g., "the list is always sorted after this call")
If the contract is unclear, clarify it first. A test that verifies vague behavior is itself vague.
Choosing the right test level
Unit tests: verify a single function or class in isolation
- Fast, precise, easy to diagnose when they fail
- Best for: pure functions, business logic, data transformation, edge case enumeration
- Pitfall: over-mocking can make tests verify call sequences rather than behavior
Integration tests: verify that components work correctly together
- Slower, but catch interface mismatches unit tests miss
- Best for: database queries, external service calls, message passing between modules
- Use a real dependency (test DB, in-memory queue) where possible; mocked interfaces drift from reality
End-to-end tests: verify a complete user-visible workflow
- Expensive but highest confidence
- Reserve for critical paths; don't write these for everything
When in doubt, prefer the lowest level that actually exercises the behavior you care about.
What to test: a checklist
For each unit under test, cover:
Happy path: the primary success case with typical inputs Boundary conditions: values at the edges of the input domain (empty, zero, max, min, exactly-one) Error paths: invalid inputs, missing required data, unexpected types Contract invariants: properties that must hold across multiple calls or states Known-problematic cases: off-by-ones, nulls, Unicode edge cases, floating-point equality
Don't test the framework or language itself. Don't test private implementation details that could change without breaking the contract.
Avoiding the common pitfalls
Over-mocking: If a test mocks more than 2-3 things, ask whether it's testing behavior or just verifying that functions were called in the right order. The latter is fragile and usually useless.
Testing too much in one test: Each test should have one reason to fail. If a test is long and covers multiple scenarios, split it. A failing test should immediately tell you what broke.
Brittle assertions: Asserting the exact string in an error message, the exact order of unordered results, or internal state that isn't part of the contract leads to tests that break on unrelated changes. Assert the property that matters, not the exact form.
Happy-path-only coverage: Error paths and edge cases are where bugs live. They're also what keeps you from breaking someone's production workflow during a refactor.
Test structure
Use Arrange-Act-Assert (or Given-When-Then for BDD-style):
// Arrange: set up preconditions and inputs
// Act: invoke the code under test
// Assert: verify the outcomeKeep each section short and obvious. If "Arrange" takes 30 lines, consider a builder or factory helper. If "Assert" checks 10 things, consider whether this is really one test.
Test names should describe the scenario and expected outcome:
returns_empty_list_when_no_matching_recordsthrows_validation_error_when_email_is_missingpreserves_insertion_order_after_deduplication
Not: test1, testHappyPath, testEdgeCase.
Property-based thinking
For functions with a clear input-output relationship, think about invariants that should hold for all valid inputs, not just specific examples:
- "For any non-empty list, the result should contain at least one element"
- "Sorting twice should produce the same result as sorting once"
- "Encoding and then decoding should round-trip to the original value"
Even if you don't use a property-based testing library, framing tests this way reveals edge cases you wouldn't have thought to enumerate.
Integration tests: what to actually test
When testing code that talks to a database, API, or queue:
- Use a real (test/in-memory) instance, not a mock, whenever practical
- Test the boundary behavior: what happens when the external system returns an error, times out, or returns unexpected data?
- Don't test the ORM or HTTP client itself: test your code's behavior given what those return
When to write the test
For bug fixes: write the failing test first, then fix it. This proves you've identified the right condition and guards against regression.
For new features: write tests in parallel with the code, not after. Writing tests after leads to tests that only describe the implementation you happened to write.
For refactoring: tests must be green before you touch anything. If they're not, fixing them first is the job.
Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 15
- SethGammon/Citadel★ 927same name
- SethGammon/Armory★ 19same name
- EvildoerXiaoyy/reasonix-skills★ 4same name
- kronus-tech/kronus★ 4same name
- mayankjain1815-commits/CITADEL★ 4same name
- chidekina/aria-superpowers★ 2same name
- liogogogo/claude-code-enhancement★ 2same name
- Pradnyeshp/Claude-Skills★ 2same name
- allysgrandiose674/Armory★ 1same name
- ngc-shj/claude-code-config★ 1same name
5 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.
Used alongsideProjects with it also use ascii-diagram, research-fleet 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.
SethGammonSkillascii-diagram
Generate perfectly aligned ASCII diagrams — architecture, flow, sequence, box-and-arrow. Uses a programmatic character-grid approach so alignment is guaranteed by math, not token prediction. Includes post-render verification.
Also in 4 projects that use this
SethGammonSkillresearch-fleet
Parallel research using Fleet wave mechanics. Spawns multiple scout agents, each investigating a different angle of the same question. Findings are compressed between waves. Produces a unified research brief from multiple independent perspectives.
Also in 3 projects that use this
botlearn-aiSkilldoc-gen
Also in 5 projects that use this
vicoa-aiSkilllive-preview
Start a local app in the current user project, expose it through a tunnel, and return preview details in structured Markdown. Use when the user asks for a preview URL, public URL, shareable localhost, mobile/web preview, or tunnel setup.
Also in 4 projects that use this
MicrosoftSkillscaffold
Also in 5 projects that use this
wpankSkillsession-handoff
WHAT: Create comprehensive handoff documents that enable fresh AI agents to seamlessly continue work with zero ambiguity. Solves long-running agent context exhaustion problem.
Also in 4 projects that use this
- +1 more from SethGammon
In this repository25 other files it gives its agents.
- api-designSkill
- arch-reviewSkill
- db-reviewSkill
- debugSkill
- dotnet-asyncSkill
- dotnet-opsSkill
- dotnet-testingSkill
- dotnet-typesSkill
- go-concurrencySkill
- go-opsSkill
- go-testingSkill
- go-typesSkill
- incidentSkill
- node-asyncSkill
- node-opsSkill
- perfSkill
- pr-prepSkill
- py-asyncSkill
- py-opsSkill
- py-testingSkill
- py-typesSkill
- refactorSkill
- securitySkill
- ts-testingSkill
- ts-typesSkill
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.

