rust-best-practices

Enforce Rust workspace best practices for error handling and safe API design.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/neon-law-foundation/navigator --skill rust-best-practices-neon-law-foundation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-best-practices
Source: https://github.com/neon-law-foundation/navigator/tree/main/.claude/skills/rust-best-practices
Command: npx skills add https://github.com/neon-law-foundation/navigator --skill rust-best-practices-neon-law-foundation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill keeps Rust changes aligned with the navigator workspace rules so teams can make safer, cleaner, and more maintainable code decisions without re-reading the full conventions document.

Core Features & Use Cases

  • Error handling guidance for libraries and binaries, including when to use typed errors, anyhow, Result, or Option.
  • API and module design advice for newtypes, trait naming, re-exports, file boundaries, and public surface area.
  • Testing and linting guidance for unit tests, integration tests, clippy warnings, formatting, and unsafe-code avoidance.
  • Use case: before adding a new public function, error type, or clippy allow, ask for a standards check so the change follows workspace policy.

Quick Start

Ask for a review of your Rust change against the workspace conventions, focusing on errors, modules, tests, clippy, and safety.

Frequently Asked Questions about rust-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I use thiserror vs anyhow for Rust error handling?

Use thiserror for typed errors in library crates to provide clear public APIs, and use anyhow at binary crate boundaries for flexible application-level error handling. This separation maintains clean workspace conventions and prevents hidden failure modes.

How do I enforce Rust best practices for unsafe code and unwrap in production?

Enforce Rust best practices by applying strict clippy lint discipline, requiring explicit guardrails against unsafe code, and replacing unwrap or expect calls with proper Result and Option handling to eliminate hidden failure modes.

What's the best way to structure Rust module naming and public API surface area?

Structure Rust modules by following workspace rules for newtypes, trait naming, re-exports, and file boundaries. Review public API surface area changes against these conventions before adding new public functions or error types.

Does clippy allow decisions need workspace-wide standards for Rust testing?

Yes, clippy allow decisions require workspace-wide standards to maintain strict formatting and lint discipline. Check unit tests, integration tests, and lint warnings against workspace policy before approving any clippy allow additions.

How do I review Rust code changes against workspace error handling conventions?

Review Rust code changes by checking error types, Result and Option choices, module naming, and testing patterns against workspace policy. Focus on typed errors with thiserror in libraries and anyhow boundaries in binaries.

Why does my Rust library need typed errors instead of anyhow for public APIs?

Rust libraries need typed errors to define stable public APIs that callers can match on reliably. Using anyhow in a library public surface hides failure modes and prevents downstream code from handling specific error variants explicitly.