rust-best-practices · pedronauck — скилл для Claude Code: Rust с ownership и async
Скилл rust-best-practices для Claude Code помогает писать, рефакторить и оптимизировать Rust-код с учётом ownership, ошибок, Tokio, трейтов и тестов. Работает с системным программированием и асинхронным кодом.
MIT 298 установок ★ 655 обновлён 2026-10-20
npx skills add pedronauck/skills --skill rust-best-practices -a claude-codeЧто делает rust-best-practices
Скилл помогает писать Rust, соблюдая идиомы языка. Внутри — справочники по стилю кода, ownership и заимствованиям, обработке ошибок (Result, Option, thiserror, anyhow), асинхронному коду и Tokio, трейтам и обобщениям, синхронизации потоков, тестированию и профилированию. Агент знает, как работать с Cargo, честит код через Clippy, форматирует через rustfmt и пишет бенчмарки.
Скилл уважает существующую конфигурацию проекта: версию издания Rust, rust-toolchain.toml, MSRV в Cargo.toml. Не навязывает новые крейты и не апгрейдит тулчейн просто чтобы следовать примеру. Не требует аудита всего воркспейса — правит конкретный файл или тест.
Ограничение: скилл работает только с Rust и кодом, связанным с идиомами языка. Архитектуру вне Rust-специфики (API, микросервисы в общем) не трогает.
Какие задачи решает
- рефакторить код с учётом ownership и lifetime
- добавить обработку ошибок через Result и кастомные типы
- оптимизировать асинхронный код на Tokio
- написать тесты, бенчмарки и покрытие документацией
- применить рекомендации Clippy и исправить стиль кода
Примеры запросов агенту
- Помоги мне переписать эту функцию, чтобы не клонировать данные без необходимости
- Добавь обработку ошибок в этот код с использованием
thiserror - Напиши интеграционный тест и бенчмарк для проверки производительности
Как установить rust-best-practices
1Через Skills CLI (Vercel)
npx skills add pedronauck/skills --skill rust-best-practices -a claude-code2Вручную: положить файлы
~/.claude/skills/rust-best-practices/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/rust-best-practices/
1Через Skills CLI (Vercel)
npx skills add pedronauck/skills --skill rust-best-practices -a codex2Вручную: положить файлы
.agents/skills/rust-best-practices/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add pedronauck/skills --skill rust-best-practices -a cursor2Вручную: положить файлы
.cursor/skills/rust-best-practices/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install pedronauck/skills skills/mine/rust-best-practices2Вручную: положить файлы
.github/skills/rust-best-practices/SKILL.md1Через Skills CLI (Vercel)
npx skills add pedronauck/skills --skill rust-best-practices -a gemini-cli2Командой платформы
gemini skills install https://github.com/pedronauck/skills --path skills/mine/rust-best-practicesВручную: положить файлы
.devin/skills/rust-best-practices/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add pedronauck/skills --skill rust-best-practices -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о rust-best-practices
Как установить rust-best-practices в Claude Code?
Выполни npx skills add pedronauck/skills --skill rust-best-practices -a claude-code, а потом прочитай ~/.claude/skills/rust-best-practices/SKILL.md. Скилл будет готов к использованию.
Что делает rust-best-practices?
Помогает писать и рефакторить Rust-код по идиомам языка: управление памятью, обработка ошибок, асинхронность, тестирование. Знает про Cargo, Clippy, rustfmt и может читать справочники по конкретным темам.
Скилл требует новую версию Rust или новые библиотеки?
Нет. Скилл работает с существующей конфигурацией проекта — версией издания, MSRV и rust-toolchain.toml. Не апгрейдит тулчейн и не добавляет крейты просто следуя примеру.
Исходный текст
SKILL.md · MIT
--- name: rust-best-practices description: "Write, review, refactor, or optimize Rust, including ownership, errors, Tokio, traits, tests, benchmarks, Clippy, and documentation. Excludes other languages and architecture unrelated to Rust idioms." license: MIT compatibility: Cargo; honor the repository edition, pinned toolchain, and minimum supported Rust version metadata: version: "2.1.0" domain: language triggers: Rust, Cargo, ownership, borrowing, lifetimes, async Rust, tokio, zero-cost abstractions, memory safety, systems programming, traits, generics, error handling, thiserror, anyhow, clippy, rustfmt, testing, benchmarks author: Pedro Nauck github: https://github.com/pedronauck repository: https://github.com/pedronauck/skills allowed-tools: Bash(cargo:*) Bash(rustc:*) Bash(rustfmt:*) Bash(clippy:*) Read Write Edit Glob Grep --- # Rust Best Practices Use the existing crate design, edition, `rust-toolchain.toml`, and `Cargo.toml` `rust-version` (MSRV). Reference examples may use newer features: confirm support before adopting them; do not upgrade the toolchain or add a crate just to follow an example. Read the reference for the Rust concern being changed. A local edit does not require every category, a new test framework, or a workspace-wide audit. | Topic | Reference | Load When | |-------|-----------|-----------| | Coding Style | `references/coding-style.md` | Naming, imports, iterators, comments, string handling, macros | | Error Handling | `references/error-handling.md` | Result, Option, ?, thiserror, anyhow, custom errors, async errors | | Ownership & Pointers | `references/ownership-and-pointers.md` | Lifetimes, borrowing, smart pointers, Pin, Cow, interior mutability | | Traits & Generics | `references/traits-and-generics.md` | Trait design, dispatch, GATs, sealed traits, type state pattern | | Async & Concurrency | `references/async-and-concurrency.md` | Tokio, channels, streams, shutdown, runtime config, async traits | | Sync Concurrency | `references/concurrency-sync.md` | Atomics, Mutex, RwLock, lock ordering, Send/Sync, memory ordering | | Testing | `references/testing.md` | Unit/integration/doc tests, snapshot, proptest, mockall, benchmarks, fuzz | | Performance | `references/performance.md` | Profiling, flamegraph, cloning, stack vs heap, iterators, allocation | | Clippy & Linting | `references/clippy-and-linting.md` | Clippy config, key lints, workspace setup, #[expect] vs #[allow] | | Documentation | `references/documentation.md` | Doc comments, rustdoc, doc lints, coverage checklist | ## Engineering floor - Borrow or transfer ownership deliberately; clone when independent ownership is needed. Prefer clear ownership over numeric size rules or avoiding every allocation. - Handle fallible operations with `Result` and preserve useful error context. Reserve panic/assertions for violated programmer invariants; validate external input with recoverable errors. - Match error types, dispatch, and dependencies to the existing public contract. `thiserror`, `anyhow`, Tokio, and third-party synchronization crates are options, not mandatory additions. - Keep lock lifetimes short, maintain lock order, and reason about cancellation, shutdown, and spawned-task ownership. Do not hold a synchronous lock across `.await`. - Treat `Send`/`Sync` bounds and atomic orderings as correctness properties. Choose weaker ordering only with a valid synchronization argument; benchmark before performance-driven rewrites. - Put behavior tests in the suite that owns the invariant. Add type-level, property, fuzz, snapshot, or benchmark tests when that contract or risk warrants them. - Run the repository's required scoped format, lint, and test commands; reuse valid evidence. Full workspace/all-feature runs and documentation coverage rules follow project policy. Check feature combinations actually supported by the crate.
© Pedro Nauck · MIT · pedronauck/skills
Похожие скиллы
Все скиллы по теме «Код-ревью и рефакторинг» →Сначала — rust-best-practices от других авторов.