bp-rust

Enforce Rust best-practice guidelines for Rust source files.

9|4|Updated May 30, 2025
One-click install
npx skills add https://github.com/Kaikei-e/Alt --skill bp-rust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bp-rust
Source: https://github.com/Kaikei-e/Alt/tree/main/.claude/skills/bp-rust
Command: npx skills add https://github.com/Kaikei-e/Alt --skill bp-rust

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a concise, prescriptive set of Rust best-practice rules to keep repository Rust code consistent, safe, and maintainable across services and contributors, emphasizing Edition 2024 compatibility, error handling, ownership patterns, async runtimes, and logging conventions.

Core Features & Use Cases

  • Edition and project structure: Require edition = 2024 and a clean lib.rs / main.rs separation to keep entrypoints thin.
  • Error handling guidance: Prefer thiserror-derived domain errors and restrict anyhow to binary entrypoints.
  • Ownership, async, and logging: Favor borrowing over cloning, use tokio for async and tracing for logs, and avoid println!/eprintln!.
  • Visibility and exhaustiveness: Default to pub(crate) for non-public APIs and prefer explicit match arms to detect future variants.
  • Use case: Use during code edits, PR reviews, or when implementing rask-log-aggregator, rask-log-forwarder, or recap-worker services to align code with repository standards.

Quick Start

Review the modified Rust file and apply the bp-rust guidelines from docs/best_practices/rust.md so it uses edition = 2024, thiserror for domain errors, pub(crate) visibility by default, borrow-first argument patterns, tokio and tracing, and a minimal main.rs.

Frequently Asked Questions about bp-rust

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

FAQPage Schema
What are the best practices for Rust error handling in production services?

Rust async best practices use the tokio runtime for concurrent operations and the tracing crate for structured logging. This combination replaces println! and eprintln! calls to provide observable, production-ready async execution context across services.

How do I structure a Rust project using edition 2024?

Structure Rust edition 2024 projects with a clean lib.rs and main.rs separation, keeping main.rs thin. Default to pub(crate) visibility for non-public APIs and use explicit match arms to ensure exhaustive variant handling for future maintainability.

Should I borrow or clone arguments in Rust functions?

Favor borrowing over cloning arguments in Rust functions using borrow-first argument patterns. This ownership practice reduces unnecessary memory allocations and aligns with safe, idiomatic Rust code standards for production-ready services.

Can I use anyhow for domain errors across my Rust library?

Avoid using anyhow for domain errors across Rust libraries; restrict it to binary entrypoints. Use thiserror-derived domain error types instead to maintain explicit, typed error handling and improve exhaustive match detection in library code.