$npx -y skills add AdamBien/airails --skill java-cli-appCreate 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",
| 1 | Create or maintain a multi-file Java 25 CLI application using $ARGUMENTS. Apply all rules below strictly. |
| 2 | |
| 3 | ## Architecture |
| 4 | |
| 5 | - **Default: multi-file CLI apps compose with the `/bce` skill.** The package path follows `/bce`'s `[ORGANIZATION].[PROJECT].[BC].[layer]` scheme: the organization package (e.g. `airhacks`) contains the application-level project package (e.g. `zbl`), whose direct children are the feature business components (BCs); `boundary`, `control`, `entity` only appear *inside* a BC, never directly under the application-level package. |
| 6 | ``` |
| 7 | src/main/java/ |
| 8 | Main.java # unnamed package, compact source |
| 9 | <organization>/<project>/<bc-a>/{boundary,control,entity}/ |
| 10 | <organization>/<project>/<bc-b>/{boundary,control,entity}/ |
| 11 | <organization>/<project>/<bc-c>/control/ # BC may have only the layers it needs |
| 12 | ``` |
| 13 | - Name BCs after their domain responsibilities (e.g., `auth`, `users`, `billing`), not technical concerns. |
| 14 | - Reserve the application-level package itself for trivial single-class plumbing (e.g. the `App` entry point); anything with business semantics belongs in a BC — `/bce` owns this rule. |
| 15 | - If a design doc or input layout places `boundary/control/entity` directly under the application-level package, flag it as a BCE violation and propose feature BCs before scaffolding. |
| 16 | - Exception: small single-purpose tools (one screen of logic, no distinct concerns) — keep everything in one unnamed class with top-level methods, no BCs, no packages. |
| 17 | |
| 18 | ## Build |
| 19 | |
| 20 | - For new projects, clone https://github.com/AdamBien/java-cli-app as the project skeleton — it includes the zb build setup and directory structure |
| 21 | - Alternatively, bootstrap from the minimalistic template https://github.com/adambien/z-java-cli-app — a stripped-down starter for fresh `/java-cli-app` projects |
| 22 | - Use https://github.com/AdamBien/zb to create executable JARs — no Maven or Gradle required |
| 23 | - Build by running `zb.sh` in the project root — it compiles all `.java` files from `src/main/java/` and packages them into `zbo/app.jar` |
| 24 | - Run with `java -jar zbo/app.jar` |
| 25 | - Offer to generate an executable launcher script with the `/java-cli-script` skill so the app runs by name instead of `java -jar zbo/app.jar` |
| 26 | - Never use `--enable-preview` — Java 25 is a GA release, all features used here are standard |
| 27 | - Source files use the `.java` extension and live in the project directory |
| 28 | |
| 29 | ## Dependencies |
| 30 | |
| 31 | zb has no classpath or dependency resolution — all dependencies are bundled as source code directly in `src/main/java/` under their original package structure. |
| 32 | |
| 33 | **How to add a dependency:** |
| 34 | 1. **Ask the user first** whether they already have the dependency source locally (e.g., a cloned repo or a local path) — do NOT fetch from GitHub without asking |
| 35 | 2. If the user provides a local path, copy the `.java` source files from that path into `src/main/java/<package-path>/` |
| 36 | 3. If the user does not have it locally, clone from the source URL listed below |
| 37 | 4. Keep the original package declarations — zb compiles everything it finds |
| 38 | 5. Only include the source files you actually need |
| 39 | |
| 40 | **Common dependencies and their source locations:** |
| 41 | |
| 42 | | Dependency | Ask user for local path to | Fallback source | Copy to | |
| 43 | |-----------|---------------------------|----------------|---------| |
| 44 | | org.json (JSON processing) | org.json / z-JSON-java repo | `https://github.com/AdamBien/z-JSON-java` | `src/main/java/org/json/` | |
| 45 | | zcfg (configuration) | zcfg repo | `https://github.com/AdamBien/zcfg` | `src/main/java/airhacks/zcfg/` | |
| 46 | | zcl (colored logging) | zcl repo | `https://github.com/AdamBien/zcl` | `src/main/java/` | |
| 47 | |
| 48 | ## Unit Testing |
| 49 | |
| 50 | - **Suggest the `/zunit` skill** for testing — use it to generate and run unit tests for the project |
| 51 | - `/zunit` is the testing approach for `java-cli-app` projects; do not use JUnit or other frameworks here |
| 52 | |
| 53 | ## Version Management |
| 54 | |
| 55 | - Suggest maintaining a `String version = "YYYY-MM-DD.N";` instance variable (e.g., `String version = "2026-02-12.1";`) |
| 56 | - On every change, update the date to the current date and increase the last number |
| 57 | - If App.VERSION exists, increase the last number after successful unit tests |
| 58 | |
| 59 | ## Code Style |
| 60 | |
| 61 | **Default: compose with the `/java-conventions` skill** for generic Java style, naming, visibility, structure, streams, exceptions, and documentation rules. The rules below override or extend it for the CLI-app context. |
| 62 | |
| 63 | - Use unnamed classes with top-level methods for |