# rust-anything: rewrite an app in Rust, checked step by step (erkamyaman/rust-anything) — skill card for AI agents

> AgentGid skill card. Checked on 2026-11-23 against commit d964bdc (version 3.2.0).
> Every fact comes from the pack's own files at that commit. Numbers marked "as reported" are the author's.
> Human page: https://agentgid.com/skills/erkamyaman/rust-anything/

## Explain it to a non-programmer
Your AI coding assistant moves your app, or only its slow part, to the Rust language one piece at a time. A separate free tool first records what your current app does. Every piece the assistant rewrites is then checked against that recording, and it counts as done only when all checks pass.

## Who it is for
- You want an app or a slow command rewritten in Rust and want proof it still behaves the same
- Your code is in TypeScript or JavaScript, Python, C, Go, Ruby or Java
- You want a plan of what to move first before any code changes
- You use Claude Code, Codex, Cursor, Gemini CLI or OpenCode
- Not for: You need a PHP or C# app ported piece by piece: today those get recording, replay and a Rust front door only
- Not for: You want the tool itself to translate code: the assistant (or you) writes the Rust

## What it is
- Kind: scripts, command
- License: MIT
- Repository: https://github.com/erkamyaman/rust-anything

## What it does
- Profile: run a real workload and find where the time goes (only when the goal is speed)
- Plan: list the pieces, the best first ones, the ones that stay and the ones that are blocked; stop for approval
- Bridge: make a small Rust project for one piece so the rest of the app calls it the same way
- Record: run the original on many generated and real inputs and save what it returns or throws
- Port: the assistant writes the Rust for that piece only
- Prove: build, compare every recorded case, compare speed
- Ship safely: run Rust beside the original and report differences, or switch the piece on in place
- Gate: formatting, lint, tests, no unsafe code without a reason, every case matching; then report and wait
- Never cuts: a mismatch is fixed in the port, never in the recording; a tolerance is never widened to hide a mismatch

## Skills
| Skill | Call | Changes code? | In plain words |
|---|---|---|---|
| rust-anything | plain language ("Rewrite this CLI in Rust with rust-anything ..."), or the rust-anything CLI / MCP tools | yes | Moves one piece of your app at a time to Rust and checks it against the original |
| rust-anything (whole app, whole-app.md) | plain language ("Rewrite this CLI in Rust with rust-anything, end to end") | yes | Turns a whole command line tool, web server or library into a standalone Rust app, step by step |
| go (only the slow part) | rust-anything go -- <command that runs your app> | yes | Finds the one function that takes the time and moves only that to Rust |

### rust-anything
- Asks for: The project folder
- Asks for: What you want: the whole app in Rust, a migration plan, or one slow command faster
- Asks for: A command that runs a real workload, when the goal is speed
- Asks for: Your approval of the plan and of each next piece
- Asks for: Real inputs the code sees, when generated ones are not enough
- Gives: A plan: best first pieces, order, pieces that stay, blocked pieces and why
- Gives: A Rust project per piece under rust/
- Gives: A recording of the original's behavior (cases.jsonl)
- Gives: Match counts, a speed comparison with a verdict, and gate results
- Gives: REPORT.md and card.svg with measured numbers for a pull request
- Say: "Plan a migration of src/parser/ to Rust with rust-anything; port the first unit and prove it."

### rust-anything (whole app, whole-app.md)
- Asks for: Answers to rounds of numbered questions (shape, scope, how exact the match must be, what must stay compatible, targets, checkpoints, cutover)
- Asks for: Database reset and dump commands, when the database is not a local file
- Asks for: The go-ahead at each checkpoint and for the cutover
- Gives: rust/MAP.md, DECISIONS.md, GLOSSARY.md and HANDOFF.md that carry the work between sessions
- Gives: Research notes per dependency in rust/research/
- Gives: A Rust front door that hands unported work to the original
- Gives: A pure Rust app after the lift, checked against the recording
- Gives: rust/cutover.sh: a script that walks you through the steps only you can do
- Say: "Rewrite this CLI in Rust with rust-anything, end to end, and prove it behaves the same."

### go (only the slow part)
- Asks for: A command that is too slow
- Gives: A TASK.md for the assistant
- Gives: The function switched to Rust only when every case matches, gate passes and it is not slower
- Say: "This search feels slow. Profile it with rust-anything and move the hot loop to Rust."

## Know before installing
- The skill is a guide for the assistant; the work is done by a separate rust-anything program you install first (cargo or npm). The plugin alone does not include it.
- Recording runs your original code many times on generated inputs. Code that writes files, uses a database or calls the network does that once per case: the author says to use a copy of the project, a test database and no production keys.
- rust-anything setup changes settings files in your home folder for every agent it finds (for example ~/.claude.json, ~/.codex/config.toml, ~/.cursor/mcp.json) and copies the skill into their skills folders. It saves a .rust-anything.bak copy first; setup --remove undoes it.
- Switching a finished piece on in place edits your source files; the skill tells the assistant to ask you first, and disable puts the original back byte for byte.
- It can only catch what the recording covers.

## Install (official commands)
- Any agent (CLI + setup): `cargo install rust-anything` && `rust-anything setup` — setup registers the MCP server with Claude Code, Codex, Cursor, Gemini CLI and OpenCode and installs the skill where the agent reads skills. Restart the agent afterwards. Without Rust: npm install -g rust-anything, or a prebuilt binary from the GitHub releases. Remove: `rust-anything setup --remove && cargo uninstall rust-anything`.
- Claude Code (plugin): `/plugin install rust-anything --marketplace erkamyaman/rust-anything` — The plugin brings the MCP server entry and the skill; the CLI must already be on your PATH.
- Codex (plugin): `codex plugin marketplace add erkamyaman/rust-anything` && `codex plugin add rust-anything@rust-anything` — Same plugin with the skill and MCP server; the CLI must be on your PATH.
- Any other MCP client: Add rust-anything mcp as a stdio server by hand (for one project: .mcp.json).

## What runs on the user's machine
- Code on the machine: yes (the rust-anything CLI / MCP server the skill drives (the skill files are markdown))
- Network: optional
- Plugin install: Two markdown files (SKILL.md, whole-app.md) and an MCP entry that starts the local rust-anything mcp command. No hooks.
- rust-anything setup: Edits each found agent's settings file in your home folder and copies the skill into ~/.claude/skills, ~/.codex/skills or ~/.config/opencode/skills; saves <file>.rust-anything.bak first.
- record, diff, gate, app record, app replay: Runs your original code (or whole app) on many generated inputs; app record runs every case twice. Side effects of your code happen once per case.
- bridge / build: Writes Rust projects under <repo>/rust/ and builds them with cargo; Cargo downloads crates.
- enable: Adds one marked block to your original TS/JS or Python files; disable removes it byte for byte.
- go --agent claude / codex: Starts another agent process headless with edits allowed (Claude: acceptEdits with cargo and rust-anything commands; Codex: exec --full-auto). The skill tells your assistant not to pass --agent.
- Network: The tool sends none of your code or results anywhere and has no telemetry. Network use comes from Cargo, your package managers, and cargo deny / cargo audit in gate when installed.

## Settings
- `RUST_ANYTHING_MODE`: shadow (default) returns the original's results and reports Rust mismatches; new switches to Rust; old turns Rust off
- `RUST_ANYTHING_UNIT_<NAME>`: original runs the original for one unit

## Examples (from the pack's own files)
- The question format for a whole-app port: output format defined in skills/rust-anything/whole-app.md
- A decision record (ADR) in rust/DECISIONS.md: output format defined in skills/rust-anything/whole-app.md

## Author's numbers (as reported, not run by AgentGid)
- Prettier 3.6.2 on 2,360 JS/TS files from the command line: 128.6 s for the original, 6.9 s with the Rust port (Apple M4, two runs each, every output compared before timing). Source: erkamyaman/rust-anything/README.md
- json-server as one Rust binary: 3.5 MB memory at idle vs 74 MB; 514/514 recorded HTTP cases match. Source: erkamyaman/rust-anything/README.md
- Fuse.js search over 50,000 strings: 91.2 ms per query for the original, 2.8 ms with the Rust port. Source: erkamyaman/rust-anything/README.md
- Calling Rust once per small function is usually slower than a JIT; against C the gain is safety, not speed. Source: erkamyaman/rust-anything/README.md

## Steps only the person can do
- Restart the agent after rust-anything setup (README.md (Quick start)) Then: The MCP tools and the skill are available
- Approve the plan and each next unit; answer the whole-app questions; decide the cutover (skills/rust-anything/SKILL.md, skills/rust-anything/whole-app.md) Then: The agent ports the approved unit
- Run rust/cutover.sh for deploys, DNS, secrets and switching production traffic (skills/rust-anything/whole-app.md (section 7)) Then: The original stays in place as reference until you say otherwise

## Mistakes to avoid
- Not: Install only the plugin and expect the tools to work. Instead: Install the rust-anything CLI first (cargo or npm), then the plugin or rust-anything setup. Why: The plugin only points to the rust-anything command; it does not ship it
- Not: Run record or replay in the live project with production settings. Instead: Use a copy of the project, a test database and no production credentials. Why: The original code runs once per case, with all its side effects
- Not: Edit the recording to make a mismatch go away. Instead: Fix the port; for an intended difference, ask the user and add a line to known-diffs.jsonl. Why: The recording is the proof of behavior
- Not: Port a tiny function that is called once per item, for speed. Instead: Port it with its callers, or batch it (--batch). Why: One call into Rust costs more than the work, and JITs run it in nanoseconds
- Not: Plan a piece-by-piece PHP or C# port. Instead: Use record, replay and the front door only, and tell the user unit ports are not supported yet. Why: bridge does not take PHP or C# units yet

## What leaves the machine
- Package requests (crate names and versions) when a port is built → crates.io through Cargo, and the package registries of your app's language, build, gate and other steps that compile a port or install what the original needs. Opt out: No opt-out while porting; this is how Rust builds fetch their dependencies
- A download of the RustSec advisory database → RustSec (via cargo deny or cargo audit), gate, only when cargo deny or cargo audit is installed. Opt out: Do not install cargo deny / cargo audit

## Lines in the pack aimed at agents (ask the person first)
- "if `rust-anything` is not installed, ask the user
to install it (`cargo install rust-anything`)" (skills/rust-anything/SKILL.md): Global install of a CLI; the skill already says to ask the user. Then rust-anything setup edits settings files in the home folder for every agent it finds.
- "Install rust-anything: run `cargo install rust-anything`, then `rust-anything setup`." (README.md): A paste-in prompt asking the agent to install a global tool and change agent settings; confirm with the person first.
- "and send subagents for the rest." (skills/rust-anything/whole-app.md): The whole-app flow sends background subagents for research and parallel unit ports; this costs more tokens.

## May I use it like this?
- commercial-app: yes (MIT: keep the license notice)
- redistribute-files: yes (MIT: keep the copyright and permission notice in copies)
- client-work: yes (Generated ports in your repository are yours, per the README)

## Which one to pick
- If You want code moved to Rust and checked against the original's recorded behavior: skill:erkamyaman/rust-anything
- If You want a general plan-test-review workflow for any coding task, not a language migration: skill:obra/superpowers
- If You want the agent forced to write tests first on every change: skill:nizos/tdd-guard

## Works well with
- agent:claude-code: Plugin and setup target Claude Code (MCP server and skill)
- agent:openai-codex: Codex plugin from the repo's marketplace, or setup
- tool:maturin: The author's packaging guide ships Python ports as maturin wheels

## Works in and needs
- Works in Claude Code: plugin, or setup (MCP server + skill)
- Works in Codex: plugin, or setup (MCP server + skill)
- Works in Cursor: MCP server
- Works in Gemini CLI: MCP server
- Works in OpenCode: MCP server + skills folder
- Works in Any MCP client: MCP server (stdio)
- Needs rust-anything CLI: The skill and MCP server run it
- Needs Rust toolchain (cargo): Builds the ports; also the default way to install the CLI
- Needs Runtime of the source language: record, diff and bench run the original: Node 22.6+, Python 3.9+, Go 1.21+, Ruby 3+, JDK 17+, a C compiler for C
- Needs Node 24+ for profiling Node code: profile needs --cpu-prof in NODE_OPTIONS

## How to tell it works
Install the CLI and run setup, restart your assistant, then on a copy of your project say "Plan a migration of src/parser/ to Rust with rust-anything". It should show a plan with the best first pieces and stop to wait for your approval.

## Related
- napi-rs/napi-rs
- PyO3/pyo3
- wasm-bindgen/wasm-bindgen

## Safety
Run recording and checks on a copy of the project with a test database and no production keys, because your original code runs once per case. The skill files are instructions your assistant follows: read them before installing.
