{"slug": "i-built-a-claude-code-skill-that-scores-your-legacy-java-code-1-100-and-it-to-21", "title": "I built a Claude Code skill that scores your legacy Java code 1–100 and modernizes it to Java 21", "summary": "A two-skill Claude Code plugin designed to analyze and modernize legacy Java 8 codebases to Java 21. The first skill, `/java-modernization-review`, analyzes a Java file and generates a scored report (1–100) across nine dimensions like NPE prevention and thread safety, while the second skill, `/java-modernization-implement`, applies the recommended changes without overwriting the original file. The tool is specifically aimed at developers working on legacy systems or preparing for banking roles, using financial domain examples such as trade processors and FX arithmetic.", "body_md": "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:\ndouble\nfor monetary values → silent FX\nprecision loss in productionorder.getCounterparty().getAccount(\n).getBalance()\n→ NPE in settlementsynchronized\nHashMap → race conditions under\nconcurrent trade loadExecutors.newFixedThreadPool(200)\n→\nbottleneck at peak volumeA two-skill Claude Code plugin that acts as a\nSenior Java Architect:\nSkill 1 — /java-modernization-review\nAnalyzes your Java file, saves a full report to\nanalysis.md\n, and stops.\nYou review it before any code is touched.\nSkill 2 — /java-modernization-implement\nReads analysis.md\n, applies every change,\nwrites *Modern.java\nalongside\nthe original. Never overwrites your file.\nEvery review produces a Before/After score\nacross 9 dimensions (100 points total):\n## Scoring breakdown (100 points total)\n🔴 NPE prevention — 15 pts\n🔴 Monetary precision (BigDecimal) — 15 pts\n🔴 Thread safety — 15 pts\n🟡 Streams & collections — 10 pts\n🟡 Exception handling — 10 pts\n🟡 Modern data carriers (Records) — 10 pts\n🟡 Concurrency model (virtual threads) — 10 pts\n🟡 Modern Java features — 10 pts\n🟢 Financial domain rules — 5 pts\nLegacy code the skill flagged as critical:\n// C1 — NPE: any of these can be null\nreturn order.getCounterparty().getAccount().getB\nalance();\n// C2 — Precision loss on every FX trade\ndouble total = 0.0;\ntotal += t.getAmount() * t.getFxRate();\n// C2 — Precision loss on every FX trade\ndouble total = 0.0;\ntotal += t.getAmount() * t.getFxRate();\n// C3 — Race condition on position updates\nprivate HashMap<String, Double> positionMap = new HashMap<>();\npublic synchronized void updatePosition(String cp, double delta) {\nDouble current = positionMap.get(cp);\npositionMap.put(cp, current == null ? delta : current + delta);\n}\n// C4 — Swallowed settlement failure\n} catch (Exception e) {\n// TODO: handle later\n}\nAfter /java-modernization-implement:\n// C1 fixed — Optional chain, no NPE possible\npublic BigDecimal getCounterpartyBalance(Order order) {\nreturn Optional.ofNullable(order)\n.map(Order::getCounterparty)\n.map(Counterparty::getAccount)\n.map(Account::getBalance)\n.orElseThrow(() -> new IllegalArgumentException(\"Account balance unavailable\"));\n}\n// C2 + C3 fixed — BigDecimal stream + lock-free map\nprivate final ConcurrentHashMap<String, BigDecimal> positionMap = new\nConcurrentHashMap<>();\npublic void updatePosition(String counterparty, BigDecimal delta) {\npositionMap.merge(counterparty, delta, BigDecimal::add);\n}\n// Java 21 — virtual threads\nprivate final ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor();\nWhat it covers — every Java release from 9 to 21\nStep 1 — /java-modernization-review\n→ Analyzes file\n→ Saves analysis.md\n→ Stops and waits for your approvalStep 2 — /java-modernization-implement\n→ Reads analysis.md\n→ Applies every change\n→ Writes *Modern.java (original untouched)\n→ Prints final score + delta\nFull source code and the TradeProcessor example are in the repo:\n👉\nAI-powered Java code modernization skill for Claude Code.\nAnalyzes legacy Java, generates a prioritized upgrade report, scores it 1–100, and applies every change — all inside your editor.\nMigrating Java 8 code to Java 21 is high-value but tedious — every codebase has the same problems:\nThis 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.\nAgain, 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.\nThe 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.\nCurious what scores you're seeing on your own codebases. Drop them in the comments.", "url": "https://wpnews.pro/news/i-built-a-claude-code-skill-that-scores-your-legacy-java-code-1-100-and-it-to-21", "canonical_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_at": "2026-05-21 00:59:53+00:00", "updated_at": "2026-05-21 01:33:13.242003+00:00", "lang": "en", "topics": ["developer-tools", "large-language-models", "artificial-intelligence"], "entities": ["Claude Code", "Java"], "alternates": {"html": "https://wpnews.pro/news/i-built-a-claude-code-skill-that-scores-your-legacy-java-code-1-100-and-it-to-21", "markdown": "https://wpnews.pro/news/i-built-a-claude-code-skill-that-scores-your-legacy-java-code-1-100-and-it-to-21.md", "text": "https://wpnews.pro/news/i-built-a-claude-code-skill-that-scores-your-legacy-java-code-1-100-and-it-to-21.txt", "jsonld": "https://wpnews.pro/news/i-built-a-claude-code-skill-that-scores-your-legacy-java-code-1-100-and-it-to-21.jsonld"}}