Skip to content

Migrate Legacy Code to Safe Rust

Guides an agent through porting legacy C++, Fortran, Java, Python or C code to safe, optimized Rust with telemetry.

Repository
google/skills
Stars
21,782
Licence
Apache-2.0
Files
3 files

What it does

Once installed, the agent follows a staged playbook to take an existing codebase from a GitHub URL or local folder and port it to Rust. It first records baseline measurements of the legacy code, then writes an architecture plan, implements a Rust version with tests and output-parity checks, and optionally applies profile-guided optimization. It logs timings and results to a JSON file via a bundled Python script and can produce a written report and an HTML summary page.

Great for

  • Engineers planning or running a migration of a legacy C++, Fortran, Java, Python or C project to Rust
  • Teams who want measured before-and-after benchmarks and a documented parity check against the original program

Skip it if

  • Quick one-off Rust syntax questions or small unrelated refactors, which the skill itself says it should not be used for
  • Running untrusted cloned repositories without review: the skill executes cloned build and run commands after confirmation, which can run arbitrary code from that repo

Try asking

  • “Migrate this C++ repo at github.com/example/solver to safe Rust and benchmark it against the original”
  • “Port the Fortran code in ./physics_sim to Rust and check output parity across 10 random seeds”
  • “Audit my legacy Python data pipeline and produce a Rust architecture blueprint”
Step-by-step guide: how to use Migrate Legacy Code to Safe RustInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 3 original files, the Apache-2.0 licence and an attribution note.

    migrate-to-rust.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip migrate-to-rust.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip migrate-to-rust.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Review the build and run commands the agent proposes in Stage 0 before confirming, since they will execute code from the cloned repository.
  • Point the agent at a local copy you have already inspected when the source is untrusted.
  • Expect the workflow to take a long time; it caps self-healing at 5 iterations per loop and reports remaining gaps rather than looping forever.

What's inside

  • references/pgo_and_telemetry_guide.md
  • scripts/telemetry.py
  • SKILL.md

Redistributed unmodified from google/skills under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.