Rust
Writes, debugs, and optimizes Rust code, crates, and Cargo builds: ownership, lifetimes, traits, async, unsafe, and FFI. Use when the borrow checker rejects…
от clawic★ 23 звезды на GitHub
Установить Rust в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
User preferences and memory live in ~/Clawic/data/rust/ (see setup.md on first use, memory-template.md for the file format). If you have data at an old location (~/rust/ or ~/clawic/rust/), move it to ~/Clawic/data/rust/, and say in one line that you moved it and from where.
When To Use
- Writing or reviewing Rust: functions, traits, error types, async code, public crate APIs
- Fighting the compiler: moves, borrows, lifetimes, trait bounds,
dyncompatibility, type inference - Diagnosing runtime failures: panics, deadlocks,
BorrowMutError, memory growth, segfaults throughunsafeor FFI - Cargo work: features, workspaces, lockfiles, MSRV, slow builds, CI-only failures, duplicated dependencies
- Targets beyond the host: cross-compilation, static musl binaries,
no_stdfirmware, wasm - Not for C++ (
cpp) or language-agnostic concurrency theory (async-patterns) — this is Rust the language and its toolchain
Quick Reference
| Situation | Play |
|---|---|
| Compiler says a value moved and you still need it | Borrow instead of consuming, or copy the small part you need out first — clone is rung 5, not rung 1 (→ Borrow Checker Escape Ladder) |
| Two mutable borrows refused on code that looks fine | The checker is field-sensitive on direct field access and field-insensitive through a method call — destructure or split_at_mut → ownership.md |
| A returned reference "does not live long enough" | Nothing borrowed from a frame outlives it: return owned data, or an index → lifetimes.md |
missing lifetime specifier on a signature |
Two input references and no elision rule applies — name which one the output borrows from → lifetimes.md |
| "trait bound not satisfied" on a type that clearly implements it | Missing use for the trait, or &T supplied where T was required — read the required by chain bottom-up → traits.md |
| "future cannot be sent between threads safely" | A !Send value (std MutexGuard, Rc, RefCell ref) is alive across an .await → async.md |
| Async program stalls with no error and no progress | A blocking call is occupying a runtime worker → async.md |
| Program deadlocks | One thread locks the same lock twice, or two threads take two locks in opposite order → concurrency.md |
already borrowed: BorrowMutError at runtime |
Overlapping RefCell borrows — the check you moved from compile time to runtime → ownership.md |
String vs &str, a panic on a string slice, UTF-8, or path handling |
Byte indices are not characters and paths are not UTF-8 → strings-and-text.md |
A match is unreadable, non-exhaustive, or the type allows a state you never want |
Model it as an enum, then let exhaustiveness find the sites → pattern-matching.md |
| Nothing in the logs explains what the service was doing | No subscriber, or context in strings instead of span fields → observability.md |
| "Where does this type go, and what should be public" | Module tree, pub(crate), re-exports, lib vs bin split → modules-and-layout.md |
Error names two identical-looking types (expected Uri, found Uri) |
Semver-incompatible duplicate of one crate in the graph: cargo tree -d → cargo.md |
| Builds locally, fails in CI | Toolchain, lockfile, or feature-unification drift → cargo.md |
| Build is slow | cargo build --timings first; linker and codegen settings before restructuring code → cargo.md |
| Program is slow | Profile a release build with symbols; allocation and clone before algorithms → performance.md |
| Segfault, corrupted data, or nondeterministic "works on my machine" | Only reachable through unsafe or FFI — run it under Miri → unsafe.md |
| Anything else | Read the whole rustc output bottom-up including note: and help:, then rustc --explain E0xxx → compiler-errors.md |
Depth on demand: compiler-errors.md error code → real cause → first move · ownership.md moves, borrows, interior mutability · lifetimes.md elision, variance, 'static, HRTB · traits.md coherence, generics vs dyn, associated types · pattern-matching.md match ergonomics, let else, exhaustiveness, Option/Result combinators, modeling states · errors.md Result design, ?, panics, backtraces · async.md runtimes, Send bounds, cancellation · concurrency.md threads, locks, channels, atomics · strings-and-text.md String/&str, UTF-8, formatting, Cow, paths · collections.md Vec, maps, sets, queues, iterators · performance.md profiling, allocation, build settings · observability.md tracing, spans, metrics, panic hooks · cargo.md features, workspaces, lockfiles, build times · modules-and-layout.md module tree, visibility, lib/bin/tests layout, when to split a crate · testing.md layout, doctests, property tests, Miri, fuzzing · unsafe.md UB rules, raw pointers, safety comments · ffi.md C interop in both directions · macros.md macro_rules! and proc macros · api-design.md public APIs and semver hazards
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- _meta.json
- api-design.md
- async.md
- cargo.md
- collections.md
- compiler-errors.md
- concurrency.md
- cross-compilation.md
- embedded-no-std.md
- errors.md
- ffi.md
- lifetimes.md
- macros.md
- memory-template.md
- modules-and-layout.md
- observability.md
- ownership.md
- pattern-matching.md
- performance.md
- serde.md
- setup.md
- strings-and-text.md
- testing.md
- traits.md
- unsafe.md
- wasm.md
FAQ
Что делает скилл Rust?
Writes, debugs, and optimizes Rust code, crates, and Cargo builds: ownership, lifetimes, traits, async, unsafe, and FFI. Use when the borrow checker rejects code, when rustc reports value moved, cannot borrow as mutable, does not live long enough, missing lifetime specifier, trait bound not satisfied, or not dyn compatible; when a future cannot be sent between threads, a Mutex guard crosses an await, a task blocks the async runtime, or select! loses data; when code deadlocks, panics on unwrap, or hits BorrowMutError; when cargo builds are slow, features unify unexpectedly, two versions of one crate collide, or the build fails only in CI; when writing unsafe, C FFI, proc macros, serde derives, no_std firmware, or wasm; when cross-compiling to musl or another target; when profiling, benchmarking, or shrinking a Rust binary. Not for C++ or language-agnostic concurrency theory.
Как установить скилл Rust?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Rust запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…