modernize-java
FreeNo executable scriptsNot checkedUpdate Java code to modern language features — records, switch expressions, pattern matching, virtual threads, sealed classes, text blocks, and current…
by kousen★ 351 GitHub starsAbout this skill
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)
Constraints
- Don't change behavior — preserve the public API and observable semantics.
- Don't apply
varwhere the inferred type would harm readability (e.g., factory results that could be any of several types). - If the project's target Java version is below 21, skip the 21+ features and note it in your summary.
- Run the test suite after non-trivial changes; if tests don't exist, surface that as a follow-up rather than as a blocker.
Install modernize-java in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the modernize-java skill do?
Update Java code to modern language features — records, switch expressions, pattern matching, virtual threads, sealed classes, text blocks, and current collection idioms. Triggers on Java source files.
How do I install the modernize-java skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the modernize-java skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic