Port Prettier to Rust and replay 17,224 recorded runs after every change

u/erkamyaman had Claude Code port Prettier to about 36,500 lines of Rust in roughly 17 hours; all 17,224 recorded runs match byte for byte and the CLI got 19x faster.

Done withClaude Code· Nov 19, 2026

What they did

The poster built rust-anything, an open source tool that adds an MCP server and a skill to Claude Code for rewriting an app in Rust while proving behaviour stays the same. To test it on something large, they pointed Claude Code at Prettier. The agent first recorded 17,224 real Prettier runs taken from its test fixtures, common options, real repositories and config files. It then put a Rust entry point in front of Prettier and replaced the JavaScript piece by piece. After each change it replayed every recorded run, and any single byte of difference meant the step was not done. The skill tells the agent to stop and ask after three edits that make no progress, and forbids it from editing the recordings.

How it went

The run took about 17 hours and produced roughly 36,500 lines of Rust covering ten languages, including JS, TS, JSON, YAML, Markdown and CSS. All 17,224 recorded runs match Prettier's output exactly. Formatting 2,360 JS and TS files through the CLI dropped from 128.6 seconds to 6.9 seconds. The poster is open that 8.1 percent of cases still fall back to the original Prettier. The port lives in the repo as a demo and is not published as a package.

Worth knowing

The match rate is measured against the poster's own recordings, so it covers only what was recorded. A commenter asked which model was used and what 17 hours cost; the post does not say. The poster is also the tool's author, and version 2.0 adds a check for side effects, such as an email being sent twice, that output comparison alone would miss.

Try it

With Claude Code· 3 parts to fill in

Rewrite [this app or library] in [Rust] without changing its behaviour. First record a large set of real runs of the current version: [its test fixtures, common options, real inputs], saving the exact output and side effects of each. Never edit those recordings. Then put a Rust entry point in front of the existing code and replace it one piece at a time. After every change, replay all recorded runs; any byte of difference means the step is not done and the mismatch is a bug in the port. Keep a fallback to the original code for anything not yet ported. If three edits in a row make no progress, stop and ask me. Report the match count, the speed difference and the share of cases still falling back.

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

Where they said it

Related