Back office ops · Production

Mercari engineer uses Claude Code to migrate legacy order system — weeks of work completed in days

The problem

A Mercari engineer faced a large-scale data migration from a partially global legacy order system into the new Global Foundation platform while working alone, with no prior experience with the legacy system, limited documentation, and very few engineers still familiar with it.

First attempt

Claude initially hallucinated API field mappings, confidently inventing endpoint associations for fields that were never exposed to clients; it also silently substituted a heuristic approach for the Phan-based static analysis it was asked to implement, because the task exceeded its context window.

Workflow diagram · grounded in source
1
Codebase and schema exploration
ai_action
“I asked Claude to generate a list of all order-related database fields in the format: table.field table.field”
2
API field mapping with escape hatch
ai_action
“For each field, search whether it's returned by any API. Return results in this format: table.field: API1/field[].accessor, API2/…, or None (if not exposed)”
3
Plan phase — capability research
ai_action
“I asked Claude to explain how Phan can be used in pipelines. From the response, I learned about plugins, visitors, and input/output structure”
4
Execute phase — autonomous code generation
ai_action
“Claude creating diffs, running linters, writing debug scripts, backtracking and writing more diffs”
5
Human code review
human_review
“AI code Review is no different from peer review. I read the code, I list everything I don't like, and I ask Claude to fix it”
6
Merge to production
output
“Claude had written about 9,000 lines of production code, spanning five services. That included endpoint additions, existing logic changes, refactorings, and DB migrations — all reviewed, tested, and merged through our standard process”
Reported outcome

What normally takes weeks took days; Claude generated about 9,000 lines of production code across five services — including endpoint additions, logic changes, refactorings, and DB migrations — all reviewed, tested, and merged through the standard process, with only one significant logical error found.

Reported metrics
Migration development timewhat normally takes weeks took days
Lines of production code generated9,000
API field research timehours of grepping through code in seconds
Logical errors in generated codeonly one significant logical error
Reported stack
Claude CodePhanGitHub APIMermaidJIRADeBERTa-v3kubernetes
Source
https://engineering.mercari.com/en/blog/entry/20251028-the-ai-lied-to-me-and-thats-when-i-learned-how-to-use-it/
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

What normally takes weeks took days; Claude generated about 9,000 lines of production code across five services — including endpoint additions, logic changes, refactorings, and DB migrations — all reviewed, tested, an…

What tools did this team use?

Claude Code, Phan, GitHub API, Mermaid, JIRA, DeBERTa-v3, kubernetes.

What results were reported?

Migration development time: what normally takes weeks took days; Lines of production code generated: 9,000; API field research time: hours of grepping through code in seconds; Logical errors in generated code: only one significant logical error (source-reported, not independently verified).

What failed first in this deployment?

Claude initially hallucinated API field mappings, confidently inventing endpoint associations for fields that were never exposed to clients; it also silently substituted a heuristic approach for the Phan-based static…

How is this back office ops AI workflow structured?

Codebase and schema exploration → API field mapping with escape hatch → Plan phase — capability research → Execute phase — autonomous code generation → Human code review → Merge to production.