Skip to main content
BuildOfficialCertifiedReviewed Oct 13, 2026

Migrate to Rust

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.

v1.0.0New

Install this skill

No account required. Pick your tool, or use the command that detects it for you.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install google-cloud-skills-migrate-to-rust
Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/google-cloud-skills-migrate-to-rust/SKILL.md

Setup guide →

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
Key
skills-hub-ed25519-2026-11
Signed
0Save

Instructions

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:

  1. 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.)
  2. 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.
  3. Bounded Automated Self-Healing (Max 5 Iterations): When tests, clippy
    lints, or A/B parity checks fail, log the failure via
    scripts/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 in
    migration_telemetry.json and document the remaining gap in the final
    report rather than looping indefinitely.
  4. Verification Targets & Definition of Done:
    • #![forbid(unsafe_code)] Rust crate compiles with a target of 0
      cargo clippy warnings (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 in migration_telemetry.json.
    • A/B differential output parity is verified across N deterministic
      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 as
      llvm-profdata is unavailable).
    • The interactive HTML infographic (migration_infographic.html) is
      rendered via scripts/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:

ParameterPlaceholderResolution 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.jsonInitialized via scripts/telemetry.py init at the start of Stage 0

Stage 0 Execution Steps

  1. Clone Repository (if GitHub URL): Choose a clean local directory
    (default to ~/rust_migrations/{repo_name}, or inside the current workspace
    if requested) and run git clone {github_url} ~/rust_migrations/{repo_name}.
  2. 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 the discovery
    bucket and run scripts/telemetry.py scan-codebase --phase before on 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.
  3. 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 via scripts/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)

  1. Start the rewrite timer bucket (scripts/telemetry.py start-bucket --bucket rewrite).
  2. Initialize the Rust workspace with #![forbid(unsafe_code)] in src/lib.rs
    and src/main.rs.
  3. Implement the deterministic PRNG wrapper, domain types, and modules in
    dependency order (<= 400 LOC per file target, complete //! and ///
    rustdoc with runnable doc-tests).
  4. Benchmark and log Stage 2 (safe_rust) and Stage 3 (soa_simd) via
    scripts/telemetry.py log-benchmark.

Step 2: The Verification Crucible — Test, Fail, Diagnose & Fix (test_heal Bucket)

  1. Start the test_heal timer bucket (scripts/telemetry.py start-bucket --bucket test_heal).
  2. Write unit tests, runnable doc-tests, and proptest boundary tests.
  3. Run cargo test --all-targets, cargo test --doc, and cargo clippy --all-targets.
  4. Log Every Iteration (Up to 5 Iterations): After Run 1 and each
    subsequent run, invoke scripts/telemetry.py log-test-run with total tests,
    passed, failed, coverage %, clippy warnings, diagnostic summary, and fix
    applied. Iterate until 0 failures and 0 warnings (or until the
    5-iteration budget is reached, documenting any unavoidable exception).

Step 3: A/B Differential Output Parity (parity Bucket)

  1. Start the parity timer bucket (scripts/telemetry.py start-bucket --bucket parity).
  2. Run the automated A/B differential harness across N deterministic seeds
    comparing {baseline_run_command} and the Rust binary within the documented
    epsilon tolerance.
  3. 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)

  1. Start the pgo_bench timer bucket (scripts/telemetry.py start-bucket --bucket pgo_bench).
  2. Execute the LLVM PGO workflow in
    references/pgo_and_telemetry_guide.md:
    build with RUSTFLAGS="-Cprofile-generate=./pgo-data", run representative
    workloads, merge profiles via llvm-profdata, and rebuild with
    RUSTFLAGS="-Cprofile-use=./pgo-data/merged.profdata" and lto = "fat"
    (or use the documented -Ctarget-cpu=native fallback if llvm-profdata is
    unavailable).
  3. 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
    scripts/telemetry.py log-benchmark --stage pgo_lto.

Step 5: Final Census, First-Person AI Story & Visual Infographic

  1. Run scripts/telemetry.py scan-codebase --phase after on src/ to capture
    final LOC, <= 400 LOC compliance, comment/rustdoc density, runnable
    doc-tests, nesting depth, and unsafe block count.

  2. 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).

  3. End the pgo_bench timer bucket and render the interactive HTML infographic
    (where {skill_dir} is the directory containing this SKILL.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}"
    
  4. Output a concise executive summary referencing the generated
    migration_infographic.html report 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
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →
google-cloud-storage-bucket-architectCreates Cloud Storage on Google Cloud (also known colloquially as GCS) buckets. Analyzes the workload (sensitive data, media hosting, ingestion, web hosting, archiving, backup, logging, analytics, AI/ML, or general-purpose), validates project-level security settings, and designs a secure-by-default, cost-effective configuration (location, storage class, uniform bucket-level access, public access prevention, soft delete, lifecycle) before creating it. Use whenever a user wants to create, make, set up, provision, or spin up a bucket, or needs object storage for an app, service, pipeline, or dataset — even a "simple" or "default" bucket, or when bucket creation is one step in a larger workflow. Outputs or executes the creation via gcloud, the JSON/REST API, Terraform, or SDK client libraries (C++, Java, Python, Go). Don't use for anything other than creating new buckets — for uploads, downloads, access changes, or reconfiguring existing buckets, use google-cloud-storage-basics.1 installsgke-cost-analysisAnswer natural language questions and perform analysis on GKE cluster and workload costs using BigQuery billing exports, cost allocation data, and live cluster monitoring metrics. Use when querying GKE costs across projects, namespaces, or workloads, analyzing billing reports in BigQuery (`bq`), checking cluster cost budgets (`gcloud billing`), or diagnosing cost drivers like pod requests vs. actual utilization (`kubectl top`). Don't use for applying cost optimization changes, creating rightsizing manifests (VPA/MPA), or selecting ComputeClasses (use gke-cost-optimization instead).1 installsmanaged-airflow-migrationsProvides guidance for migrating Apache Airflow DAGs in Managed Service for Apache Airflow (MSAA; formerly Cloud Composer). Covers migration to Airflow 2.11.1 (MSAA Gen 2 and 3) and Airflow 3 (MSAA Gen 3), including environment inspection, GCS download/upload and scanning patterns for breaking changes. Use when migrating the DAG code to newer Airflow version. Don't use when checking DAG run failures unrelated to code migration.1 installsfirebase-basicsProvides foundational Firebase CLI setup, CLI installation, version checks (`firebase-tools@latest --version`), CLI login (including --no-localhost), project creation, project selection (`firebase use`), and app config file downloads (`google-services.json`, `GoogleService-Info.plist`). Use ONLY for CLI login, project creation/switching, or downloading app config files. Don't use for Firebase Hosting deploy, Firestore, Auth, App Hosting, Data Connect, Crashlytics, or Remote Config.1 installsgoogle-cloud-solution-rag-enterprise-search-gke-sqldbDiscovers requirements, and generates architectural, design, and deployment guidance for a retrieval-augmented generation (RAG)-capable enterprise search system in Google Cloud. Use when users need a vector-enabled SQL database as the store and index for the embedding vectors, an open model and open-source inferencing framework, and Kubernetes containers to host all the application components. DON'T use this skill for fully-managed RAG, or SaaS search services, or when a non-SQL vector database is required.1 installsbigtable-basicsAssists in provisioning instances/tables, designing performant schemas, and querying data in Bigtable. Use when designing Bigtable row keys, configuring column families, writing SQL queries or client library code (Java, Go, Python) for Bigtable, or diagnosing performance/hotspotting issues. Also use when provisioning Bigtable clusters using gcloud or cbt CLIs. Don't use for generic Cloud SQL administration.1 installs

More from Google Cloud Skills

View source →
spanner-basicsAssists in provisioning instances and databases, designing performant schemas, and querying data in Cloud Spanner on Google Cloud. Use when designing primary keys, writing SQL queries or client library code, or diagnosing performance issues.4 installsgoogle-ads-api-mcp-setupGuides developers through downloading, configuring, and installing the official open-source Google Ads MCP Server. Use this skill when a user wants to connect their AI assistant (such as Gemini, Claude Code, or Cursor) to their Google Ads account to query campaigns or retrieve reporting metrics using natural language.4 installsgke-workload-securityAudits, configures, and hardens workload-level security controls for Google Kubernetes Engine (GKE) applications and namespaces. Covers running security audits (`audit_cluster.sh`), enforcing Network Policies (default-deny and Dataplane V2 logging), isolating high-risk pods inside GKE Sandbox (`gVisor`), enforcing Pod Security Standards (`restricted` labeling) and pod securityContext, and mounting Secret Manager secrets via CSI (`SecretProviderClass`). Use when auditing workload security posture, isolating namespaces, applying pod security standards, or configuring network policies and secret volume mounts. Don't use for Workload Identity (use gke-workload-identity), cluster-wide control plane security, RBAC hardening, Binary Authorization, Shielded Nodes, or enabling platform-level GKE add-ons (use gke-platform-security instead).3 installsgke-upgradesPlans, executes, and validates Google Kubernetes Engine (GKE) cluster upgrades and maintenance operations for both Standard and Autopilot clusters. Produces upgrade plans, pre/post-upgrade checklists, maintenance runbooks with gcloud commands, release channel strategy, and troubleshooting guides. Handles node pool upgrade strategies (surge, blue-green), version compatibility, PDB management, and workload-specific concerns (stateful, GPU, operators). Use this skill whenever the user mentions GKE upgrades, Kubernetes version bumps, node pool maintenance, GKE patching, cluster version management, release channel selection, maintenance windows, surge upgrades, stuck upgrades, or any GKE lifecycle management task — even casual mentions like "we need to upgrade our clusters" or "plan our next GKE maintenance" or "our upgrade is stuck." Don't use for GKE cluster creation, application onboarding, general networking/routing setup, or security policy configurations (use gke-basics or relevant GK2 installsgoogle-cloud-recipe-networking-observabilityInvestigates Google Cloud networking issues by analyzing logs, metrics, and diagnostics. Use when investigating VPC Flow Logs, NAT, firewall, or threat logs, querying latency and throughput metrics, or running Connectivity Tests for path diagnostics.2 installsgke-manifest-generationGenerates and updates secure, production-ready Kubernetes YAML manifests optimized for GKE Autopilot and GKE Standard clusters. Use when creating or modifying GKE deployment manifests, configuring container security contexts, setting CPU/memory resource limits, defining readiness/liveness/startup probes, mounting secrets and volumes, configuring GKE Gateway API routes, targeting Spot VMs, or deploying AI model inference workloads (vLLM, TGI, Gemma). Don't use for live cluster operations, pod troubleshooting (use gke-workload-troubleshooting), or cluster infrastructure provisioning (use gke-cluster-creation).2 installs

More Build skills

Browse category →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.647 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.549 installsfrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.358 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.258 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.183 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions147 installs

Frequently asked questions about migrate-to-rust

What does the migrate-to-rust skill do?

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. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the migrate-to-rust skill?

Run `npx @skills-hub-ai/cli install google-cloud-skills-migrate-to-rust` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/google-cloud-skills-migrate-to-rust/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does migrate-to-rust work with?

migrate-to-rust runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the migrate-to-rust skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use migrate-to-rust after installing it?

In Claude Code, type `/google-cloud-skills-migrate-to-rust` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the migrate-to-rust skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.