java-distiller
Skill10 starsChanged 4 months agoMITView on GitHub
Simplify, modernize, refactor, and beautify Java code to produce clean, idiomatic Java. 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 21+", "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 an appropriate Java development skill for that.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- conventional-commitSkill
- diagramsSkill
- drawioSkill
- java-conventionsSkill
- mermaidSkill
- microprofile-serverSkill
- migrate-to-bceSkill
- quarkus-jnosqlSkill
- sdd4j-bceSkill
- sdd4j-ears-testsSkill
- sdd4j-hexagonalSkill
- sdd4j-package-by-featureSkill
- sdd4j-package-by-layerSkill
- sdd4jSkill
- slddSkill
- spring-boot-serverSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Read the input code carefully
- Distinctive: line 53
Do not add comments, Javadoc, or logging that wasn't there
- Distinctive: line 54
Do not add error handling beyond what exists unless the original code has a bug
- Distinctive: line 55
Do not introduce new dependencies
- Distinctive: line 56
Remove unnecessary blank lines, redundant modifiers, and dead imports
- Very specific: line 57
Use var where the type is obvious from the right-hand side
- Very specific: line 58
Use module imports (import module java.net.http;) over individual type imports when the target JDK supports them
- Very specific: line 59
Prefer void main() over public static void main(String[] args) when appropriate
- Distinctive: line 60
When multiple transformations compete, choose the one that produces fewer lines
- Distinctive: line 61
If the code is already clean and modern, say so — don't force changes
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 21+ 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
- Preserve exact behavior — distilling is refactoring, not rewriting
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, pattern matching, module imports - API upgrades —
java.time,java.nio.file,HttpClient,List.of/Map.of,Optional,Stream - Pattern adoption — records, sealed interfaces, pattern matching for
instanceofandswitch - Functional style — streams over loops, lambdas over anonymous classes, method references
- Concurrency modernization — virtual threads, structured concurrency, scoped values (only when the codebase already uses them or the target JDK supports them)
- Structural simplification — flatten hierarchies, inline trivial methods, remove dead code
Output Format
## Distilled Java Code
```java
// transformed code
```
### Changes
- <what changed> — <why it's better>
- ...Rules
- Preserve behavior exactly — distilling is refactoring, not rewriting
- Do not add comments, Javadoc, or logging that wasn't there
- Do not add error handling beyond what exists unless the original code has a bug
- Do not introduce new dependencies
- Remove unnecessary blank lines, redundant modifiers, and dead imports
- Use
varwhere the type is obvious from the right-hand side - Use module imports (
import module java.net.http;) over individual type imports when the target JDK supports them - Prefer
void main()overpublic static void main(String[] args)when appropriate - When multiple transformations compete, choose the one that produces fewer lines
- If the code is already clean and modern, say so — don't force changes
- Respect the project's target Java version; do not introduce preview features unless explicitly enabled
Detailed Transformation Catalog
See references/transformations.md for the complete catalog of before/after transformation patterns organized by category.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

