agentleFS
Marisha-SahayMarisha-Sahay/awesome-java-agent-skills/skills/build-tools/java-build-verification/SKILL.md

java-build-verification

Skill24 starsChanged 3 months agoMITView on GitHub

Use when about to tell the user that Java code works, tests pass, a Maven or Gradle build is green, a flaky test is fixed, or a change is ready to merge or commit.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every message that reports a build, test or fix outcome ends with this block.

    line 16
  2. Very specific:

    Test counts come from Maven's Tests run: summary lines, never from counting @Test methods.

    line 29
  3. Distinctive:

    Run the build into a fresh log file and read the summary lines from it, in one shell command:

    line 35
  4. Distinctive:

    Run the loop on the unfixed code.

    line 72
  5. Distinctive:

    Run enough repetitions that the old failure rate would almost surely show up:

    line 77

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

Java Build Verification

Overview

A claim about a Java build is worth exactly the build output behind it. Before saying tests pass, a flaky test is fixed or a change is ready to merge, run the command that proves it and quote its summary lines in your reply.

The Verification Block

Every message that reports a build, test or fix outcome ends with this block. Fill each line with text copied from tool output you received in this session:

**Verification**
- Command: `./mvnw verify` (exit 0)
- Unit tests (Surefire): Tests run: 10, Failures: 0, Errors: 0, Skipped: 0
- Integration tests (Failsafe): Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
- Quality gates: All coverage checks have been met.
- Result: BUILD SUCCESS
  • A line you have no output for reads not run, and the message makes no claim that depends on it.
  • Test counts come from Maven's Tests run: summary lines, never from counting @Test methods.
  • The exit code is the build command's own, not that of a tail or grep it was piped into.
  • A flaky-test fix adds a Repeat runs line with the before and after numbers (see below).

Getting the Evidence

Run the build into a fresh log file and read the summary lines from it, in one shell command:

log=$(mktemp); ./mvnw verify > "$log" 2>&1; echo "exit=$? log=$log"
grep -E '^\[(INFO|WARNING|ERROR)\] (Tests run: [0-9]+, Failures: [0-9]+, Errors: [0-9]+, Skipped: [0-9]+$|BUILD |Rule violated|All coverage)|^\[ERROR\]   ' "$log"

A passing build prints one Tests run: line per plugin, the coverage line and BUILD SUCCESS. A failing build also prints one [ERROR] Class.method:line entry per failing test. For follow-up greps, use the path printed after log=. Each build gets its own file because a fixed path such as /tmp/verify.log is shared by every build on the machine: with parallel agents or worktrees you end up quoting another build's numbers.

Which command proves what

ClaimCommandWhat it runs
Unit tests pass./mvnw testCompile, Surefire (*Test)
Ready to merge / CI will pass./mvnw verify, or whatever the CI workflow runsSurefire, Failsafe (*IT), and gates bound to verify such as the JaCoCo check
One unit test./mvnw test -Dtest='RefundServiceTest#rejectsAnUnknownOrder'That test only
One integration test./mvnw -q test-compile then ./mvnw failsafe:integration-test failsafe:verify -Dit.test=RefundEventsITThat IT only (-Dtest does not select Failsafe tests)
Gradle./gradlew check; one test: ./gradlew test --tests 'RefundServiceTest'Evidence is BUILD SUCCESSFUL plus the exit code; counts are in build/test-results/

Flaky Test Fixes

One green run of a test that failed one time in five proves nothing: the unfixed test passes most runs too. Measure, fix, measure again:

./mvnw -q test-compile
fails=0; for i in $(seq 1 20); do
  ./mvnw -q failsafe:integration-test failsafe:verify -Dit.test=RefundEventsIT > /dev/null 2>&1 || fails=$((fails+1))
done; echo "failures: $fails/20"

(For a unit test, loop ./mvnw -q surefire:test -Dtest=OrderServiceTest instead.)

  1. Run the loop on the unfixed code. If it never fails, you have not reproduced the flake: say so, and treat any fix as unconfirmed.
  2. Apply the fix, run ./mvnw -q test-compile again, then the same loop.
  3. Report both: Repeat runs: 5/20 failed before the fix, 0/20 after.

Run enough repetitions that the old failure rate would almost surely show up:

Observed failure rateRuns
1 in 312
1 in 520
1 in 1045

Common Mistakes

These come from baseline runs of agents working without this skill:

What the agent didWhat the Verification block shows instead
Wrote "the test ran once with no failures" without running MavenCommand: not run and no pass claim
Ran ./mvnw -q verify | tail -30 and read "no errors visible" as a passThe Tests run: and BUILD SUCCESS lines from the log
Reported "13 tests pass" by counting test methodsThe two Tests run: lines Maven printed
Said "I fixed the flaky test" after one green runRepeat runs: 5/20 failed before the fix, 0/20 after
Grepped a shared /tmp/verify.log that a parallel build had overwritten, and reported its countsCounts from this build's own mktemp log

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.