How Anthropic Performs Large-Scale Code Migrations with Claude Code
Key point
Anthropic used Claude Code to complete large-scale code migrations that used to take years in just weeks.
Details
Code migration is a project that ports a production codebase to a new language. It used to be a large-scale undertaking that took years, but now it's possible with AI.
Bun's Zig→Rust Migration: Bun co-founder Jarred Sumner used Claude Code to port one million lines of code to Rust in under 2 weeks. 100% of existing tests passed before the CI merge, and after the merge only 19 regressions occurred, all of which were fixed.
Python→TypeScript Migration of an Internal Tool: Anthropic Labs' Mike Krieger migrated a 165,000-line Python codebase to TypeScript over a single weekend. Compile speed dropped from 8 minutes to 2 seconds, and binary startup speed became 6x faster.
Core Insight: Rather than fixing the code, you need to fix the process (loop) that generates the code.
Why AI Makes Migration Possible:
- Work is parallelizable (can be handled independently by file or crate)
- Context is clear (existing code is the best spec)
- Objective means of verification exist (test suite)
- Compile errors/test failures automatically generate the next task
- Rule violations are detected immediately, so deviations don't accumulate
6-Step Migration Process: Step 1: Write a rulebook, dependency map, and gap list → Step 2: Stress-test the rules → Step 3: Translate everything → Steps 4·5·6: Repeatedly run the implement-review-fix loop
A prerequisite is a strong "judge." It must be a test suite capable of evaluating the original code and the ported code equally. If needed, rewrite tests so they're portable, and validate with an adversarial reviewer.
Cost: The Bun migration consumed roughly $165,000 based on API pricing (5.9 billion input tokens, 690 million output tokens). A project that used to take years is now possible in a matter of weeks, at a cost in the hundreds of thousands to millions of dollars.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.