junit5-skill
Skill0 starsChanged 35 days agoMITView on GitHub
Use when the agent needs to create, run, evaluate, debug, correct, modernize, document, or route JUnit 5 tests and related workflows across component, integration, slice, repository, service, regression, smoke, and migration scenarios.
We split this skill into the rules it gives an agent
26 rules. About 0 are common, 20 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈20
Distinctive · estimate
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 21
Use this root skill as the package entrypoint for general JUnit 5 requests.
- Distinctive: line 27
Keep package boundaries clear across authoring, migration, CI, analysis, extensions, architecture, and documentation workflows.
- Distinctive: line 31
Do not assume every JVM repo uses Spring, Testcontainers, Mockito, or parallel execution.
- Distinctive: line 32
Do not add JUnit 4 APIs in new code unless the task is explicitly about migration.
- Distinctive: line 33
Do not silently convert unstable integration tests into mocked unit tests just to make them pass.
- Distinctive: line 34
Do not treat JUnit 6 branding as permission to generate non-JUnit-5-compatible patterns for a repo that still targets JUnit 5.
- Distinctive: line 38
Prefer the repository's existing JVM test stack over introducing JUnit 5 into a repo that already standardizes on something else.
- Distinctive: line 39
Treat sibling skill names in this file as package-local guidance.
- Very specific: line 60
Run scripts/detect-junit-test-context.ps1 when repo structure or toolchain is unclear.
- Distinctive: line 63
Run the narrowest relevant test first.
- Distinctive: line 65
Keep JUnit 5 compatibility explicit unless the repo has already moved beyond it.
- Distinctive: line 69
Prefer JUnit Jupiter APIs for new test code.
- Distinctive: line 70
Prefer deterministic tests over order-dependent or environment-dependent tests.
- Distinctive: line 71
Use the lightest test type that still validates the real risk.
- Distinctive: line 72
Prefer parameterized tests over copy-pasted examples when inputs vary systematically.
- Very specific: line 73
Prefer soft assertions (assertAll()) to report multiple failures in one run, ensuring faster correction cycles.
- Distinctive: line 74
Keep assertions semantic and behavior-focused.
- Very specific: line 75
Use @Nested, tags, lifecycle control, and extensions deliberately, not as decoration.
- Distinctive: line 76
Keep heavy framework behavior and infrastructure logic out of plain unit tests.
- Distinctive: line 81
Read references/capability-map.md when choosing scope.
- Distinctive: line 82
Read references/family-conventions.md before adding new package content.
- Distinctive: line 83
Read references/version-compatibility.md when build or dependency versions are unclear.
- Distinctive: line 84
Read references/release-checklist.md before publishing or cutting a release.
- Very specific: line 89
Assertion Order: Always use assertEquals(expected, actual).
- Very specific: line 92
Import Conflicts: Ensure you import from org.junit.jupiter.api rather than the old org.junit (JUnit 4) package.
- Very specific: line 93
Mocking Leakage: When mocking static methods or constructors (e.g., with Mockito), always use a try-with-resources block or an @AfterEach …
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
JUnit 5 Skill Family
Use this root skill as the package entrypoint for general JUnit 5 requests. Route broad work to the smallest useful subskill. Keep this file light. Read only the subskill and reference files that materially help with the current task.
Responsibilities
- Route broad or ambiguous JUnit 5 requests.
- Apply the shared standards of this package.
- Keep package boundaries clear across authoring, migration, CI, analysis, extensions, architecture, and documentation workflows.
Boundaries
- Do not assume every JVM repo uses Spring, Testcontainers, Mockito, or parallel execution.
- Do not add JUnit 4 APIs in new code unless the task is explicitly about migration.
- Do not silently convert unstable integration tests into mocked unit tests just to make them pass.
- Do not treat JUnit 6 branding as permission to generate non-JUnit-5-compatible patterns for a repo that still targets JUnit 5.
Working With Other Skills
- Prefer the repository's existing JVM test stack over introducing JUnit 5 into a repo that already standardizes on something else.
- Treat sibling skill names in this file as package-local guidance.
Routing Map
| Need | Use |
| Generic JUnit 5 request or unclear starting point | core/SKILL.md |
| Writing, fixing, running, or correcting JUnit 5 tests | core/SKILL.md |
| Deriving scenarios from requirements, code, or test case definitions | analysis/SKILL.md |
| Suite structure, fixture ownership, or naming conventions | architecture/SKILL.md |
| Maven, Gradle, Console Launcher, CI, or reporting setup | ci/SKILL.md |
| JUnit 4 to JUnit 5 migration | migration/SKILL.md |
| Custom extensions, callbacks, or parameter resolvers | extensions/SKILL.md |
| Human-readable automation documentation | documentation/tests/SKILL.md |
| Root-cause analysis for failing tests | documentation/root_cause/SKILL.md |
| Non-technical summaries of test outcomes | reporting/stakeholder/SKILL.md |
| IDE-specific local setup help | installers/intellij-junie/SKILL.md or installers/vscode-codex/SKILL.md |
Operating Workflow
- Inspect the repo before prescribing structure. Check build files, Java version, dependencies, test layout, and current JUnit usage.
- Run
scripts/detect-junit-test-context.ps1when repo structure or toolchain is unclear. - Classify the work as component, integration, slice, repository, service-isolated, service-end-to-end, smoke, regression, migration, or extension work.
- Route to the smallest subskill that can complete the task well.
- Run the narrowest relevant test first.
- Preserve traceability to the requirement, code path, or test-case definition when the work begins from source artifacts.
- Keep JUnit 5 compatibility explicit unless the repo has already moved beyond it.
Shared Standards
- Prefer JUnit Jupiter APIs for new test code.
- Prefer deterministic tests over order-dependent or environment-dependent tests.
- Use the lightest test type that still validates the real risk.
- Prefer parameterized tests over copy-pasted examples when inputs vary systematically.
- Prefer soft assertions (
assertAll()) to report multiple failures in one run, ensuring faster correction cycles. - Keep assertions semantic and behavior-focused.
- Use
@Nested, tags, lifecycle control, and extensions deliberately, not as decoration. - Keep heavy framework behavior and infrastructure logic out of plain unit tests.
- Preserve failing evidence before changing assertions or production code.
Read By Need
- Read references/capability-map.md when choosing scope.
- Read references/family-conventions.md before adding new package content.
- Read references/version-compatibility.md when build or dependency versions are unclear.
- Read references/release-checklist.md before publishing or cutting a release.
Gotchas
- Static Lifecycle:
@BeforeAlland@AfterAllmust bestaticby default. Use@TestInstance(Lifecycle.PER_CLASS)only when non-static lifecycle is explicitly required. - Assertion Order: Always use
assertEquals(expected, actual). Swapping them makes failure reports misleading (e.g., "Expected: 5, Actual: 10" when the actual value was 5). - Assertion Masking: Sequential assertions stop at the first failure. Prefer soft assertions (
assertAll()) to execute and report on multiple independent assertions within a single test, allowing many errors to be fixed at once. - Visibility: JUnit 5 test classes and methods should be package-private (no
publicmodifier) unless they must be accessed from other packages. - Import Conflicts: Ensure you import from
org.junit.jupiter.apirather than the oldorg.junit(JUnit 4) package. Mixing them leads to tests that "pass" because they never ran. - Mocking Leakage: When mocking static methods or constructors (e.g., with Mockito), always use a try-with-resources block or an
@AfterEachcleanup to prevent state leakage. - Tag Selection: Using
@Tagwithout corresponding build-tool configuration (Maven/Gradle) means the tests will run even when you think you've excluded them.
Official References
- JUnit overview: https://docs.junit.org/5.14.3/overview.html
- JUnit 5 user guide landing page: https://junit.org/junit5/
Package Shape
core/is the default path for daily JUnit 5 work.analysis/derives executable scenarios from requirements, code, or narrative test definitions.architecture/governs suite shape, ownership, and reuse.ci/covers execution, build tools, and pipeline behavior.migration/handles JUnit 4 to JUnit 5 modernization.extensions/handles reusable callbacks, parameter resolution, and custom annotations.documentation/,reporting/, andinstallers/are optional extensions, not prerequisites for routine test authoring.
In this repository6 other files it gives its agents.
- junit5-analysisSkill
- junit5-architectureSkill
- junit5-ciSkill
- junit5-coreSkill
- junit5-extensionsSkill
- junit5-migrationSkill
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.

