java/zunit/SKILL.md
Generate and run zunit tests for java-cli-app projects. Use when asked to create tests, write tests, add tests, or generate test files for a java-cli-app project. Triggers on "zunit", "write tests", "create tests", "add tests", "test this", "generate tests", or requests to test a java-cli-app application. Also trigger when the user asks to verify or validate behavior of a java-cli-app project. Not for JUnit tests or microprofile-server projects — use continuous-testing for those.
npx skillsauth add adambien/airails zunitInstall 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.
Generate and run zunit tests for a java-cli-app project using $ARGUMENTS. Apply all rules below strictly.
zunit is a zero-dependency test runner. It discovers *Test.java source files and runs each directly via java --source 25. No compilation step, no JUnit, no framework.
Test.java, placed in test/ directoryvoid main()java --source 25 --class-path <classpath>Every test file follows this pattern:
void main() {
// arrange
var input = ...;
// act
var result = SomeClass.someMethod(input);
// assert — throw on failure
if (!expected.equals(result))
throw new AssertionError("expected %s but got %s".formatted(expected, result));
}
if + throwAssertionError with a descriptive message including expected and actual valuesvoid main() {
try {
SomeClass.methodThatShouldFail(badInput);
throw new AssertionError("expected exception was not thrown");
} catch (IllegalArgumentException expected) {
// success
}
}
project-root/
├── src/main/java/ # main source (compiled by zb)
├── test/ # zunit test sources
│ ├── SomethingTest.java
│ └── AnotherTest.java
├── zbo/app.jar # zb output (auto-detected as classpath)
└── .zb # zb config
zunit auto-detects zbo/app.jar as the classpath. Tests import main classes directly — zb packages everything into app.jar.
src/main/java/ to understand what to testtest/ directory — one test file per logical concernParserTest.java, ValidationTest.java, OutputTest.javajava.base — it is automatically availableimport module java.net.http;)var for local variablesvoid main() at top level, helper methods as neededIO.println() for assertions — throw exceptionsWhen tests make network calls using java.net.http.HttpClient, always set explicit timeouts to prevent tests from hanging:
.connectTimeout(Duration.ofSeconds(2)) on the HttpClient.timeout(Duration.ofSeconds(2)) on each HttpRequestAfter generating test files:
zb (compiles main sources into zbo/app.jar)zunit (discovers test/*Test.java, runs against zbo/app.jar)zb && zunitUse zunit -verbose to debug classpath or discovery issues.
Given a main class in src/main/java/Converter.java:
class Converter {
static int toFahrenheit(int celsius) {
return celsius * 9 / 5 + 32;
}
}
Generate test/ConverterTest.java:
void main() {
// freezing point
var freezing = Converter.toFahrenheit(0);
if (freezing != 32)
throw new AssertionError("expected 32 but got " + freezing);
// boiling point
var boiling = Converter.toFahrenheit(100);
if (boiling != 212)
throw new AssertionError("expected 212 but got " + boiling);
// negative
var negative = Converter.toFahrenheit(-40);
if (negative != -40)
throw new AssertionError("expected -40 but got " + negative);
}
tools
Generic, composable Java 25 code conventions — modern syntax, code style, naming, visibility, structure, methods, streams, exceptions, and documentation rules that apply across all Java contexts (single-file scripts, CLI apps, MicroProfile/Jakarta EE servers, libraries). Technology-neutral within the Java world; meant to be composed with context-specific skills (e.g. `java-cli-script`, `java-cli-app`, `microprofile-server`, `bce`). Use when writing, generating, or reviewing Java code anywhere the composed skill does not already specify style. Triggers on "Java conventions", "Java style", "Java code style", "modern Java", "Java 25", "idiomatic Java", or any request to write or review Java code where context-specific skills do not already cover style.
development
Architecture and coding rules for long-running Java MicroProfile / Jakarta EE server applications — BCE layering, business components (BC), JAX-RS resources, CDI, JSON-P, testing (unit/integration/system), and Maven project structure. Use when creating, generating, scaffolding, writing, or reviewing code, resources, entities, boundaries, or business components in MicroProfile server projects. Not for serverless deployments.
tools
Create and maintain multi-file Java 25 CLI applications packaged as executable JARs with zb (Zero Dependencies Builder). Use when asked to create a Java CLI application, a CLI project with multiple source files, or an executable JAR. Triggers on "Java CLI app", "CLI application", "multi-file Java", "executable JAR", "zb build", or requests for Java programs that need multiple source files or JAR packaging. Not for single-file scripts — use java-cli-script for those.
development
Generate a GitHub Actions pipeline that builds a zb (Zero Dependencies Builder) project and publishes a GitHub Release with the produced JAR. Use whenever the user wants CI/CD, a build pipeline, a release workflow, or GitHub Actions for a zb-based Java project — phrases like "set up GitHub Actions for this zb project", "add a zb release pipeline", "create a build workflow", "automate the zb build/release", or when a project has a .zb config and needs continuous builds/releases. Trigger even if the user doesn't say "zb" explicitly, as long as the project is a zb project (a .zb file is present and there is no Maven/Gradle build).