rust-skills
БесплатноЗапускает вложенные скриптыНе проверенComprehensive Rust coding guidelines with 265 rules across 26 categories. Use when writing, reviewing, or refactoring Rust code. Covers ownership, error…
от pmcfadin★ 22 звезды на GitHubОб этом скилле
Rust Best Practices
Comprehensive guide for writing high-quality, idiomatic, and highly optimized Rust code. Contains 265 rules across 26 categories, prioritized by impact to guide LLMs in code generation and refactoring. Current for Rust 1.96 (2024 edition).
When to Apply
Reference these guidelines when:
- Writing new Rust functions, structs, or modules
- Implementing error handling or async code
- Writing concurrent, parallel, or
unsafecode - Designing public APIs for libraries
- Reviewing code for ownership/borrowing issues
- Optimizing memory usage or reducing allocations
- Tuning performance for hot paths
- Refactoring existing Rust code
Rule Categories by Priority
| Priority | Category | Impact | Prefix | Rules |
|---|---|---|---|---|
| 1 | Ownership & Borrowing | CRITICAL | own- |
12 |
| 2 | Error Handling | CRITICAL | err- |
12 |
| 3 | Memory Optimization | CRITICAL | mem- |
17 |
| 4 | Unsafe Code | CRITICAL | unsafe- |
7 |
| 5 | API Design | HIGH | api- |
17 |
| 6 | Async/Await | HIGH | async- |
18 |
| 7 | Concurrency | HIGH | conc- |
4 |
| 8 | Compiler Optimization | HIGH | opt- |
12 |
| 9 | Numeric & Arithmetic Safety | HIGH | num- |
5 |
| 10 | Type Safety | MEDIUM | type- |
13 |
| 11 | Trait & Generics Design | MEDIUM | trait- |
6 |
| 12 | Conversions | MEDIUM | conv- |
3 |
| 13 | Const & Compile-Time | MEDIUM | const- |
4 |
| 14 | Serde | MEDIUM | serde- |
8 |
| 15 | Pattern Matching | MEDIUM | pat- |
5 |
| 16 | Macros | MEDIUM | macro- |
8 |
| 17 | Closures | MEDIUM | closure- |
5 |
| 18 | Collections | MEDIUM | coll- |
4 |
| 19 | Naming Conventions | MEDIUM | name- |
16 |
| 20 | Testing | MEDIUM | test- |
15 |
| 21 | Documentation | MEDIUM | doc- |
12 |
| 22 | Observability | MEDIUM | obs- |
7 |
| 23 | Performance Patterns | MEDIUM | perf- |
13 |
| 24 | Project Structure | LOW | proj- |
14 |
| 25 | Clippy & Linting | LOW | lint- |
13 |
| 26 | Anti-patterns | REFERENCE | anti- |
15 |
Quick Reference
1. Ownership & Borrowing (CRITICAL)
own-borrow-over-clone- Prefer&Tborrowing over.clone()own-slice-over-vec- Accept&[T]not&Vec<T>,&strnot&Stringown-cow-conditional- UseCow<'a, T>for conditional ownershipown-arc-shared- UseArc<T>for thread-safe shared ownershipown-rc-single-thread- UseRc<T>for shared ownership in single-threaded contextsown-refcell-interior- UseRefCell<T>for interior mutability in single-threaded codeown-mutex-interior- UseMutex<T>for interior mutability across threadsown-rwlock-readers- UseRwLock<T>when reads significantly outnumber writesown-copy-small- ImplementCopyfor small, simple typesown-clone-explicit- Use explicitClonefor types where copying has meaningful costown-move-large- Move large types instead of copying; useBoxif moves are expensiveown-lifetime-elision- Rely on lifetime elision rules; add explicit lifetimes only when required
2. Error Handling (CRITICAL)
err-thiserror-lib- Usethiserrorfor library error typeserr-anyhow-app- Useanyhowfor application error handlingerr-result-over-panic- ReturnResult<T, E>instead of panicking for recoverable errorserr-context-chain- Add context with.context()or.with_context()err-no-unwrap-prod- Avoidunwrap()in production code; use?,expect(), or handle errorserr-expect-bugs-only- Useexpect()only for invariants that indicate bugs, not user errorserr-question-mark- Use?operator for clean propagationerr-from-impl- ImplementFrom<E>for error conversions to enable?operatorerr-source-chain- Preserve error chains with#[source]orsource()methoderr-lowercase-msg- Start error messages lowercase, no trailing punctuationerr-doc-errors- Document error conditions with# Errorssection in doc commentserr-custom-type- Define custom error types for domain-specific failures
3. Memory Optimization (CRITICAL)
mem-with-capacity- Usewith_capacity()when size is knownmem-smallvec- UseSmallVecfor usually-small
Установить rust-skills в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл rust-skills?
Comprehensive Rust coding guidelines with 265 rules across 26 categories. Use when writing, reviewing, or refactoring Rust code. Covers ownership, error handling, async patterns, concurrency, unsafe code, API design, memory optimization, performance, numeric safety, conversions, serde, pattern matching, macros, closures, observability, testing, and common anti-patterns. Invoke with /rust-skills.
Как установить скилл rust-skills?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл rust-skills запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic