goldziher/ai-rulez/rust-conventions

Claude Code and agent skill by goldziher/ai-rulez

Trust tier 2
  • community
LLM review pending
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-conventions

SKILL.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 &str over String in params, Cow<'_, str> for conditional ownership, Arc for shared ownership.
  • impl Trait in argument position for static dispatch, dyn Trait for 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: tokio runtime, 'static + Send + Sync bounds, tokio::spawn for concurrency.
  • Security: cargo audit for CVE scanning, cargo deny for license and advisory policies.
  • Dependencies: pin versions, commit Cargo.lock, prefer well-maintained crates.
  • Structured logging (spans and events, e.g., the tracing crate) — not println!.
  • API naming: follow as_/to_/into_ conventions for conversions, iter()/iter_mut()/into_iter() for iterators. Getters are field() not get_field(). See Rust API Guidelines.
  • Eagerly implement common traits: Clone, Debug, Default, Eq, PartialEq, Hash, Send, Sync. Use From/AsRef/AsMut for conversions, FromIterator/Extend for collections.
  • Type safety: newtypes for static distinctions, builder pattern for complex construction, bitflags over enums for flag sets. Avoid bool params — use custom types or enums.
  • Constructors: new() as static inherent methods. No out-parameters. Only smart pointers implement Deref/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 ? (not unwrap). 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(), unguarded unsafe, panics in libraries, Vec/HashMap across 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/goldziher/ai-rulez/rust-conventions/badge)](https://verified-skill.com/skills/goldziher/ai-rulez/rust-conventions)

Something wrong with this skill or its page? Tell us.