Raw capture โ€” raw/ai-code-migration.md


url: https://claude.com/blog/ai-code-migration title: "How Anthropic runs large-scale code migrations with Claude Code" author: Michael Segner (based on migrations run by Jarred Sumner and engineering teams across Anthropic) date_fetched: 2026-07-25 date_published: 2026-07-16


How Anthropic runs large-scale code migrations with Claude Code

Author: Michael Segner, based on migrations run by Jarred Sumner and engineering teams across Anthropic Published: July 16, 2026 Reading time: 5 min


The central insight: "You fix the process (loop) that produced the code" rather than fixing the code itself.


Two Key Migration Examples

1. Bun (Zig โ†’ Rust) โ€” Jarred Sumner

2. Python โ†’ TypeScript โ€” Mike Krieger


Why AI Changes the Math for Code Migrations

Five reasons cited: 1. The work is parallel โ€” files/crates can be migrated simultaneously 2. Context is clear and comprehensive โ€” old code serves as a spec 3. Built-in referee โ€” existing test suites verify work objectively 4. The queue writes itself โ€” compiler/test failures become the next task 5. Consistency and edge case handling โ€” drift has nowhere to hide; edge-case fixes become rules all agents follow


Six-Step Process

Prerequisites: Build a "Judge"

Step 1 โ€” Create the Rulebook, Dependency Map, and Gap Inventory

Step 2 โ€” Stress-Test the Rules

Step 3 โ€” Translate Everything

Steps 4, 5, 6 โ€” Compile, Run, and Match Behavior


Best Practices

  1. Don't follow the guide blindly โ€” treat it as a starting point and plan your specific migration with Claude first
  2. Don't focus on individual failures โ€” that's the loop's job; human attention belongs on patterns
  3. "Make review adversarial and verification mechanical" โ€” let scripts be the referee
  4. "Don't use the largest model for everything" โ€” smaller models handle high-volume implementation; save largest for reviewers and rule-writers
  5. Front-load the human hours โ€” rulebook and stress test are the most time-consuming parts
  6. Make the work queue mechanical and resumable โ€” "done" means the output file exists on disk

Results of the Bun Migration (Now in Production)


Related Resources