$npx -y skills add AdamBien/airails --skill python-to-javaConvert Python scripts to zero-dependency Java 25 CLI programs. Use when asked to migrate, convert, port, or rewrite Python scripts (.py) to Java, or when translating a Python codebase to Java CLI scripts or apps. Triggers on "convert Python to Java", "migrate Python", "port to J
| 1 | # Python to Java Migration |
| 2 | |
| 3 | Convert Python scripts to idiomatic Java 25 CLI programs with zero external dependencies. |
| 4 | |
| 5 | ## Decision: Single-File vs Multi-File |
| 6 | |
| 7 | Evaluate **before writing any code**: |
| 8 | |
| 9 | 1. **Start with `/java-cli-script`** — one Java file per Python script, no build tool |
| 10 | 2. **Switch to `/java-cli-app`** when any of these apply: |
| 11 | - Multiple scripts share >100 lines of identical code (e.g. domain records) |
| 12 | - A single script exceeds ~500 lines |
| 13 | - Scripts import from each other in Python (`from module import func`) |
| 14 | |
| 15 | When switching to `/java-cli-app`, extract shared code into common source files within the multi-file project. |
| 16 | |
| 17 | ## Migration Process |
| 18 | |
| 19 | 1. **Read all Python scripts** — understand dependencies between them (`import` graph) |
| 20 | 2. **Identify shared code** — `utils.py`, common helpers, shared data classes |
| 21 | 3. **Decide single-file vs multi-file** per the rules above |
| 22 | 4. **Translate each script** using the idiom mapping below |
| 23 | 5. **Verify** — run each script with `-version` to confirm compilation |
| 24 | |
| 25 | ## Python to Java 25 Idiom Mapping |
| 26 | |
| 27 | See [references/idiom-mapping.md](references/idiom-mapping.md) for the complete translation table covering argument parsing, file I/O, subprocess management, concurrency, and standard library equivalents. |