| name | java-cli-script |
| description | 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. |
Create or maintain a zero-dependency, single-file executable Java script using $ARGUMENTS. Apply all rules below strictly.
Purpose
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.
Composition
- Follow
/java-conventions for all generic Java 25 style, syntax, naming, methods, streams, exceptions, and comments
- The rules below specialize
/java-conventions for single-file source-mode scripts; when this skill is silent on a topic, /java-conventions applies
Single-File Constraint
- Everything lives in one file — all logic, records, enums, sealed types, and helper methods
- If the script grows beyond what fits comfortably in a single file, suggest switching to the
java-cli-app skill instead
- No multi-file source-code programs — this skill is strictly for single-file scripts
Build
- Use Java 25 source-file mode — no build tool, no compilation step
- Never use the
.java extension — scripts are executable files with a lowercase filename and a shebang
- Never use
--enable-preview in the shebang — Java 25 is a GA release, all features used here are standard