tests
Skill1 starsChanged 20 days agoApache-2.0View on GitHub
Use when the user asks to generate, create, or write unit tests for code. Analyzes the target code, produces a structured test case list for review, then generates test code. Supports Java (JUnit 5, Mockito, AssertJ).
13 other projects use a version of this.
Adopted by
Most recently taken up by
- TsukiNi22/skillstheir own version, first seen Nov 16, 2026
- TsukiNi22/ai-utilstheir own version, first seen Nov 16, 2026
- GastonGelhorn/jevmatetheir own version, first seen Oct 25, 2026
- Moosync/Moosynctheir own version, first seen Oct 8, 2026
- dotnet/androidtheir own version, first seen Oct 8, 2026
- SonarSource/SonarJStheir own version, first seen Oct 8, 2026
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 13
- vuetifyjs/vuetify★ 41ksame name
- typescript-eslint/typescript-eslint★ 16ksame name
- scalar/scalar★ 16ksame name
- dotnet/android★ 2.1ksame name
- SonarSource/SonarJS★ 1.3ksame name
- trezor/trezor-suite★ 1.1ksame name
- Moosync/Moosync★ 264same name
- cirne/agent-skills★ 3same name
- GastonGelhorn/jevmate★ 1same name
- nf/skills★ 1same name
3 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 repository21 other files it gives its agents.
- architecture/CLAUDE.mdCLAUDE.md
- boot/CLAUDE.mdCLAUDE.md
- build-logic/CLAUDE.mdCLAUDE.md
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- cli/CLAUDE.mdCLAUDE.md
- core/CLAUDE.mdCLAUDE.md
- mcp/CLAUDE.mdCLAUDE.md
- messaging/CLAUDE.mdCLAUDE.md
- plugin-api/CLAUDE.mdCLAUDE.md
- plugins/CLAUDE.mdCLAUDE.md
- plus/CLAUDE.mdCLAUDE.md
- ui/CLAUDE.mdCLAUDE.md
- web/CLAUDE.mdCLAUDE.md
- ide-index-mcpSkill
- pickupSkill
- playwrightSkill
- ticketSkill
- yuktaSkill
- yukta-supervisorSkill
- yukta-workflowsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 17 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
17
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Do not skip any step in the workflow below.
- Distinctive: line 19
Do not take shortcuts with test data — read the actual classes to use correct constructors and fields.
- Very specific: line 29
Read dependencies: Follow imports to read DTOs, entities, enums, custom exceptions, and other types referenced by the target (as specified …
- Very specific: line 30
Check for existing tests: Search for {ClassName}Test or {ClassName}Tests in the test directory (as specified in existing-test-awareness …
- Distinctive: line 31
If found, read fully — you will add missing tests to it, do not create a new file
- Distinctive: line 32
If not found, scan 2-3 neighboring test classes to learn project conventions
- Very specific: line 61
Test method name format: {testedMethod}_{givenState}_{expectedOutcome}
- Distinctive: line 70
After outputting test cases, use the AskUserQuestion tool to ask the user:
- Distinctive: line 79
If user selects "Yes", proceed to Step 4
- Distinctive: line 80
If user selects "No", STOP and wait for further instructions
- Distinctive: line 89
If an existing test class was found in Step 1, add new test methods to it (do not create a duplicate file)
- Distinctive: line 91
Create or update the test file using the Write tool
- Very specific: line 95
Run compilation and fix any issues (max 5 attempts — see compilation-verification.md)
- Very specific: line 96
Run the generated test class to verify all tests pass (see test-execution-verification.md)
- Distinctive: line 98
If a test cannot be fixed after 3 attempts, remove it and inform the user
- Distinctive: line 105
If the specified target does not exist, inform the user with the exact path you searched and ask for clarification.
- Distinctive: line 108
If the target code is in a language without specific rules (not Java), apply only the general rules and inform the user that …
- Distinctive: line 111
If compilation fails after 5 attempts:
- Distinctive: line 112
Stop and show the user the remaining errors
- Distinctive: line 114
Ask the user to resolve the build issue before continuing
- Distinctive: line 117
If tests fail because the production code behaves differently than expected:
- Distinctive: line 118
Do NOT modify production code
- Very specific: line 120
If the behavior seems like a bug, add a comment: // NOTE: current behavior may be a bug — {description}
“Common” is measured: kept by at least 6 in 10 of the 13 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
Generate Tests Skill
You will analyze code and generate high-quality unit tests for a given target.
Target to test: $ARGUMENTS
Quality Standards
- Take your time to analyze the code thoroughly before generating test cases.
- Quality is more important than speed — read all relevant source files and rules carefully.
- Do not skip any step in the workflow below. Every step exists for a reason.
- Do not take shortcuts with test data — read the actual classes to use correct constructors and fields.
Instructions
Step 1: Read Rules and Analyze Context
- Read the relevant rules from
./rules/tests/based on code type (see Rules Reference below) - Read the target source file/class/method
- Read dependencies: Follow imports to read DTOs, entities, enums, custom exceptions, and other types referenced by the target (as specified in
code-context-analysisrule) - Check for existing tests: Search for
{ClassName}Testor{ClassName}Testsin the test directory (as specified inexisting-test-awarenessrule)- If found, read fully — you will add missing tests to it, do not create a new file
- If not found, scan 2-3 neighboring test classes to learn project conventions
Step 2: Generate Test Cases
- Analyze ALL code branches, including:
- Success paths
- Error/exception paths
- Validation logic
- Private/protected methods called by the target
- Security annotations (if present)
- Apply the INCLUDE/EXCLUDE rules strictly
- Output the list of test cases in the format below — do NOT generate test code yet
Test Case Output Format
## Test Cases for {ClassName}.{methodName}
### 1. {testMethodName}
- **Given:** {preconditions/input state}
- **When:** {action being tested}
- **Then:** {expected outcome}
- **Code branch:** {which code path this covers}
### 2. {testMethodName}
...Naming Convention
Test method name format: {testedMethod}_{givenState}_{expectedOutcome}
Examples:
calculateTotal_validProducts_returnsSumcalculateTotal_emptyList_throwsIllegalArgumentExceptiongetUser_unauthorized_returns401
Step 3: Ask for User Review
After outputting test cases, use the AskUserQuestion tool to ask the user:
Question: "Test cases are ready. Proceed with generating test code?"
Header: "Next step"
Options:
- Label: "Yes, generate tests" / Description: "Proceed to generate test files from the test cases above"
- Label: "No, let me review first" / Description: "Stop here so I can review and adjust the test cases"- If user selects "Yes", proceed to Step 4
- If user selects "No", STOP and wait for further instructions
Step 4: Generate Test Code
- Determine code type and apply the matching rules:
- Controller → Apply
controller-test-rules.md(use@WebMvcTest, MockMvc patterns) - Service / Domain logic → Apply
domain-service-rules.md(use@ExtendWith(MockitoExtension.class), Mockito patterns) - Repository / Messaging / Other types → Apply
domain-service-rules.mdas baseline; inform the user that type-specific rules are not yet available - All Java code → Always apply
java-test-template.md,argument-matching.md,json-serialization.mdregardless of code type
- Controller → Apply
- If an existing test class was found in Step 1, add new test methods to it (do not create a duplicate file)
- Generate tests following all rules and the test cases from Step 2
- Create or update the test file using the Write tool
Step 5: Verify Compilation and Execution
- Run compilation and fix any issues (max 5 attempts — see
compilation-verification.md) - Run the generated test class to verify all tests pass (see
test-execution-verification.md) - Fix any failing tests — do NOT modify production code
- If a test cannot be fixed after 3 attempts, remove it and inform the user
Troubleshooting
Target file not found
If the specified target does not exist, inform the user with the exact path you searched and ask for clarification.
Unsupported language
If the target code is in a language without specific rules (not Java), apply only the general rules and inform the user that language-specific conventions may need manual review.
Compilation keeps failing
If compilation fails after 5 attempts:
- Stop and show the user the remaining errors
- Suggest possible causes (missing dependencies, incompatible versions)
- Ask the user to resolve the build issue before continuing
Tests fail due to production code behavior
If tests fail because the production code behaves differently than expected:
- Do NOT modify production code
- Fix the test to match actual behavior
- If the behavior seems like a bug, add a comment:
// NOTE: current behavior may be a bug — {description}
Example
User says: "/generate-tests src/main/java/com/example/service/OrderService.java"
Step 1: Agent reads rules, reads OrderService.java, reads OrderRequest.java,
Order.java, OrderRepository.java (dependencies), checks for
existing OrderServiceTest.java
Step 2: Agent outputs 7 test cases covering:
- createOrder success path
- createOrder with invalid request (validation)
- processPayment success
- processPayment failure
- calculateTotal with products
- calculateTotal with empty list
- cancelOrder for non-existent order
Step 3: Agent asks user to review. User says "Yes, generate tests".
Step 4: Agent generates OrderServiceTest.java with @ExtendWith(MockitoExtension.class),
mocked repository and payment service, 7 test methods.
Step 5: Agent runs `mvn test -Dtest=OrderServiceTest -q`, all tests pass.
Result: Complete test file delivered with 7 passing tests.Rules Reference
CRITICAL: You MUST read and apply all relevant rules from the ./rules/tests/ directory.
Maintenance note: General rules in
./rules/tests/general/are shared with thegenerate-test-casesskill (which has copies inrules/general/). When updating rules, keep both locations in sync.
General Rules (Always Apply)
- INCLUDE/EXCLUDE criteria
- Test naming format
- Core testing principles (Given-When-Then, actual/expected)
- Detect language and framework
- Clarity, Completeness, Conciseness, Resilience
- Use helpers and builders for test data
- Effects follow causes immediately
- KISS > DRY, avoid logic in assertions
- One scenario per test
- Separate tests for behaviors
- Only verify relevant mock arguments
- Test public APIs over private methods
- Check for existing tests, match project conventions
- Read dependencies before writing tests
Java Unit Tests
- Basic template, FORBIDDEN annotations
- Use explicit JSON literals
- Use ArgumentCaptor, not any()
- OutputCaptureExtension for logs
- Mockito patterns for services
- @WebFluxTest patterns for controllers
- Java Records, @With, and Lombok standards
- Logging with @Slf4j
Post-Generation
- Verify compilation
- Verify tests pass
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.

