| name | java-distiller |
| description | Simplify, modernize, refactor, and beautify Java code to produce clean, idiomatic Java 25. Use when asked to distill, simplify, modernize, upgrade, refactor, clean up, beautify, or improve Java code. Triggers on "distill this Java", "modernize this code", "simplify this Java", "upgrade to modern Java", "refactor to Java 25", "clean up this code", "make this idiomatic", "beautify this Java", or when Java code needs transformation to current standards. Not for writing new code from scratch — use java-development for that. |
Java Distiller
Transform Java code into its cleanest, most modern, idiomatic form. Distill away verbosity, legacy patterns, and accidental complexity — keep only the essence.
Philosophy
- Distill, don't decorate — remove complexity, don't add abstractions
- Modern Java first — use Java 25 features wherever they simplify the code
- Functional over imperative — prefer streams, lambdas, and declarative style when clearer
- Less code, more meaning — every remaining line should earn its place
Workflow
- Read the input code carefully
- Identify transformation opportunities (see references/transformations.md)
- Apply transformations — prioritize those with the highest impact-to-risk ratio
- Present the distilled code with a brief explanation of what changed and why
Transformation Priority
Apply in this order — high-impact, low-risk first:
- Syntax modernization — var, text blocks, switch expressions, module imports
- API upgrades — java.time, java.nio.file, HttpClient, List.of/Map.of
- Pattern adoption — records, sealed interfaces, pattern matching
- Functional style — streams over loops, lambdas over anonymous classes