swe-programming-rustlisted
Install: claude install-skill wahidyankf/ose-primer
# Rust Coding Standards
## Purpose
Progressive disclosure of Rust coding standards for agents writing Rust code.
**Usage**: Auto-loaded for agents when writing Rust code. Provides quick reference to idioms, best practices, and antipatterns.
**Authoritative Source**: [docs/explanation/software-engineering/programming-languages/rust/README.md](../../../docs/explanation/software-engineering/programming-languages/rust/README.md)
## Prerequisite Knowledge
**IMPORTANT**: This skill provides **demo-specific style guides**, not educational tutorials.
Complete the demo Rust learning path first:
## Quick Standards Reference
### Naming Conventions
**Types/Traits/Enums**: PascalCase - `ZakatCalculator`, `MurabahaContract`, `PaymentStatus`
**Functions/Variables/Modules**: snake_case - `calculate_zakat`, `total_amount`, `zakat_service`
**Constants/Statics**: UPPER_SNAKE_CASE - `MAX_NISAB_THRESHOLD`, `ZAKAT_RATE`
**Lifetimes**: short lowercase - `'a`, `'b` (descriptive when helpful: `'contract`)
### Error Handling (Result/Option)
```rust
// CORRECT: thiserror for domain errors
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ZakatError {
#[error("Wealth cannot be negative: {0}")]
NegativeWealth(rust_decimal::Decimal),
#[error("Repository error: {0}")]
Repository(#[from] sqlx::Error),
}
// CORRECT: Result<T,E> for fallible operations
pub fn calculate_zakat(
wealth: Decimal,
nisab: Decimal,
) -> Result<Decimal, ZakatError> {
if wealth < Decim