Rebuild a legacy PHP app in TypeScript from agent-written specs

Yuuki Yamashita had Claude Code write cited specs for a 300-line PHP shop, then a second session rebuilt it on AWS from the specs alone. About $47; every hand-checked order total matched.

Done withClaude CodeinAWS· Nov 22, 2026

What they did

Yamashita wrote a small procedural PHP and MySQL shop (7 files, about 300 lines) as a test target, then ran AWS Japan's Reverse Spec Flow workflow on it with Claude Code on Amazon Bedrock. The workflow builds a code graph, writes specs where every statement cites a file and line, and audits them with isolated verifier agents, pausing at three approval gates. A separate Claude Code session answered the gates. Then a fresh Claude Code session that never saw the PHP got only the specs and rebuilt the app in TypeScript on API Gateway, Lambda, DynamoDB and an EventBridge-scheduled stock report written to S3, deployed with the AWS CDK. It was told to log every gap the specs left open.

How it went

The verifiers found 10 errors in the specs across 7 of 20 blocks, such as an incomplete WHERE clause and wrong line numbers, and a second round found none; an adversarial audit then caught 4 more. The specs flagged that the app had no authentication. The rebuild listed 23 open points, passed 36 unit tests, deployed in about 65 seconds, and matched hand-calculated totals, stock restores, error messages and the CSV report. Spec extraction took about an hour and roughly $47, $37 of it in the audit phase, which also hit Bedrock's daily token limit and had to be resumed on a different model.

Worth knowing

The audit phase runs many verifiers in parallel and is what hit the per-model daily token cap on Bedrock; cap concurrency (the author used four). The verifier isolation needs Claude Code 2.1.271 or newer. The author started the rebuild before the audit finished; the intended order is to wait. Costs are Claude Code's own estimates, not the Bedrock bill.

Try it

With Claude Code· 3 parts to fill in

Read [spec workflow instructions file]. The source to analyse is in [path to legacy repo]; treat it as read-only. Write specifications for every module, entry point and external connection, citing file and line for each statement and marking anything the code cannot prove as UNKNOWN. Stop at each phase gate and list the decisions you made for me to approve. Run independent checks of each spec block against the source, at most [number] at a time, and fix what they find until a full round finds nothing. Do not start any rebuild; stop when the final gate passes and report time and cost per phase.

Square brackets are the parts to fill in. The prompt is ours; the story is theirs.

Where they said it

Related