agentleFS
jovd83jovd83/junit5-skill/SKILL.md

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
  1. Distinctive:

    Use this root skill as the package entrypoint for general JUnit 5 requests.

    line 21
  2. Distinctive:

    Keep package boundaries clear across authoring, migration, CI, analysis, extensions, architecture, and documentation workflows.

    line 27
  3. Distinctive:

    Do not assume every JVM repo uses Spring, Testcontainers, Mockito, or parallel execution.

    line 31
  4. Distinctive:

    Do not add JUnit 4 APIs in new code unless the task is explicitly about migration.

    line 32
  5. Distinctive:

    Do not silently convert unstable integration tests into mocked unit tests just to make them pass.

    line 33
  6. Distinctive:

    Do not treat JUnit 6 branding as permission to generate non-JUnit-5-compatible patterns for a repo that still targets JUnit 5.

    line 34
  7. Distinctive:

    Prefer the repository's existing JVM test stack over introducing JUnit 5 into a repo that already standardizes on something else.

    line 38
  8. Distinctive:

    Treat sibling skill names in this file as package-local guidance.

    line 39
  9. Very specific:

    Run scripts/detect-junit-test-context.ps1 when repo structure or toolchain is unclear.

    line 60
  10. Distinctive:

    Run the narrowest relevant test first.

    line 63
  11. Distinctive:

    Keep JUnit 5 compatibility explicit unless the repo has already moved beyond it.

    line 65
  12. Distinctive:

    Prefer JUnit Jupiter APIs for new test code.

    line 69
  13. Distinctive:

    Prefer deterministic tests over order-dependent or environment-dependent tests.

    line 70
  14. Distinctive:

    Use the lightest test type that still validates the real risk.

    line 71
  15. Distinctive:

    Prefer parameterized tests over copy-pasted examples when inputs vary systematically.

    line 72
  16. Very specific:

    Prefer soft assertions (assertAll()) to report multiple failures in one run, ensuring faster correction cycles.

    line 73
  17. Distinctive:

    Keep assertions semantic and behavior-focused.

    line 74
  18. Very specific:

    Use @Nested, tags, lifecycle control, and extensions deliberately, not as decoration.

    line 75
  19. Distinctive:

    Keep heavy framework behavior and infrastructure logic out of plain unit tests.

    line 76
  20. Distinctive:

    Read references/capability-map.md when choosing scope.

    line 81
  21. Distinctive:

    Read references/family-conventions.md before adding new package content.

    line 82
  22. Distinctive:

    Read references/version-compatibility.md when build or dependency versions are unclear.

    line 83
  23. Distinctive:

    Read references/release-checklist.md before publishing or cutting a release.

    line 84
  24. Very specific:

    Assertion Order: Always use assertEquals(expected, actual).

    line 89
  25. Very specific:

    Import Conflicts: Ensure you import from org.junit.jupiter.api rather than the old org.junit (JUnit 4) package.

    line 92
  26. Very specific:

    Mocking Leakage: When mocking static methods or constructors (e.g., with Mockito), always use a try-with-resources block or an @AfterEach …

    line 93

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

NeedUse
Generic JUnit 5 request or unclear starting pointcore/SKILL.md
Writing, fixing, running, or correcting JUnit 5 testscore/SKILL.md
Deriving scenarios from requirements, code, or test case definitionsanalysis/SKILL.md
Suite structure, fixture ownership, or naming conventionsarchitecture/SKILL.md
Maven, Gradle, Console Launcher, CI, or reporting setupci/SKILL.md
JUnit 4 to JUnit 5 migrationmigration/SKILL.md
Custom extensions, callbacks, or parameter resolversextensions/SKILL.md
Human-readable automation documentationdocumentation/tests/SKILL.md
Root-cause analysis for failing testsdocumentation/root_cause/SKILL.md
Non-technical summaries of test outcomesreporting/stakeholder/SKILL.md
IDE-specific local setup helpinstallers/intellij-junie/SKILL.md or installers/vscode-codex/SKILL.md

Operating Workflow

  1. Inspect the repo before prescribing structure. Check build files, Java version, dependencies, test layout, and current JUnit usage.
  2. Run scripts/detect-junit-test-context.ps1 when repo structure or toolchain is unclear.
  3. Classify the work as component, integration, slice, repository, service-isolated, service-end-to-end, smoke, regression, migration, or extension work.
  4. Route to the smallest subskill that can complete the task well.
  5. Run the narrowest relevant test first.
  6. Preserve traceability to the requirement, code path, or test-case definition when the work begins from source artifacts.
  7. 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: @BeforeAll and @AfterAll must be static by 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 public modifier) unless they must be accessed from other packages.
  • Import Conflicts: Ensure you import from org.junit.jupiter.api rather than the old org.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 @AfterEach cleanup to prevent state leakage.
  • Tag Selection: Using @Tag without corresponding build-tool configuration (Maven/Gradle) means the tests will run even when you think you've excluded them.

Official References

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/, and installers/ are optional extensions, not prerequisites for routine test authoring.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.