migrate-to-rust
Skill4 starsChanged 2 days agoMITView on GitHub
Clones, analyzes, plans, and migrates legacy codebases (C++, Fortran, Java, Python, C, Shell) from a GitHub URL or local directory to a modern, high-performance, deterministic, 100% Safe Rust architecture, tracking live telemetry across every task bucket, test failure/fix cycle, and Profile-Guided Optimization (PGO) stage, and producing a first-person AI storytelling report and interactive HTML infographic. Use when migrating a GitHub repository or local codebase to Rust, porting legacy C++, Fortran, Python, or Java workloads to memory-safe Rust, designing Struct-of-Arrays (SoA) or SIMD Rust architectures, or optimizing Rust ports with LLVM PGO. Don't use for unrelated non-Rust refactoring or single-line syntax questions.
1 other project uses a version of this.
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- google/skillsword for word, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 1
- google/skills★ 24k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository50 other files it gives its agents.
- agent-writingSkill
- arenaSkill
- blast-radiusSkill
- bun-playwright-runner-selectionSkill
- cinematic-shotSkill
- clean-ui-shotSkill
- codebase-designSkill
- debug-loopSkill
- dep-upgradeSkill
- diagnosing-bugsSkill
- discoverSkill
- domain-modelingSkill
- earshotSkill
- eval-judgeSkill
- flaky-testSkill
- grillingSkill
- grillSkill
- idea-scoutSkill
- improve-codebase-architectureSkill
- interrogateSkill
- make-mediaSkill
- migration-planSkill
- multi-agent-windows-hazardsSkill
- perf-loopSkill
- postmortemSkill
- prototypeSkill
- prSkill
- real-soundSkill
- recallSkill
- release-notesSkill
- repo-mapSkill
- researchSkill
- retroSkill
- secure-diffSkill
- sellSkill
- subagent-report-recoverySkill
- tasteSkill
- taste-skillSkill
- tddSkill
- teachSkill
- to-questionnaireSkill
- to-specSkill
- to-ticketsSkill
- wayfinderSkill
- weeklySkill
- windows-bash-backslash-halvingSkill
- wizardSkill
- writing-for-agentsSkill
- ycSkill
- ystack-upgradeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 2 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
When migrating a repository or local directory ({github_url} or {codebase_path}), follow these execution rules across agentic harnesses:
- Distinctive: line 31
Stage 0 External Code Confirmation Gate: After cloning an external repository and inspecting its build files, present the resolved legacy …
- Very specific: line 42
Bounded Automated Self-Healing (Max 5 Iterations): When tests, clippy lints, or A/B parity checks fail, log the failure via …
- Very specific: line 59
All 4 benchmark stages (legacy_baseline, safe_rust, soa_simd, pgo_lto) are measured and logged (or omitted cleanly if a tool such as …
- Very specific: line 100
Initialize Telemetry & Scan Legacy Codebase: Run scripts/telemetry.py init --telemetry "{workspace_dir}/migration_telemetry.json" …
- Very specific: line 107
Confirm & Benchmark Legacy Baseline: Before executing build or run commands from a cloned external repository, surface the resolved build …
- Very specific: line 119
Start the blueprint timer bucket (scripts/telemetry.py start-bucket --bucket blueprint), inspect the repository, log every discovered …
- Distinctive: line 132
Follow the command recipes and core engineering standards in references/pgo_and_telemetry_guide.md for each step:
- Very specific: line 138
Start the rewrite timer bucket (scripts/telemetry.py start-bucket --bucket rewrite).
- Very specific: line 152
Write unit tests, runnable doc-tests, and proptest boundary tests.
- Very specific: line 153
Run cargo test --all-targets, cargo test --doc, and cargo clippy --all-targets.
- Very specific: line 155
Log Every Iteration (Up to 5 Iterations): After Run 1 and each subsequent run, invoke scripts/telemetry.py log-test-run with total tests, …
- Very specific: line 165
Run the automated A/B differential harness across N deterministic seeds comparing {baseline_run_command} and the Rust binary within the …
- Very specific: line 183
Verify that tests and A/B parity still pass on the PGO binary, then measure wall-clock runtime and peak RSS and log Stage 4 (pgo_lto) via …
- Very specific: line 189
Run scripts/telemetry.py scan-codebase --phase after on src/ to capture final LOC, <= 400 LOC compliance, comment/rustdoc density, runnable …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Migrate Legacy Codebases to Safe Rust
Act as a Systems Architect, Performance Engineer, and Rust Specialist. Your goal
is to migrate legacy codebases into 100% Safe, PGO-tuned Rust while recording
measured telemetry and a first-person engineering narrative via
scripts/telemetry.py.
Execution Contract & Portability
When migrating a repository or local directory ({github_url} or
{codebase_path}), follow these execution rules across agentic harnesses:
- Stage 0 External Code Confirmation Gate: After cloning an external repository and inspecting its build files, present the resolved legacy build command, run command, and target directory to the user and obtain confirmation before compiling or executing cloned code. (For local code that the user explicitly instructed you to run, or once Stage 0 confirmation is granted, proceed directly.)
- Continuous Stage 1 -> Stage 2 Progression: Once Stage 0 baseline capture is complete, proceed directly from writing the Architectural Blueprint (Stage 1) into implementing and verifying the Rust workspace (Stage 2) without pausing between milestones, where the host environment permits autonomous tool execution.
- Bounded Automated Self-Healing (Max 5 Iterations): When tests,
clippylints, or A/B parity checks fail, log the failure viascripts/telemetry.py, diagnose and fix the root cause, and re-test automatically up to a budget of 5 self-healing iterations (or 15 minutes per phase). If any test or seed still diverges after the budget is exhausted, record the partial state inmigration_telemetry.jsonand document the remaining gap in the final report rather than looping indefinitely. - Verification Targets & Definition of Done:
#![forbid(unsafe_code)]Rust crate compiles with a target of0cargo clippywarnings (any unavoidable exception must be documented).- Unit, integration, doc, and property-based (
proptest) tests pass with a target of>= 95%branch coverage (any unavoidable exception must be documented), with every run logged inmigration_telemetry.json. - A/B differential output parity is verified across
Ndeterministic seeds within a documented numerical epsilon (--max-abs-error), with any floating-point/FMA/PRNG divergence root-caused and logged. - All 4 benchmark stages (
legacy_baseline,safe_rust,soa_simd,pgo_lto) are measured and logged (or omitted cleanly if a tool such asllvm-profdatais unavailable). - The interactive HTML infographic (
migration_infographic.html) is rendered viascripts/telemetry.py render-infographic.
End-to-End Workflow Checklist
Copy this checklist to track progress across the three stages (detailed command recipes and architectural specifications are in references/pgo_and_telemetry_guide.md):
- [ ] Stage 0: Acquire repo, initialize `migration_telemetry.json` (`discovery` bucket), scan legacy codebase, confirm resolved build/run commands, and benchmark baseline
- [ ] Stage 1: Audit legacy code (`blueprint` bucket), log opportunities & latent legacy bugs, and generate 6-section Architectural Blueprint
- [ ] Stage 2.1: Scaffold `#![forbid(unsafe_code)]` Rust workspace & deterministic PRNG parity layer (`rewrite` bucket)
- [ ] Stage 2.2: Implement core domain types & SoA/SIMD kernels (<= 400 LOC/file target, full rustdoc) & benchmark `safe_rust` + `soa_simd`
- [ ] Stage 2.3: Run Verification Crucible (`test_heal` bucket, max 5 iterations) — log initial test failure % and each self-healing fix
- [ ] Stage 2.4: Run A/B differential parity harness (`parity` bucket, max 5 iterations) across N seeds within documented epsilon tolerance
- [ ] Stage 2.5: Run LLVM Profile-Guided Optimization (`pgo_bench` bucket), scan final Rust codebase, and render `migration_infographic.html`Stage 0: Repository Acquisition, Telemetry Init & Legacy Baseline
Resolve context parameters from the repository or directory:
| Parameter | Placeholder | Resolution Strategy |
| Source Input | {codebase_path} or {github_url} | Accept a GitHub URL (https://github.com/...) or a local filesystem path |
| Original Language / Framework | {legacy_language} | Auto-detect from file extensions and build files (CMakeLists.txt, Makefile, meson.build, pyproject.toml, pom.xml, *.f90, *.cpp) |
| Baseline Run Command | {baseline_run_command} | Identify from README.md, CI workflows (.github/workflows/*.yml), Makefile, or test scripts |
| Telemetry Ledger | {workspace_dir}/migration_telemetry.json | Initialized via scripts/telemetry.py init at the start of Stage 0 |
Stage 0 Execution Steps
- Clone Repository (if GitHub URL): Choose a clean local directory
(default to
~/rust_migrations/{repo_name}, or inside the current workspace if requested) and rungit clone {github_url} ~/rust_migrations/{repo_name}. - Initialize Telemetry & Scan Legacy Codebase: Run
scripts/telemetry.py init --telemetry "{workspace_dir}/migration_telemetry.json" --project-name "{project_name}" --legacy-lang "{legacy_language}". Start thediscoverybucket and runscripts/telemetry.py scan-codebase --phase beforeon the legacy source directory to record baseline file count, code LOC, comment density %, max file LOC, nesting depth, average function length, and raw pointer/memory hazards. - Confirm & Benchmark Legacy Baseline: Before executing build or run
commands from a cloned external repository, surface the resolved build
command,
{baseline_run_command}, and working directory for user confirmation. Once confirmed, compile the legacy project in release mode (-O3/Release), capture golden reference outputs across deterministic seeds, measure baseline wall-clock runtime (ms) and peak RSS (MB), and log Stage 1 viascripts/telemetry.py log-benchmark --stage legacy_baseline.
Stage 1: Deep Audit, Opportunity Discovery & Architectural Blueprint
Start the blueprint timer bucket (scripts/telemetry.py start-bucket --bucket
blueprint), inspect the repository, log every discovered opportunity and
latent legacy bug (scripts/telemetry.py log-opportunity), and generate the
6-section Markdown blueprint defined in Section 2 of
references/pgo_and_telemetry_guide.md.
Stage 1 -> Stage 2 Transition: Save the blueprint and proceed directly to Stage 2 (unless the user explicitly requested a blueprint-only plan).
Stage 2: Phased Safe Rust Implementation, Self-Healing, PGO & Infographic
Follow the command recipes and core engineering standards in references/pgo_and_telemetry_guide.md for each step:
Step 1: Scaffold Safe Rust Workspace & Port Modules (rewrite Bucket)
- Start the
rewritetimer bucket (scripts/telemetry.py start-bucket --bucket rewrite). - Initialize the Rust workspace with
#![forbid(unsafe_code)]insrc/lib.rsandsrc/main.rs. - Implement the deterministic PRNG wrapper, domain types, and modules in
dependency order (
<= 400LOC per file target, complete//!and///rustdoc with runnable doc-tests). - Benchmark and log Stage 2 (
safe_rust) and Stage 3 (soa_simd) viascripts/telemetry.py log-benchmark.
Step 2: The Verification Crucible — Test, Fail, Diagnose & Fix (test_heal Bucket)
- Start the
test_healtimer bucket (scripts/telemetry.py start-bucket --bucket test_heal). - Write unit tests, runnable doc-tests, and
proptestboundary tests. - Run
cargo test --all-targets,cargo test --doc, andcargo clippy --all-targets. - Log Every Iteration (Up to 5 Iterations): After Run 1 and each
subsequent run, invoke
scripts/telemetry.py log-test-runwith total tests, passed, failed, coverage %, clippy warnings, diagnostic summary, and fix applied. Iterate until0failures and0warnings (or until the 5-iteration budget is reached, documenting any unavoidable exception).
Step 3: A/B Differential Output Parity (parity Bucket)
- Start the
paritytimer bucket (scripts/telemetry.py start-bucket --bucket parity). - Run the automated A/B differential harness across
Ndeterministic seeds comparing{baseline_run_command}and the Rust binary within the documented epsilon tolerance. - Log each parity iteration via
scripts/telemetry.py log-parity-run. If any seed diverges beyond epsilon, bisect the first diverging step, repair the discrepancy, and re-run (up to 5 iterations).
Step 4: Profile-Guided Optimization (PGO) & Final Benchmarks (pgo_bench Bucket)
- Start the
pgo_benchtimer bucket (scripts/telemetry.py start-bucket --bucket pgo_bench). - Execute the LLVM PGO workflow in
references/pgo_and_telemetry_guide.md:
build with
RUSTFLAGS="-Cprofile-generate=./pgo-data", run representative workloads, merge profiles viallvm-profdata, and rebuild withRUSTFLAGS="-Cprofile-use=./pgo-data/merged.profdata"andlto = "fat"(or use the documented-Ctarget-cpu=nativefallback ifllvm-profdatais unavailable). - Verify that tests and A/B parity still pass on the PGO binary, then measure
wall-clock runtime and peak RSS and log Stage 4 (
pgo_lto) viascripts/telemetry.py log-benchmark --stage pgo_lto.
Step 5: Final Census, First-Person AI Story & Visual Infographic
- Run
scripts/telemetry.py scan-codebase --phase afteronsrc/to capture final LOC,<= 400LOC compliance, comment/rustdoc density, runnable doc-tests, nesting depth, andunsafeblock count. - Log a Before vs. After Code Spotlight (
scripts/telemetry.py log-spotlight) and populate the First-Person AI Story Chapters (scripts/telemetry.py set-story). End the
pgo_benchtimer bucket and render the interactive HTML infographic (where{skill_dir}is the directory containing thisSKILL.md):python3 "{skill_dir}/scripts/telemetry.py" render-infographic \ --telemetry "{workspace_dir}/migration_telemetry.json" \ --out "{output_dir}/migration_infographic.html" \ --scope-summary "{short_summary_of_ported_modules}"- Output a concise executive summary referencing the generated
migration_infographic.htmlreport and key measured before/after metrics.
Bundled Resources
- Telemetry & Infographic CLI:
scripts/telemetry.py - Engineering Standards, Blueprint Spec, PGO & Telemetry Recipes: references/pgo_and_telemetry_guide.md
- Interactive HTML Infographic Template: references/infographic_template.html
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

