skills/test-writing/SKILL.md
TEST WRITING SKILL — Write correctly structured JUnit 5 tests that match this project's conventions. USE FOR: adding tests for a new backlog item; flagging missing test coverage; writing tests for engine classes, domain logic, or persistence. Covers class placement, naming conventions, setup patterns, assertion style, and what not to test. DO NOT USE FOR: running tests (use build-verify skill); diagnosing test failures (read the Surefire report directly).
npx skillsauth add zcross00/ProcessDocumentation test-writingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Conventions for writing correctly structured JUnit 5 tests. Follow these exactly.
junit-jupiter)AssertJ, no Hamcrest — use org.junit.jupiter.api.Assertions.* exclusively| What is under test | Test package | Example |
|---|---|---|
| Engine class in com.{project}.engine | com.{project}.engine | EraTransitionTest, NeedAdvancementTest |
| Domain or root class | com.{project} | DecayEngineTest, SettlementTest |
| UI class | Do not test UI classes | — |
File path mirrors the package:
src/test/java/com/{project}/engine/EraTransitionTest.java
src/test/java/com/{project}/DecayEngineTest.java
package com.{project}.engine; // match the package of the class under test
import ...; // import only what is used
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* {Reference}: {one-line description of what this class tests}.
* <p>
* {Optional: key invariants or thresholds being tested, as a short paragraph.}
*/
class {ClassName}Test { // package-private, NOT public
// ...
}
Rules:
public modifier)@BeforeEach unless the same setup is shared across 4+ test methods — prefer private helper methods insteadUse private factory/builder methods rather than @BeforeEach when setup varies per test:
private World buildWorld() {
World w = new World();
// ... minimal setup for this test scenario
return w;
}
Pattern: {methodUnderTest}_{scenario} or {methodUnderTest}_{expectedBehavior}
void advanceNeeds_worsensHungerThirstFatigue()
void advanceNeeds_clampsAtWorstLevels()
void prehistoricToTribal_requiresScoreAndSettlement()
void conceptDecay_floorsAtZero()
All test method names must unambiguously state what is being verified. No generic names like testHunger() or test1().
// Preferred: assertEquals with a descriptive failure message
assertEquals(expected, actual, "Descriptive failure message");
assertEquals(0f, concept.getProficiency(), 0.0001f,
"Proficiency should floor at 0"); // use delta for float comparisons
// Boolean assertions
assertTrue(condition, "Descriptive failure message");
assertFalse(condition, "Descriptive failure message");
Rules:
development
STANDARDS CHECK JAVA SKILL — Apply standards/general.md and standards/java.md systematically to a Java file or diff. USE FOR: pre-commit standards compliance check; reviewing a file for standards adherence before or after a change. Produces a categorized violation list with the specific rule cited for each. DO NOT USE FOR: general code review (use planner-review skill for implementation review).
testing
REFINEMENT SKILL — Analyze design, features, backlog, and drift to identify and plan needed work. USE FOR: PLANNER producing new backlog items from gaps between design and current state; evaluating tech debt and drift for resolution; structured backlog growth when the user asks the PLANNER to refine or plan more work. DO NOT USE FOR: implementing backlog items (EXECUTOR work); reviewing completed work (use planner-review skill).
development
PLANNER REVIEW SKILL — Review a completed backlog item and update design artifacts accordingly. USE FOR: PLANNER reviewing an EXECUTOR's completed work; updating FEATURES.md after a feature lands; removing completed items from BACKLOG.md; checking for drift. DO NOT USE FOR: implementing backlog items (EXECUTOR work); initial planning (read GOALS and DESIGN directly).
testing
GIT WORKFLOW SKILL — Exact command sequences for all branch lifecycle operations in this project. USE FOR: creating a work branch for a backlog item; committing and merging work; tagging design versions or releases. Eliminates the need to look up git-workflow.md during implementation. DO NOT USE FOR: deciding what to work on (use backlog-entry or agent-orientation).