Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)22k · #10353

migrate-to-rust

Skill này làm gì

Skill này giúp chuyển một codebase cũ sang Rust, ngôn ngữ an toàn và nhanh hơn. Skill dành cho các nhóm kỹ thuật muốn hiện đại hóa một chương trình cũ nhưng vẫn giữ nguyên hành vi.

Khi nào nên dùng

  • ✓Khi bạn muốn chuyển một codebase C++, Fortran, Java, Python, C hoặc shell cũ sang Rust.
  • ✓Khi bạn cần một bản port Rust được kiểm tra với hành vi gốc bằng các bài test.
  • ✓Khi bạn muốn một báo cáo bằng văn bản về quá trình chuyển đổi, kèm số liệu hiệu năng.

Liên kết skill

https://github.com/google/skills/blob/main/skills/developers/migrate-to-rust/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/google/skills/blob/main/skills/developers/migrate-to-rust/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Chuyển dự án C++ cũ trong thư mục của tôi sang Rust an toàn, kiểm tra các bài test vẫn chạy và báo cáo sự thay đổi về tốc độ.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill lấy mốc chuẩn từ mã gốc, viết kế hoạch kiến trúc, rồi xây dựng và kiểm thử bản Rust. Skill ghi lại telemetry trong quá trình làm việc và tạo báo cáo kèm phần tóm tắt tương tác.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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:

Parameter Placeholder Resolution Strategy
Source Input
Câu hỏi thường gặp

Skill có biên dịch mã đã clone mà không hỏi không?

Không. Skill hiển thị lệnh build và chạy cho mọi repository bên ngoài và chờ bạn xác nhận trước.

Mã Rust có dùng khối unsafe không?

Skill hướng tới 100 phần trăm Rust an toàn.

Báo cáo gồm những gì?

Telemetry đo được, kết quả kiểm thử và phần kể lại quá trình chuyển đổi ở ngôi thứ nhất.

Chi tiết

Mô tả gốc của tác giả

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 a

repo: google/skills

Độ phổ biến

Sao GitHub
22k
Vị trí xếp hạng
#10353
Giấy phép
Apache-2.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự