goldziher/ai-rulez/rust-conventions
Claude Code and agent skill by goldziher/ai-rulez
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install goldziher/ai-rulez/rust-conventionsSKILL.md
The same SKILL.md was published earlier as goldziher/ai-rulez/rust-conventions.
- 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.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinginternal/builtins/languages/rust/skills/rust-conventions/SKILL.md
Popularity
- Repository stars
- 155
- Repository forks
- 16
- 7-day trend score
- 30
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/goldziher/ai-rulez/rust-conventions)