juanmarchetto/agent-skills/rust-migration
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
C/C++ to idiomatic Rust conversion patterns and pipeline. Covers pointer translation, memory management, error handling, string conversion, struct patterns, and quality gates. Use when: convert C to Rust, migrate to Rust, C to Rust patterns, Rust migration, rewrite in Rust.
Install
npx vskill@latest install juanmarchetto/agent-skills/rust-migrationSKILL.md
C to Rust Migration Patterns
Pipeline Process
- Analysis — classify difficulty, detect patterns, plan strategy
- Translation — C → safe Rust (LLM, optionally with C2Rust context)
- Quality gate — re-translate if >5 unsafe blocks (temp 0.5)
- Validation — compile + diff test + idiomatic score
- Repair loop — fix errors preserving quality floor (P0)
- Best-version fallback — keep highest-quality version even if doesn't compile (P1)
Memory Management
Data Model Migration (learned from cJSON)
Error Handling
String Handling
Function Pointer Migration (learned from genann)
Pointer Patterns
Struct Migration
Control Flow
State Machine Migration (learned from http-parser)
Numeric Formatting (learned from cJSON)
Common Pitfalls (from production migrations)
boolvsint: C returns 0/1 as int; Rustboolprintstrue/false→ keep asi32- Integer overflow: C wraps silently; Rust panics in debug → use
wrapping_addetc. - Printf format:
%d→{},%s→{},%f→{:.6},%g→ custom format_g() - Signed/unsigned: C implicit conversion; Rust requires explicit
ascasts - Recursive data structures: need
Box<T>for indirection in Rust - Bit manipulation: same operators but explicit types needed (
u32,i32) - Use `usize` for array dimensions: C uses
intfor sizes, but Rust indexing requiresusize. Usingi32forcesas usizeon every array access, which penalizes idiomatic score heavily. Preferusizefrom the start. - glibc `srand`/`rand` determinism: C's
rand()uses glibc TYPE_3 (degree-31) PRNG. For diff-test to pass, must reimplement the exact PRNG algorithm, not use Rust'srandcrate. - `a > 0` returns double in C: This is an implicit bool-to-double cast. In Rust:
if a > 0.0 { 1.0 } else { 0.0 } - goto state machines: Don't port byte-by-byte. Rewrite at higher abstraction (line-by-line parsing). 1515 LOC goto → ~200 LOC clean Rust. The
parsedbyte count stays correct via position tracking. - C callback APIs with global state: Use
thread_local! { RefCell<T> }instead ofunsafe static mut. Callbacks are plain functions that access the thread_local. - Frontier target stochasticity: For >2500 LOC with goto/switch state machines, the LLM pipeline converges stochastically. Manual completion is a valid strategy when LLM provides good types+structure but truncates on complex functions.
Powered by Noricum — autonomous C/C++ to Rust migration agent
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/rust-migration/SKILL.md
Popularity
- Repository stars
- 5
- Repository forks
- 1
- 7-day trend score
- 9
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 14 Oct 2026, 9 days ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/juanmarchetto/agent-skills/rust-migration)