rust-conventions
БесплатноБез исполняемых скриптовНе проверенRust conventions: edition, fmt and clippy, error crates and propagation, unsafe documentation, API naming guidelines, traits, testing, benchmarks, tokio…
от Goldziher★ 182 звезды на GitHubОб этом скилле
- Rust 2024 edition,
cargo fmt+clippy -D warnings, zero warnings policy. Result<T, E>with a derive-based error crate (e.g., thiserror) for library errors, a context-adding error crate (e.g., anyhow) for applications.?for propagation — never.unwrap()in library code.- Minimize
unsafe— every block needs// SAFETY:comment explaining invariants. - Prefer
&stroverStringin params,Cow<'_, str>for conditional ownership,Arcfor shared ownership. impl Traitin argument position for static dispatch,dyn Traitfor dynamic dispatch when heterogeneous collections needed.- Small, focused modules. Use
pub(crate)for internal visibility. Workspace inheritance for multi-crate repos. #[cfg(test)]for unit tests,tests/for integration, a coverage tool (e.g., cargo-llvm-cov) for coverage.- Benchmarking: a statistical benchmark harness (e.g., criterion) for microbenchmarks, profile with a flamegraph tool (e.g., cargo flamegraph).
- Async:
tokioruntime,'static + Send + Syncbounds,tokio::spawnfor concurrency. - Security:
cargo auditfor CVE scanning,cargo denyfor license and advisory policies. - Dependencies: pin versions, commit
Cargo.lock, prefer well-maintained crates. - Structured logging (spans and events, e.g., the
tracingcrate) — notprintln!. - API naming: follow
as_/to_/into_conventions for conversions,iter()/iter_mut()/into_iter()for iterators. Getters arefield()notget_field(). See Rust API Guidelines. - Eagerly implement common traits:
Clone,Debug,Default,Eq,PartialEq,Hash,Send,Sync. UseFrom/AsRef/AsMutfor conversions,FromIterator/Extendfor collections. - Type safety: newtypes for static distinctions, builder pattern for complex construction,
bitflagsover enums for flag sets. Avoidboolparams — use custom types or enums. - Constructors:
new()as static inherent methods. No out-parameters. Only smart pointers implementDeref/DerefMut. - API flexibility: minimize parameter assumptions via generics, make traits object-safe when trait objects may be useful. Let callers decide where to copy and place data.
- Rustdoc: all public items have doc examples using
?(notunwrap). Document errors, panics, and safety invariants. Hyperlink related items. - Future-proofing: seal traits to prevent downstream implementations, keep struct fields private, don't duplicate derived trait bounds on structs. See Rust Design Patterns.
- Anti-patterns:
unwrap(), unguardedunsafe, panics in libraries,Vec/HashMapacross FFI.
Установить rust-conventions в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл rust-conventions?
Rust conventions: edition, fmt and clippy, error crates and propagation, unsafe documentation, API naming guidelines, traits, testing, benchmarks, tokio, cargo audit. Use when writing or reviewing Rust code.
Как установить скилл rust-conventions?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл rust-conventions запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
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