modernize-java
Installation
SKILL.md
Modernize Java Code
Update the target code to use modern Java features:
- Records instead of mutable POJOs where the type is a value carrier
- Switch expressions with arrow syntax and exhaustiveness checking
- Pattern matching for
instanceofandswitch - Local variable type inference (
var) where it helps readability - Virtual threads (Java 21+) for I/O-bound operations —
Executors.newVirtualThreadPerTaskExecutor() - Sealed classes when the type hierarchy is closed
- Text blocks for multiline strings
- Sequenced collections (Java 21+) where ordered access matters
- Collection factory methods (
List.of,Map.of,Map.entry)