Port code to Rust
Ports C, C++, Python, Go or JavaScript code into idiomatic Rust, with tests that prove it behaves the same.
Claude's review
9/10 Excellent, broadly useful methodology for porting code to idiomatic Rust with verification steps.
We asked Claude the question you would ask: would I be glad I installed this? We only sell skills it rates 7 or higher.
In detail
Port code from C, C++, Python, Go, JavaScript, or TypeScript into idiomatic Rust that keeps the original behavior: ownership instead of manual memory, Result instead of error codes and exceptions, enums instead of flag ints and magic strings, and tests that prove the port matches. Use this whenever the user asks to port, translate, convert, migrate, or rewrite code in Rust ("rewrite this in Rust", "what would this look like in Rust", "move this module to Rust"), even if they don't say "port". Pairs with the rust-best-practices skill, which covers the target code's style.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: rust-port
description: >-
Port code from C, C++, Python, Go, JavaScript, or TypeScript into idiomatic Rust that
keeps the original behavior: ownership instead of manual memory, Result instead of error
codes and exceptions, enums instead of flag ints and magic strings, and tests that prove
the port matches. Use this whenever the user asks to port, translate, convert, migrate,
or rewrite code in Rust ("rewrite this in Rust", "what would this look like in Rust",
"move this module to Rust"), even if they don't say "port". Pairs with the
rust-best-practices skill, which covers the target code's style.
---
# Rust port
The goal is the Rust a Rust developer would have written to solve the same problem, with
the same observable behavior. A line-by-line transliteration (C written in Rust syntax,
or Python with `Box<dyn Any>`) compiles but keeps every problem the original had and adds
the borrow checker on top. Port the behavior, not the structure.
## 1. Understand the original before writing anything
1. **Read the code and its tests**, and anything that calls it, if you have it.
2. **List the observable behavior**: every public function, its inputs, its outputs, and
every way it can fail. Include the quiet parts, which are where ports go wrong:
ordering of results, how ties break, what happens on empty input, whitespace and case
handling, integer limits, and what counts as an error versus a valid edge case.
3. **Note what is incidental**, meaning things the original only does because of its
language: manual memory management, out-parameters, `NULL` returns, global state,
fixed-size buffers, a class that exists only to group functions, or `isinstance`
checks. These don't carry over.
4. If the original has a bug or an ambiguity, keep its behavior, flag it in the porting
notes, and let the user decide. A port is not the place to silently fix things.
## 2. Port the tests first
Translate the original tests into Rust tests before porting the implementation. Keep one
Rust test per original test, with a name that maps back to it, so a reader can check
coverage. The tests are the definition of "same behavior". If the original has no tests,
write characterization tests from the behavior list in step 1.
...From morganlinton's repository, MIT licence.
Related skills
-
Checked
Kotlin Toolchain CLI
Builds, tests and packages Kotlin projects with the new JetBrains Kotlin Toolchain CLI, formerly called Amper.
7/101 credit -
Checked
Rust best practices
Writes and reviews idiomatic, maintainable Rust code and runs a checklist before handing it back to you.
7/101 credit -
Checked
Rust code review
Reviews Rust code for idiom, errors, safety and API design, with a ranked report and a fix for every finding.
8/101 credit -
Checked
Java Debugging Guide
Finds the cause of Java bugs and failing tests, and attaches a debugger safely in Maven, Gradle, Spring or Docker.
7/101 credit -
Checked
Multi axis code review
Reviews a diff for correctness, design, tests and security with severity labels, so only solid code merges.
8/101 credit -
Checked
Python games with pygame
Builds and debugs 2D pygame games with a proper loop and delta time, so they run the same on any PC.
8/101 credit