cd /news/developer-tools/stop-letting-claude-code-hallucinate… · home topics developer-tools article
[ARTICLE · art-89900] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Stop Letting Claude Code Hallucinate Your Modernization: Write OpenRewrite LST Recipes Instead

A developer argues that using autonomous AI agents to directly rewrite large Java codebases is risky, and instead recommends using Claude Code CLI to author deterministic OpenRewrite LST recipes for large-scale migrations like JDK 26 upgrades. The approach involves generating type-safe recipes with Claude Code, validating them against OpenRewrite's type-attribution engine, and executing them via the rewrite-maven-plugin for reproducible diffs.

read1 min views1 publishedAug 10, 2026

#

Stop Letting Claude Code Hallucinate Your Modernization: Write OpenRewrite LST Recipes Instead

Letting autonomous AI agents directly rewrite million-line Java monoliths is a dangerous game of Russian roulette with silent runtime bugs. The real way to execute large-scale JDK 26 upgrades is using Claude Code CLI to author deterministic OpenRewrite LST recipes—not blindly edit source files.

Want to go deeper? javalld.com — machine coding interview problems with working Java code and full execution traces.

#

Why Most Developers Get This Wrong

  • Yolo-prompting Claude Code CLI to edit hundreds of .java

files directly, introducing non-existent API calls and broken imports.

  • Treating OpenRewrite Lossless Semantic Trees (LST) like naive regex text manipulation instead of type-attributed AST structures.
  • Relying on LLM self-correction loops to fix hallucinated method signatures instead of relying on the Java compiler.

#

The Right Way

Use Claude Code CLI to generate, unit-test, and refine type-safe OpenRewrite Java recipes, then let rewrite-maven-plugin execute them deterministically.

  • Prompt Claude Code to extend org.openrewrite.java.JavaVisitor

targeting specific legacy patterns (e.g., Spring Boot 3+ or Jakarta EE migrations).

  • Validate recipe execution against OpenRewrite's type-attribution engine to guarantee zero semantic drift across your codebase.
  • Execute the generated recipe via mvn rewrite:run

in a clean CI container for 100% reproducible diffs.

  • Isolate LLM non-determinism to the recipe authoring phase—keep your production target repo completely deterministic.

#

Show Me The Code (or Example) Prompt Claude Code CLI to generate this exact imperatively-safe recipe structure:

#

Key Takeaways

  • LLMs generate logic; deterministic AST engines transform code—never confuse the two responsibilities.
  • Generating OpenRewrite recipes via Claude Code gives you compiler-backed type safety across enterprise-scale Java migrations.
  • If an AI-driven refactor isn't backed by a Lossless Semantic Tree parser, it belongs nowhere near your production monolith.
── more in #developer-tools 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/stop-letting-claude-…] indexed:0 read:1min 2026-08-10 ·