test-generation
Skill3 starsChanged 4 months agoMITView on GitHub
Use when generating test files for existing code or from a spec — language-agnostic, works with any test framework. Triggers on "generate tests", "write tests for", "生成测试", "生成测试代码", "补测试".
6 other projects use a version of this.
Adopted by
Most recently taken up by
- Anasabdellatif/forgeostheir own version, first seen Sep 1, 2026
- Happy-Technologies-LLC/happy-platform-skillstheir own version, first seen Jul 28, 2026
- Noorkhalel/saas-ai-skillstheir own version, first seen Jul 12, 2026
- shinzoxD/knackboxtheir own version, first seen Jul 10, 2026
- jnotsknab/mux-swarmtheir own version, first seen Jun 29, 2026
- sarveshtalele/mcp-skills-registrytheir own version, first seen Jun 12, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- Happy-Technologies-LLC/happy-platform-skills★ 40same name
- jnotsknab/mux-swarm★ 9same name
- Anasabdellatif/forgeos★ 2same name
- Noorkhalel/saas-ai-skills★ 2same name
- sarveshtalele/mcp-skills-registry★ 2same name
- shinzoxD/knackbox★ 0same name
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 repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- brainstormSkill
- oss-strategySkill
- specSkill
- researchSkill
- api-designSkill
- architectureSkill
- codebase-designSkill
- design-researchSkill
- domain-modelingSkill
- frontend-designSkill
- imagegenSkill
- image-to-codeSkill
- prompt-engineeringSkill
- prototypeSkill
- schema-designSkill
- auth-implementationSkill
- breakdownSkill
- context-engineeringSkill
- error-handlingSkill
- i18nSkill
- implementSkill
- multi-agent-orchestrationSkill
- cost-optimizationSkill
- performanceSkill
- refactoringSkill
- simplifySkill
- api-testingSkill
- e2e-testingSkill
- load-testingSkill
- tddSkill
- a11y-reviewSkill
- code-reviewSkill
- debuggingSkill
- lintingSkill
- security-reviewSkill
- ci-cdSkill
- deprecation-migrationSkill
- git-workflowSkill
- oss-polishSkill
- shippingSkill
- documentation-auditSkill
- handoffSkill
- incident-responseSkill
- observabilitySkill
- purity-auditSkill
- skill-authoringSkill
- using-skillsSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 10 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
10
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
- Very specific: line 34
Ask for or discover: PRD path (default docs/PRD.md or docs/vX.Y/prd.md), architecture docs (default docs/TECH.md or docs/vX.Y/tech.md), …
- Distinctive: line 60
Write anti-pattern-free test code to the correct test directories.
- Distinctive: line 72
Every generated test file covers these dimensions:
- Distinctive: line 89
When mock setup would exceed 50% of the test body (use an integration test)
- Distinctive: line 90
When unsure of the dependency chain (run with real implementation first)
- Distinctive: line 92
Completeness rule: when mocking an API response or data structure, include ALL fields the real implementation returns — not just the fields …
- Distinctive: line 93
ALL fields the real implementation returns — not just the fields the immediate test touches.
- Distinctive: line 98
Always generate integration tests alongside unit tests for features that span multiple components.
- Distinctive: line 101
Use fewer (or zero) mocks — wire real components together
- Distinctive: line 102
Verify the system behaves correctly end-to-end
- Distinctive: line 103
Use language-idiomatic file naming
“Common” is measured: kept by at least 6 in 10 of the 6 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 Generation (Language-Agnostic)
Generate anti-pattern-free test code from PRD acceptance criteria and source code. Read inputs, produce test files. No execution, no reports, no source modifications.
Input: PRD acceptance criteria + architecture docs + source code
When to use
- Generating tests for a feature or bugfix
- Creating tests from a PRD, API contract, or existing source
- Triggers on "generate tests", "write tests for", "生成测试", "生成测试代码", "补测试"
Not for: the TDD red-green-refactor loop (use tdd); API contract testing (use api-testing); browser E2E flows (use e2e-testing).
Steps
1. Detect language & framework
Scan the project before generating. Detection priority: existing test files (naming conventions) → dependency manifests → test config files. If nothing found, ask which framework to use.
- Load references/language-patterns.md for the per-language detection table (manifests and test-file patterns to scan for) and the Test Framework | Assertion Style | Mock Library mapping (testify/gomock, pytest/unittest.mock, jest/jest.fn, etc.)
2. Read inputs
Ask for or discover: PRD path (default docs/PRD.md or docs/vX.Y/prd.md), architecture docs
(default docs/TECH.md or docs/vX.Y/tech.md), source code to test (default src/), and the
auto-detected language/framework. Ask only critical questions before proceeding.
3. Extract testable conditions
- Per acceptance criterion → one or more test cases
- Per API endpoint / function signature → contract tests
- Per defined error state → error path test
- Per security-sensitive input → injection test (SQL, command, path traversal, XSS)
PRD: "US-001: User login"
AC: "Valid credentials return an authenticated session"
AC: "Invalid credentials return an error"
AC: "Empty fields show validation errors"
→ Test cases:
1. valid credentials → success + session established
2. wrong password → error response + message present
3. empty email → validation error for email field
4. empty password → validation error for password field4. Generate test files
Write anti-pattern-free test code to the correct test directories. Every file starts with a comment linking to requirements:
// Generated from: docs/PRD.md, US-001: User login
// Acceptance criteria: valid login, invalid credentials, empty fieldsAdapt the comment syntax to the language (#, //, /* */, --).
Coverage rules
Every generated test file covers these dimensions:
| Category | What to test | Anti-pattern to avoid |
| Happy path | Expected input → expected output | Don't mock the function under test |
| Validation | Invalid/missing fields → proper errors | Assert real error, not mock call |
| Edge cases | Boundary values, empty, null, very large | Don't mock out validation logic |
| Error states | Timeout, unavailable, 5xx | Mock at network/IO level, not error handler |
| Security | Injection patterns, auth bypass | Test real sanitization, not mock sanitizer |
Mocking rules
Mock only at external boundaries: network, filesystem, clock, third-party APIs. Never mock:
- The function/class under test itself
- Internal helpers that are fast and side-effect-free
- When mock setup would exceed 50% of the test body (use an integration test)
- When unsure of the dependency chain (run with real implementation first)
Completeness rule: when mocking an API response or data structure, include ALL fields the real implementation returns — not just the fields the immediate test touches. Partial mocks hide structural assumptions and fail silently.
Integration tests are not optional
Always generate integration tests alongside unit tests for features that span multiple components. Integration tests:
- Use fewer (or zero) mocks — wire real components together
- Verify the system behaves correctly end-to-end
- Use language-idiomatic file naming
Source: src/auth/login.go
→ Unit: src/auth/login_test.go
→ Integration: tests/integration/auth_login_test.goGenerator decision matrix
| Input has | Generate |
| User story + AC | Unit tests per AC + integration test for the story |
| API contract + schema | Contract / integration tests per endpoint |
| Source code without AC | Unit tests for public API surface |
| Error states in contract | Error path tests covering every defined error |
| Security-sensitive inputs | Injection tests (SQL, command, path traversal, XSS) |
| Database operations | Transaction/rollback tests |
| Auth-protected endpoints | Unauthenticated + forbidden tests |
Output: Complete test files (unit + integration) — code, not a report.
Verify
- Language and framework auto-detected (not defaulted blindly)
- Every acceptance criterion has a matching test case
- Happy path, validation, edge cases, and error states covered per feature
- Both unit AND integration tests generated for multi-component features
- Mocks mirror the complete real data structure — no partial mocks
- Every test file has a source comment linking to requirements
- No test-only methods added to production classes
- No assertions solely on mock behavior or call counts
References
- ${CLAUDE_PLUGIN_ROOT}/references/engineering-principles.md — discipline every skill shares
- ${CLAUDE_PLUGIN_ROOT}/references/clean-code.md — clean code principles for test quality
- references/language-patterns.md — per-language Test Framework | Assertion Style | Mock Library mapping
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.

