unit-tests-skills
AI agent skills for generating high-quality unit tests — Given-When-Then test cases, JUnit 5, Mockito, AssertJ. Works with Claude Code, Cursor, and any AGENTS.md-compatible agent.
Install / Use
npx skills add mavka-ai/unit-tests-skillsInstalls into whichever agent you are using.
Other
Other agent config
Quality Score
Category
AI & Machine LearningSupported Platforms
Tags
Our assessment of unit-tests-skills
unit-tests-skills scores 88/100 on our quality scale, 394th of 960 AI & Machine Learning skills we index (top 42%).
Its Other is 13 KB long, well organised into 34 sections with 15 code examples: a thorough specification that gives an agent plenty to work with.
It has 66 GitHub stars, a meaningful sign that others use it.
Maintenance, license and trust
- The repository was last updated 10 days ago, so unit-tests-skills is actively maintained.
- Our last check on 2026-09-28 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-24. Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
unit-tests-skills compared with similar skills
All 4 of these similar skills score higher than unit-tests-skills; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| unit-tests-skills (this skill)by mavka-ai | 88 | 66 | 10d ago | Other |
| claude-memby thedotmack | 100 | 95.2k | today | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 85.1k | 1d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 74.3k | today | CLAUDE.md |
| CowAgentby zhayujie | 100 | 47.2k | today | CLAUDE.md |
Frequently asked questions
- How do I install unit-tests-skills?
- Run
npx skills add mavka-ai/unit-tests-skills. The install tabs above show the steps for each supported agent. - Which AI agents does unit-tests-skills work with?
- It is written for Claude Code, Cursor and OpenAI Codex, as a Other file. Other agents that read the same format can often use it too.
- Is unit-tests-skills safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is unit-tests-skills still maintained?
- The repository was last updated 10 days ago, so unit-tests-skills is actively maintained.
Skill content
View source on GitHubWhy
An agent asked to "write tests" can stop as soon as the build is green. But a green suite with full branch coverage can still miss real defects: the benchmark below shows exactly that.
These skills give the agent a testing process instead of a one-shot prompt: plan the cases from the code's branches, generate focused tests, compile them, and run them before reporting done. Use them when you:
- add unit tests to an untested Java service or controller;
- want to review the planned test cases before any test code is written;
- want generated tests that follow consistent naming and structure rules.
See the difference
Same green build. Same 100% branch coverage. More defects detected.
In one controlled benchmark, Claude and Codex each generated tests for the same pinned Spring Petclinic target, first without the skill and then with it. We ran all four suites against the original code and the same 12 deliberately introduced defects.
Engines: Claude Code 2.1.276 with OPUS-5 · Codex 0.155.1 with
gpt-5.6-sol
| Engine | Setup | Build | Tests | Mutants killed | Survived | |--------|-------|-------|------:|----------------:|---------:| | Claude | Without skill | PASS | 20 | 5 / 12 | 7 | | Claude | With skill | PASS | 35 | 10 / 12 | 2 | | Codex | Without skill | PASS | 15 | 5 / 12 | 7 | | Codex | With skill | PASS | 26 | 11 / 12 | 1 |
All four suites built successfully and reported 100% branch coverage. Mutation testing revealed the difference: the suites generated with the skill detected 10–11 of the 12 injected defects instead of 5.
<details> <summary><strong>What is a mutant?</strong></summary>A mutant is one deliberate, single-line change introduced into production code after the tests are written. The suite is then run against that changed code.
- If the suite fails, the mutant is killed.
- If the suite still passes, the mutant survived.
Benchmark scope: One fixed scenario on a pinned Spring Petclinic target. Results may vary across codebases, tasks, models, and runs.
Installation
Option 1: Using npx skills (Recommended)
For reliable automatic skill discovery, complete both steps:
- Install the skills:
npx skills add mavka-ai/unit-tests-skills
- Add the
AGENTS.mdsnippet to your project'sAGENTS.mdfile so AI agents know when and how to use the installed skills.
Or install specific skills:
npx skills add mavka-ai/unit-tests-skills --skill generate-test-cases
npx skills add mavka-ai/unit-tests-skills --skill generate-tests
Option 2: Using openskills (Recommended for other agents)
openskills automatically generates AGENTS.md for maximum AI agent effectiveness.
# Install skills
npx openskills install mavka-ai/unit-tests-skills
# Auto-generate/update AGENTS.md with installed skills
npx openskills sync
Why openskills? According to Vercel's research, skills alone trigger only 53% of the time. With AGENTS.md, success rate jumps to 100%.
Option 3: Claude Code plugin (Recommended for Claude Code)
/plugin marketplace add mavka-ai/unit-tests-skills
/plugin install unit-tests-skills@mavka
Skills are namespaced by the plugin, so they are invoked as
/unit-tests-skills:generate-tests and /unit-tests-skills:generate-test-cases.
See Updating and Uninstalling to keep the
installed plugin current or remove it.
Try it
Examples below use the plain command form. If you installed as a plugin, prefix the skill name with the plugin:
/unit-tests-skills:generate-tests.
Generate tests for a class:
/generate-tests src/services/OrderService.java
Only plan the test cases, without generating code:
/generate-test-cases src/services/OrderService.java
What you get
Test Cases
## Test Cases for OrderService.calculateTotal
### 1. calculateTotal_validProducts_returnsSum
- **Given:** List with products priced at 50.0 and 100.0
- **When:** calculateTotal() is called
- **Then:** Returns 150.0
- **Code branch:** Happy path
### 2. calculateTotal_emptyList_throwsIllegalArgumentException
- **Given:** Empty product list
- **When:** calculateTotal() is called
- **Then:** Throws IllegalArgumentException
- **Code branch:** Validation - empty input
Generated Test
@ExtendWith(MockitoExtension.class)
class OrderServiceTest {
@Mock
private ProductRepository productRepository;
@InjectMocks
private OrderService orderService;
@Test
void calculateTotal_validProducts_returnsSum() {
// Given
var product1 = new Product("A", 50.0);
var product2 = new Product("B", 100.0);
when(productRepository.findAll()).thenReturn(List.of(product1, product2));
// When
double actualTotal = orderService.calculateTotal();
// Then
double expectedTotal = 150.0;
assertThat(actualTotal).isEqualTo(expectedTotal);
}
}
How it works
/generate-tests runs the full workflow unattended:
- Plan: analyzes the source code and prints a structured list of test cases
- Generate: writes the test files from that plan
- Compile: verifies the tests compile
- Run: runs the tests and reports the result
Available skills
| Skill | Command | Plugin command | Description |
|-------|---------|----------------|-------------|
| Generate Tests | /generate-tests <target> | /unit-tests-skills:generate-tests <target> | Full workflow, unattended: analyzes code, prints the test case list, generates test code, verifies it compiles and passes. Supports Java (JUnit 5, Mockito, AssertJ). |
| Generate Test Cases | /generate-test-cases <target> | /unit-tests-skills:generate-test-cases <target> | Analysis only: outputs a structured list of test cases in Given-When-Then format without generating code. |
Claude Code namespaces plugin skills by plugin name, so the command depends on
how you installed. Use the Plugin command after
Option 3; use the
plain Command after openskills or npx skills.
Testing Principles
These skills enforce proven testing practices:
General Rules (All Languages)
| Rule | Description |
|------|-------------|
| Test Case Strategy | Strict INCLUDE/EXCLUDE criteria - test each code branch, not collection sizes |
| Naming Conventions | {method}_{state}_{outcome} format for clarity |
| Given-When-Then | Clear structure with actual/expected prefixes |
| Keep Tests Focused | One scenario per test, single responsibility |
| Test Behaviors | Test what it does, not how it's implemented |
| No Logic in Tests | KISS > DRY - use literal values, avoid calculations |
| Clean Test Data | Use helpers and builders, never rely on defaults |
| Cause-Effect Clarity | Setup belongs in the test, not in distant @BeforeEach |
| Public APIs First | Test through public interfaces, not private methods |
| Verify Relevant Args | Use any() for irrelevant arguments in mocks |
Supported agents
- Claude Code: install as a plugin (Option 3) or with
npx skills. - Codex and other agents that read
AGENTS.md: install withnpx skillsor openskills, and make sure yourAGENTS.mdreferences the skills.
Why AGENTS.md Matters
| Configuration | Success Rate | |---------------|--------------| | Skills alone | 53% | | Skills + prompting | 79% | | AGENTS.md | 100% |
AGENTS.md provides persistent context to AI agents on every turn, without requiring them to decide to load skills first. See the full article for details.
Supported languages
Java
- JUnit 5 + Mockito + AssertJ
@ExtendWith(MockitoExtension.class)for unit tests- FORBIDDEN:
@SpringBootTestin unit tests - Use
ArgumentCaptorinstead ofany()for DTOs - Explicit JSON literals (no
objectMapper.writeValueAsString()) OutputCaptureExtensionfor log verification
Updating and Uninstalling
Use the commands for the installation method you originally chose.
npx skills
Update both skills to their latest versions:
npx skills update generate-test-cases generate-tests
Remove both skills:
npx skills remove generate-test-cases generate-tests
Because the AGENTS.md snippet for this installation method is added manually,
remove that snippet manually after uninstalling the skills.
openskills
Update installed skills from their recorded sources, then regenerate
AGENTS.md:
npx openskills update
npx openskills sync
Remove both skills, then regenerate AGENTS.md so it no longer references
them:
npx openskills remove generate-test-cases
npx openskills remove generate-tests
npx openskills sync
Claude Code plugin
Refresh the marketplace listing, then update the installed plugin:
/plugin marketplace update mavka
/plugin update unit-tests-skills@mavka
Remove the installed plugin:
/plugin uninstall unit-tests-skills@mavka
If you no longer use anything from the mavka marketplace, you can also remove
the marketplace itself with /plugin marketplace remove mavka. Removing a
marketplace also uninstalls plugins installed from it.
Documentation
- Google's unit test best practices — source review and implementation status for the rules in this repository.
- The Complete Guide to Building Skills for Claude
Contributing
Contributions are welcome via Pull Requests. All PRs require review and approval from maintainers before merging.
When adding new rules:
- Place general rules in
skills/{skill-name}/rules/general/(orrules/tests/general/for
Truncated for display — read the full file on GitHub.
Related Skills
claude-mem
95.2kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Understand-Anything
85.1kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
74.3kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
CowAgent
47.2kOpen-source personal AI assistant & Agent Harness. Plans tasks, runs tools and skills, self-evolves with memory and knowledge. Multi-agent, multi-model, multi-channel. Lightweight, extensible, one-line install.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
