Install
$ agentstack add skill-juanmarchetto-agent-skills-c-to-rust-migration ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README — it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming — see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps — measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
C to Rust Migration
Complete pipeline for migrating C/C++ codebases to safe, idiomatic Rust. Covers analysis, conversion, and validation in three phases.
Pipeline
C/C++ Source
|
Phase 1: ANALYZE
| Classify difficulty (easy/medium/hard)
| Detect patterns (pointers, macros, goto, unions)
| Plan conversion strategy
|
Phase 2: CONVERT
| Apply migration patterns
| Memory management → ownership/borrowing
| Error codes → Result
| Pointer arithmetic → slices/iterators
| Quality gate: re-translate if >5 unsafe blocks
|
Phase 3: VALIDATE
| Compilation check (edition 2024)
| Unsafe minimization (target: 0 for easy/medium)
| Clippy with 0 warnings
| Differential testing (same I/O as original C)
| Idiomatic score calculation
|
Safe, Idiomatic Rust
Phase 1: Analysis
Classify each function by migration difficulty:
| Difficulty | Patterns | Strategy | |---|---|---| | Easy | Pure functions, simple arithmetic, no pointers, with thiserror | | NULL checks | Option | | Array + length params | Slices (&[T]) | | void* | Generics or enum dispatch | | Function pointers | Fn traits or enum dispatch | | struct with init/free | impl with new() + Drop | | Global mutable state | OnceLock, Mutex, or dependency injection | | goto cleanup | Drop guards or ?` operator |
Quality gate: If translation produces >5 unsafe blocks, re-attempt with lower temperature (0.5) focusing on the unsafe sections.
See references/conversion-patterns.md for detailed examples from real migrations.
Phase 3: Validation
Checklist (in order):
- Compilation:
cargo buildwith edition 2024, zero errors - Clippy:
cargo clippywith zero warnings - Unsafe audit: Count
unsafeblocks. Every one needs a// SAFETY:comment explaining why it's sound - Differential testing: Same inputs → same outputs as original C code
- Idiomatic score:
(1 - unsafe_blocks/total_functions) * 0.4 + clippy_clean * 0.3 + has_tests * 0.2 + has_docs * 0.1
Quality floor: Never accept a version that scores lower than the current best. If a fix attempt reduces the score, discard it.
See references/validation-checklist.md for the complete validation protocol.
Example Output
C-to-Rust Migration Report — http_parser.c
Analysis:
Total functions: 23
Easy: 8 | Medium: 11 | Hard: 4
Hard patterns: 2 goto statements, 1 union, 1 function pointer dispatch
Conversion:
Functions migrated: 23/23
Unsafe blocks: 2 (both in FFI boundary — justified)
Idiomatic patterns applied: Result, Option, iterators, Drop guards
Validation:
✅ Compiles (edition 2024)
✅ Clippy: 0 warnings
✅ Unsafe: 2 blocks, both with SAFETY comments
✅ Diff tests: 47/47 passing (100%)
Idiomatic score: 0.91/1.0
Quality: EXCELLENT — ready for production use
Error Handling
- C code doesn't compile: Need the original build system info (Makefile, CMakeLists.txt) to understand dependencies and flags
- Too many unsafe blocks: Re-attempt conversion focusing on the unsafe sections. Consider if some are FFI boundaries (justified) vs unnecessary
- Diff tests fail: Compare output byte-by-byte. Common causes: endianness, floating point precision, uninitialized memory in C
- Circular dependencies: Rust doesn't allow circular module deps. Restructure with traits or merge modules
Origin
Patterns extracted from real-world C-to-Rust migrations of open-source libraries: cJSON, genann, http-parser, picohttpparser, olive.c.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: JuanMarchetto
- Source: JuanMarchetto/agent-skills
- License: MIT
- Homepage: https://github.com/JuanMarchetto/agent-skills
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.