Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/timwukp/agent-skills-best-practice/java-unit-test-generatornpx skills add timwukp/agent-skills-best-practice --skill java-unit-test-generatorgit clone --depth 1 https://github.com/timwukp/agent-skills-best-practiceWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/timwukp/agent-skills-best-practice/java-unit-test-generator)<a href="https://agentmods.dev/skills/timwukp/agent-skills-best-practice/java-unit-test-generator"><img src="https://agentmods.dev/badge/skills/timwukp/agent-skills-best-practice/java-unit-test-generator.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00046 | $0.00971 |
| Opus 5 | $0.00023 | $0.00485 |
| Sonnet 5 | $0.00009 | $0.00194 |
| Haiku 4.5 | $0.00005 | $0.00097 |
Grade A, and why
java-unit-test-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 138 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Java Unit Test Generator
Instructions
Step 1: Scope Definition
Before generating tests, ask:
- Which class/method?
- Coverage goal? (Basic = happy path | Standard = + errors | Comprehensive = + edge cases)
- Framework? (JUnit 4, JUnit 5, TestNG)
- Mocking? (Mockito, EasyMock, none)
Provide an upfront estimate: 10-15 credits per method.
Step 2: Generate 3 Tests Per Batch
For each method, generate exactly 3 tests:
- Happy path
- Error handling
- Edge case
Use this structure:
@Test
@DisplayName("Should [expected behavior] when [condition]")
void test[MethodName][Scenario]() {
// Given - setup
// When - execute
// Then - verify
}
STOP after each batch. Ask the user to run and confirm before continuing.
Step 3: Validation Gate
Do NOT generate more tests until the user confirms the current batch works.
Validation command:
python scripts/validate_tests.py <TestClassName>
Step 4: Fix or Skip (Max 2 Attempts)
If tests fail:
- Attempt 1: Fix compilation errors (imports, syntax)
- Attempt 2: Fix logic errors (assertions, test data)
- After 2 failures: Skip the test, document the issue, and move on
When skipping, say:
"This test failed twice. Skipping to preserve credits. Issue: [describe]. Options: (1) skip, (2) provide more context, (3) simplify scope."
Never attempt the same fix more than twice. Mark flaky tests @Disabled.
Step 5: Iterate or Finish
After a passing batch, offer:
- 3 more tests for the same method
- Move to next method
- Stop and produce summary
Step 6: Summary Report
Methods Tested: N
Total Tests: N
Skipped: N (with reasons)
Coverage: happy path / error / edge case breakdown
Measuring Credit Cost for Your Code
Credit costs vary by Kiro account, model, and code complexity. To get accurate numbers for your environment, follow these steps.
1. Establish your baseline (one-time)
Run the built-in benchmark with a simple sample class:
What ships with it
4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 138 lines · 46 tokens per session scan A eb7ede935997
java-unit-test-generator is a skill published in the GitHub repository timwukp/agent-skills-best-practice (10 stars, last pushed today), licensed MIT. It adds 46 tokens to every session and 971 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
java-regression-test-generator
Automatically generate regression tests for Java codebases by analyzing changes between old and new code versions. Use when users need to: (1) Generate tests after refactoring or code changes, (2) Ensure previously tested behavior still works in new versions, (3) Cover modified or newly added code paths, (4) Migrate…
111-java-maven-dependencies
Use when you need to add or evaluate Maven dependencies that improve code quality or domain modeling — including nullness annotations (JSpecify), static analysis (Error Prone + NullAway), functional programming (VAVR), architecture testing (ArchUnit), or money and currency support (JavaMoney) — and want a…
130-java-testing-strategies
Use when you need to apply testing strategies for Java code — RIGHT-BICEP to guide test creation, A-TRIP for test quality characteristics, or CORRECT for verifying boundary conditions. This should trigger for requests such as Review Java code for testing strategies; Apply RIGHT-BICEP testing strategies in Java code…
incremental-java-programmer
Incrementally implement new features in Java repositories from natural language descriptions. Use when adding functionality to existing Java codebases (Maven or Gradle projects). Takes a feature description as input and outputs modified repository with implementation code, corresponding JUnit tests, and verification…
131-java-testing-unit-testing
Use when you need to review, improve, or write Java unit tests — including migrating from JUnit 4 to JUnit 5, adopting AssertJ for fluent assertions, structuring tests with Given-When-Then, ensuring test independence, applying parameterized tests, mocking dependencies with Mockito, verifying boundary conditions…
421-frameworks-quarkus-testing-unit-tests
Use when you need to write fast unit tests for Quarkus applications — including pure tests with @ExtendWith(MockitoExtension.class), @QuarkusTest with @InjectMock for full CDI mock replacement, @InjectSpy for partial CDI bean mocking, REST Assured for resource-focused tests, @ParameterizedTest with @CsvSource /…