# I built a Claude Code skill that scores your legacy Java code 1–100 and modernizes it to Java 21

> Source: <https://dev.to/santosh_ravitejagoteti_/i-built-a-claude-code-skill-that-scores-your-legacy-java-code-1-100-and-modernizes-it-to-java-21-2jee>
> Published: 2026-05-21 00:59:53+00:00

If you're working on a Java 8 codebase — or trying to break into banking and legacy system roles — this article is for you. Every Java 8 codebase has the same problems. You know they exist, but finding and fixing them across 50,000 lines is slow:
double
for monetary values → silent FX
precision loss in productionorder.getCounterparty().getAccount(
).getBalance()
→ NPE in settlementsynchronized
HashMap → race conditions under
concurrent trade loadExecutors.newFixedThreadPool(200)
→
bottleneck at peak volumeA two-skill Claude Code plugin that acts as a
Senior Java Architect:
Skill 1 — /java-modernization-review
Analyzes your Java file, saves a full report to
analysis.md
, and stops.
You review it before any code is touched.
Skill 2 — /java-modernization-implement
Reads analysis.md
, applies every change,
writes *Modern.java
alongside
the original. Never overwrites your file.
Every review produces a Before/After score
across 9 dimensions (100 points total):
## Scoring breakdown (100 points total)
🔴 NPE prevention — 15 pts
🔴 Monetary precision (BigDecimal) — 15 pts
🔴 Thread safety — 15 pts
🟡 Streams & collections — 10 pts
🟡 Exception handling — 10 pts
🟡 Modern data carriers (Records) — 10 pts
🟡 Concurrency model (virtual threads) — 10 pts
🟡 Modern Java features — 10 pts
🟢 Financial domain rules — 5 pts
Legacy code the skill flagged as critical:
// C1 — NPE: any of these can be null
return order.getCounterparty().getAccount().getB
alance();
// C2 — Precision loss on every FX trade
double total = 0.0;
total += t.getAmount() * t.getFxRate();
// C2 — Precision loss on every FX trade
double total = 0.0;
total += t.getAmount() * t.getFxRate();
// C3 — Race condition on position updates
private HashMap<String, Double> positionMap = new HashMap<>();
public synchronized void updatePosition(String cp, double delta) {
Double current = positionMap.get(cp);
positionMap.put(cp, current == null ? delta : current + delta);
}
// C4 — Swallowed settlement failure
} catch (Exception e) {
// TODO: handle later
}
After /java-modernization-implement:
// C1 fixed — Optional chain, no NPE possible
public BigDecimal getCounterpartyBalance(Order order) {
return Optional.ofNullable(order)
.map(Order::getCounterparty)
.map(Counterparty::getAccount)
.map(Account::getBalance)
.orElseThrow(() -> new IllegalArgumentException("Account balance unavailable"));
}
// C2 + C3 fixed — BigDecimal stream + lock-free map
private final ConcurrentHashMap<String, BigDecimal> positionMap = new
ConcurrentHashMap<>();
public void updatePosition(String counterparty, BigDecimal delta) {
positionMap.merge(counterparty, delta, BigDecimal::add);
}
// Java 21 — virtual threads
private final ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor();
What it covers — every Java release from 9 to 21
Step 1 — /java-modernization-review
→ Analyzes file
→ Saves analysis.md
→ Stops and waits for your approvalStep 2 — /java-modernization-implement
→ Reads analysis.md
→ Applies every change
→ Writes *Modern.java (original untouched)
→ Prints final score + delta
Full source code and the TradeProcessor example are in the repo:
👉
AI-powered Java code modernization skill for Claude Code.
Analyzes legacy Java, generates a prioritized upgrade report, scores it 1–100, and applies every change — all inside your editor.
Migrating Java 8 code to Java 21 is high-value but tedious — every codebase has the same problems:
This skill acts as a Senior Java Architect in your Claude Code session. It knows every Java feature from 8 through 21, enforces financial-domain safety rules, and produces code you can ship — not just advice.
Again, if you're working on a Java 8 codebase — or trying to break into banking and legacy system roles — this repo is built for you.
The financial domain examples are intentional: trade processors, FX arithmetic, position maps, settlement logic. That's the code you'll actually face in banking interviews and on the job. Practice modernizing it here before you touch production.
Curious what scores you're seeing on your own codebases. Drop them in the comments.
