Overview
Use Claude Code with Anthropic's code modernization plugin to upgrade or rewrite legacy scientific code and compare old and new outputs on identical inputs within tolerances you set.
Problem or Objective
- Which agents port code to another language or framework?
- Which agents write or run tests against an application?
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- Claude Code
- Prerequisites
- Claude Code with the code modernization plugin, the legacy code, a way to run it or recorded reference outputs, and the tools to build the new version.
How It Works
Install the plugin with /plugin install code-modernization@claude-plugins-official and point it at the legacy code; its README says commands write to analysis and modernized folders. Run the early steps, check the extracted rules and approve a plan before anything is built. Gather reference inputs, including awkward cases, with the outputs the old program or trusted published results give, and decide the floating-point tolerances yourself. Build one module, then run modernize-verify, ideally in a fresh session, and read the verdict, the differences and any masked fields. Accept a difference only with a written reason, and have someone who knows the science sign off before the new code produces results you use.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Claude Code.
- Connect the toolsConnect the tools this workflow relies on: Claude Code.
- Check the prerequisitesClaude Code with the code modernization plugin, the legacy code, a way to run it or recorded reference outputs, and the tools to build the new version.
- Gather your detailsCollect what the prompt asks for: Legacy code folder, Target, First module, Reference inputs, Numeric tolerance.
- Run the starter promptPaste the starter prompt below into Claude Code and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at github.com before you rely on it.
Practical Starter Prompt: Plan a verified modernization
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
Using the code modernization plugin, assess the legacy code at [Legacy code folder] for a move to [Target]. Write the plan and the rules you extracted, and wait for my approval before building anything. Start with only [First module]. For verification, run old and new code on the same inputs from [Reference inputs], compare numeric output within [Numeric tolerance], list every masked field and every difference, and say plainly what could not be run. Never edit the legacy source, use production data or accept a difference on my behalf.Approve the plan before the build, set tolerances yourself, and have a domain expert review every accepted difference.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. A newsletter article introduces the plugin with scientific codebases in mind, and the plugin README describes running old and new code on the same inputs, declared tolerances and an approval gate. Neither cited page shows a validation of your code, and the article does not report a validation run of its own.
Limitations and Considerations
A passing comparison covers only the inputs and fields compared, so scientific validity still needs an expert. The README says that if the old system cannot run where you work, only recorded outputs can be compared and the best verdict is partly proven. Work on a copy, confirm that the deny rule protecting the source is in place, and treat unfamiliar legacy code as untrusted. Some steps run many agents, so check cost. The plugin README also describes usage counts sent through Claude Code telemetry; check your settings. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Tool Repository
A tool this workflow relies on.
Official Website
The official site of the main tool or project in this use case.
Visit Website (opens in a new tab)code.claude.com
Related Videos
About anthropics/claude-code
The SECRET Claude Code Upgrade That Has Everyone Going Nuts (Full Guide) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)About anthropics/claude-code
The only Claude Code guide you'll ever need (Opus 4.5) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- anthropics/claude-plugins-official: plugins/code-modernization/README.md (opens in a new tab)
Project documentation · github.com · Undated · Source checked 2 Dec 2026, 17:27 UTC
What this source supports
- Where the legacy code can run, both run on the same inputs and a script compares every byte.
- Only fields that must vary (timestamps, generated ids) are masked, floating-point output can be compared within a declared tolerance, and every masked field is listed in the result.
- Nothing is built until you approve it.
- Rewriting Scientific Software with Agents (opens in a new tab)
Project documentation · blog.stephenturner.us · Undated · Source checked 2 Dec 2026, 16:40 UTC
What this source supports
- There’s a verification step that compares old and new implementations on identical inputs, with declared tolerances for floating-point results.
- Overview - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 2 Dec 2026, 13:21 UTC
What this source supports
- Claude Code is an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools.

