S2 Factory rewrites a 10-year-old, almost untested 100,000-line Perl e-commerce backend in TypeScript with Claude Code: one week to write, 379 rounds of 20-agent parity audits, 800+ bugs fixed
S2 Factory's backend engineer describes rewriting a company's e-commerce backend, written in Perl and running for over 10 years with almost no automated tests and no specifications, into TypeScript. The system covered authentication, orders, payments, reservations, LINE integration and coupons across 133 API endpoints, about 100,000 lines. He built a Claude Code custom slash command, /migrate-endpoint, that takes a Perl controller path, reads related models, entities and DB schemas, and generates the TypeScript implementation and tests together; implementation took about one week. Because Perl silently treats undefined values as empty strings or zeros and handles time zones and number/string conversion differently, he built a second command, /parity-audit, that launches 20 agents in parallel per round, each checking the Perl and TypeScript code from a different angle (request-to-response paths, DB queries and NULL handling, payments and tax, authentication and sessions, date/time, encryption, barcodes), fixing discrepancies as bugs and adding tests. The rule was to keep running until 10 consecutive rounds found zero discrepancies; it ran including overnight for 2.5 months: 379 rounds and over 800 bugs fixed, some of them long-standing bugs in the original Perl. The migrated system has 1,419 passing tests, and a final manual end-to-end test through the real frontend (orders, payments, reservations) found no bugs. Project rules lived in CLAUDE.md, which grew as the migration went on. He puts the whole project at 3 months against what he says would normally take a year.
The numbers (as reported)
| Codebase | About 100,000 lines of Perl, 133 API endpoints, 10+ years in production, almost no automated tests |
|---|---|
| Implementation with /migrate-endpoint | About one week |
| Parity audit | 20 agents in parallel per round, 379 rounds over 2.5 months (until 10 consecutive clean rounds) |
| Bugs found and fixed | Over 800 |
| Tests after migration | 1,419 (all passing) |
| Manual E2E test through the frontend | No bugs found |
| Total project | 3 months (author says it would normally take a year) |
Facts
- Company / subject
- S2 Factory (unnamed e-commerce client)
- Tools
- Claude Code
- Codebase
- brownfield
- Work type
- Language port
- Stack
- Perl, TypeScript
- Published
- 2026-06-02
- Last checked
- 2026-11-26
What the source claims Practitioner (own blog/paper)
Claimed by the builder, writing about their own work. Not checked independently.
- Claude Code wrote the TypeScript implementation of 133 endpoints, about 100,000 lines, in about one week ~100,000 lines, ~1 week
- 379 rounds of parity audits found and fixed over 800 bugs, including old bugs in the Perl original 379 rounds, 800+ bugs
- The codebase went from almost no tests to 1,419 passing tests 1,419 tests
- Final human E2E testing through the frontend found no bugs 0 bugs in manual E2E
- Completed in 3 months a migration the author says would normally take a year 3 months vs ~1 year (author's estimate)
Caveats
First-person post by the engineer who did the work, on the note account of S2 Factory, which ends by inviting readers to consult them on legacy migrations. The client company and site are not named. The "normally a year" baseline is the author's own estimate. The author says he did not read all 100,000 lines and relied on AI verification plus a final manual E2E pass. No model, token or cost figures are given. The original post is in Japanese; fields here are from note's English translation of it.
More stories by tool: Claude Code
Related topics: Language portsBrownfield codebases