- name
SKILL.md
Файл навыка остаётся в репозитории издателя.
Вставьте скопированную команду в терминал. Она установит этот SKILL.md в выбранного агента.
npx skills add morganlinton/BeautifulRust --skill rust-port -a cursor -yВставьте скопированную команду в терминал. Она установит этот SKILL.md в выбранного агента.
npx skills add morganlinton/BeautifulRust --skill rust-port -a claude-code -yВставьте скопированную команду в терминал. Она установит этот SKILL.md в выбранного агента.
npx skills add morganlinton/BeautifulRust --skill rust-port -a codex -yВставьте скопированную команду в терминал. Она установит этот SKILL.md в выбранного агента.
npx skills add morganlinton/BeautifulRust --skill rust-port -a grok -yОтправьте скопированное сообщение в чат Grok Bot. Бот загрузит этот SKILL.md с GitHub и добавит его к навыкам, общим для всех ваших ботов.
Install this skill: https://github.com/morganlinton/BeautifulRust/tree/HEAD/skills/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.
NULL returns, global state,
fixed-size buffers, a class that exists only to group functions, or isinstance
checks. These don't carry over.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.
Decide the public types and signatures from the behavior list, not from the original's shape. Then implement against the ported tests.
Don't write unsafe or use raw pointers unless the port must talk to C through FFI, and
then confine it as the rust-best-practices skill describes.
(value, error) returns become Result; nil becomes Option; interfaces become
traits; goroutines and channels become threads with std::sync::mpsc or async tasks,
depending on what the original needs.null and undefined become Option; thrown errors become Result; plain
objects become structs; numbers become a sized integer or f64, chosen on purpose.A port that matches the original on every possible input is usually the wrong goal. Match it on the inputs it actually receives, and use Rust's standard library for the rest.
str::lines, str::trim,
str::parse, and char methods, not hand-written copies of Python's splitlines,
strip, int(), or repr(), or of C's locale-dependent isspace and strtol. Where
Rust's behavior differs only on exotic input, such as Unicode digits, non-ASCII
whitespace, or unbounded integers, list the difference in the porting notes instead of
coding around it. Write a compatibility shim only when the user says those inputs occur.Debug, Clone, Display, Error, FromStr,
Default, and IntoIterator for collections). Skip builders, Index impls,
FromIterator, Extend, and custom iterator types unless the original's callers need
them.Differential testing against the original is worth doing, but a few dozen realistic and edge-case inputs answer the question. A fuzzing harness over millions of inputs usually just finds exotic divergences that belong in the notes.
Run these if a Rust toolchain is available, and fix everything before reporting:
cargo build
cargo test
cargo clippy --all-targets -- -D warnings
Every ported test must pass. If the original's tests can be run too, run them and compare results on the same inputs.
Alongside the code, write a short PORTING.md that a reviewer can check in a few
minutes:
For the style of the Rust itself, follow the rust-best-practices skill if it is
installed.
>-
---name: rust-portdescription: >----# skills/rust-port/SKILL.mdFAQ
Скачайте skills/rust-port/SKILL.md у издателя или скопируйте путь и откройте репозиторий. PlugMCP только показывает навык в каталоге и не хранит файл.
Издатель хранит его в https://github.com/morganlinton/BeautifulRust.
Claude, Cursor, Codex и Grok Build могут читать SKILL.md, который вы добавляете из репозитория издателя. Grok Bot устанавливает его, когда вы отправляете в чат ссылку на папку навыка на GitHub.