java/java-cli-script/SKILL.md
Create zero-dependency, single-file executable Java scripts for system-wide use via PATH. Use when asked to create a single-file Java shell script, system utility, PATH-installed Java tool, or shebang-launched Java program without the .java extension. Triggers on "Java script", "Java utility", "PATH script", "system script", or requests for single-file Java programs installed in /usr/local/bin or similar PATH directories. Not for multi-file Java applications — use java-cli-app for those.
npx skillsauth add adambien/airails java-cli-scriptInstall 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.
Create or maintain a zero-dependency, single-file executable Java script using $ARGUMENTS. Apply all rules below strictly.
These are self-contained, single-file Java scripts installed in a PATH directory (e.g., /usr/local/bin) and invoked like any shell command — no project structure, no build tool, no .java extension.
java-cli-app skill instead.java extension — scripts are executable files with a lowercase filename and a shebang--enable-preview in the shebang — Java 25 is a GA release, all features used here are standard#!/usr/bin/env -S java --source 25
jsonformat, portcheck, sysinfo)hello-world) — Java source-file mode does not support them. Use camelCase instead (e.g., helloWorld)chmod +x scriptnamecp scriptname /usr/local/bin/ or ln -s $(pwd)/scriptname /usr/local/bin/scriptnameA minimal script:
#!/usr/bin/env -S java --source 25
void main(String... args) throws Exception {
// ...
}
A script with helper methods and records:
#!/usr/bin/env -S java --source 25
record Result(String name, int value) {}
Result process(String input) {
// ...
}
void main(String... args) throws Exception {
// ...
}
MethodHandles.lookup().lookupClass().getName() — in source-file mode, the class name matches the filename, so there is nothing to hardcode or keep in syncString version = "YYYY-MM-DD.N"; instance variable (e.g., String version = "2026-02-20.1";)-version flag to print the versionvoid main(String... args) throws Exception — PATH-installed scripts always accept arguments; declaring throws Exception keeps the code clean by avoiding try-catch boilerplate for checked exceptions like IOException/zargs skill to generate an enum-based argument parser — it remains zero-dependency and single-file-help or -version flag needed-help and -version flagsScript with no additional arguments — just print the version:
String name = MethodHandles.lookup().lookupClass().getName();
String version = "2026-02-20.1";
void main(String... args) throws Exception {
if (args.length == 0) {
IO.println(name + " " + version);
return;
}
// ... main logic
}
Script with additional arguments — include -help and -version:
String name = MethodHandles.lookup().lookupClass().getName();
String version = "2026-02-20.1";
void main(String... args) throws Exception {
if (args.length == 0 || args[0].equals("-help")) {
IO.println("""
Usage: %s <input> [options]
-help Show this help
-version Show version
""".formatted(name));
return;
}
if (args[0].equals("-version")) {
IO.println(name + " " + version);
return;
}
// ...
}
java.base module and standard JDK modulesjava.net.http.HttpClient for HTTP, javax.crypto for crypto, java.nio.file for file I/Ojava-cli-app skill with zb insteadIO.println() for printing (or IO::println as method reference) — never System.out.println()IO.println with a text block — never multiple IO.println calls for consecutive linesvar for local variable declarations where the type is obviousjava.base — it is automatically availableimport module java.net.http;) — never individual type imports'\n' not 10, define int ESC = '\033' instead of inlining 27Runnable, Consumer, or lambda in a record instead of switching on type externally.filter(this::isSkillFile) over .filter(p -> p.endsWith("SKILL.md")))if a pure decision rather than hiding behavior inside the conditioncat file | scriptname)System.err.println()/zcl skill — it adds ANSI color support with zero dependencies/zcfg skill to add zero-dependency configuration loading/zcfg when persistent settings are genuinely neededThe following zero-dependency libraries can be embedded directly into single-file scripts. They may need to be cloned first:
git clone https://github.com/AdamBien/zcl/zargs skill generates the code directly)git clone https://github.com/AdamBien/zcfgWhen presenting the finished script, always include installation instructions:
# Make executable
chmod +x scriptname
# Install system-wide (pick one)
sudo cp scriptname /usr/local/bin/
# or symlink for development
sudo ln -s $(pwd)/scriptname /usr/local/bin/scriptname
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).