Skillpedia
واجهات API والخوادم (backend)22k · #10353

migrate-to-rust

ما الذي تفعله

تساعد هذه المهارة على نقل قاعدة كود قديمة إلى Rust، وهي لغة أكثر أمانًا وسرعة. وهي مخصصة لفرق الهندسة التي تريد تحديث برنامج قديم مع الحفاظ على سلوكه.

متى تستخدمها

  • ✓عندما تريد نقل قاعدة كود قديمة بلغة C++ أو Fortran أو Java أو Python أو C أو shell إلى Rust.
  • ✓عندما تحتاج إلى نسخة Rust مُقارنة بسلوك الأصل عبر اختبارات.
  • ✓عندما تريد تقريرًا مكتوبًا عن النقل مع قياسات الأداء.

رابط المهارة

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

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/google/skills/blob/main/skills/developers/migrate-to-rust/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“انقل مشروع C++ القديم الموجود في مجلدي إلى Rust آمن، وتأكد من أن الاختبارات ما زالت تعمل، وأبلغني بتغيرات السرعة.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تلتقط خط أساس من الكود الأصلي، ثم تكتب خطة معمارية، وبعدها تبني الإصدار بلغة Rust وتختبره. وتسجل القياسات أثناء العمل وتنتج تقريرًا مع ملخص تفاعلي.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

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
الأسئلة الشائعة

هل تُترجم الكود المستنسخ دون أن تسأل؟

لا. تعرض أوامر البناء والتشغيل لأي مستودع خارجي وتنتظر تأكيدك أولًا.

هل سيستخدم كود Rust كتل unsafe؟

تسعى إلى Rust آمن بنسبة 100 في المئة.

ماذا يتضمن التقرير؟

قياسات مسجّلة ونتائج الاختبارات وسرد بضمير المتكلم لعملية النقل.

التفاصيل

الوصف الأصلي من المؤلف

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

الشعبية

نجوم GitHub
22k
الترتيب
#10353
الترخيص
Apache-2.0
آخر تحديث
2‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة