Anthropic's Code Migration Kit Rewrote a Million Lines in 11 Days
Anthropic open-sources the exact playbook behind Bun's 1M-line Zig-to-Rust rewrite: prompts, scripts, and a six-step process for total language migrations.
PRO- Anthropic open-sourced the Code Migration Kit, a repo of prompts, scripts, and templates for running total language migrations with Claude Code.
- The kit is battle-tested: Bun's 1M+ line Zig-to-Rust rewrite used this exact methodology, completed in 11 days with 64 parallel Claude agents for ~$165,000.
- Six-step process covers feasibility, rulebook creation, stress-testing, parallel translation, compilation, and behavior matching — each with a gate before the next step begins.
- Adversarial review topology is the key design: implementer agents and reviewer agents are fully separated, with reviewers instructed to assume the code is wrong.
- Not for incremental migrations — the kit is designed for total moves where the old language is deleted; JS-to-TS and similar incremental upgrades don't need it.
- Known tradeoff: the Bun rewrite produced 13,044 unsafe Rust blocks vs. ~73 in comparable hand-written Rust, highlighting the safety debt that comes with AI-speed translation.
Language migrations are the kind of project that engineering teams defer for years. The codebase is too big, the risk is too high, and the timeline is too long to justify freezing feature work. Anthropic just published the exact process they used to change that calculus, releasing the Code Migration Kit as a free, open-source repo containing the prompts, scripts, and templates behind their large-scale migration methodology.
The proof of concept already shipped
This kit is not theoretical. Bun, acquired by Anthropic in December 2025, merged a roughly one-million-line pull request converting its entire Zig codebase to Rust, completed in six days with Claude acting as the primary coding agent across 6,755 commits. To put the scale in perspective, rewriting 500,000 lines of Zig into another language would be a gargantuan undertaking if done by hand. "A rewrite in another language would take a small team of engineers a full year. It would mean freezing bugfixes, security fixes or feature development for that time," Bun's creator Jarred Sumner wrote.
Instead, Sumner spun up about 50 dynamic Claude Code workflows, reaching a peak of about 1,300 lines of code per minute and generating over a million lines of Rust code. The job took 11 days and cost about $165,000 at API pricing. In 2,000-build stress tests, the Rust version reduced memory usage from 6.7GB to 609MB, improved performance by 2% to 5%, and shrank binary size by roughly 20%.
What the kit actually contains
The repo is structured around a six-step process. Each step has a corresponding prompt file you paste into Claude Code, and the process is designed so that stopping at any gate is free and resuming is just a re-invocation. Here is what ships in the box:
- prompts/ , Eight paste-ready prompts, from a feasibility check (prompt 00) through post-parity cleanup (prompt 06)
- templates/ , A
RULEBOOK.mdtemplate, aninventory.tsvfor tracking language-specific gaps, and asettings.jsonthat locks down expensive operations during translation - scripts/ , Dependency mappers for Python, JS/TS, and C headers; a queue runner; a manifest builder; and a build daemon
This story is for Pro members
You've reached the end of the free preview. Upgrade to AlphaSignal Pro to read the full article - and everything else behind the paywall.