← ClaudeAtlas

rust-standardslisted

Complete Rust coding, linting, testing, architecture, and layer boundary standards for systemprompt.io development
systempromptio/systemprompt-template · ★ 14 · AI & Automation · score 70
Install: claude install-skill systempromptio/systemprompt-template
# systemprompt.io Rust Standards **systemprompt.io is a world-class Rust programming brand.** Every Rust file must be instantly recognizable as idiomatic Rust as Steve Klabnik would write it. Run `cargo clippy --workspace -- -D warnings` and `cargo fmt --all` after changes. --- ## 1. Idiomatic Rust Prefer iterator chains, combinators, and pattern matching over imperative control flow. ```rust let name = request.name.as_deref().map(str::trim); let value = opt.unwrap_or_else(|| compute_default()); let result = input.ok_or_else(|| Error::Missing)?; let valid_items: Vec<_> = items .iter() .filter(|item| item.is_active()) .map(|item| item.to_dto()) .collect(); ``` | Anti-Pattern | Idiomatic | |--------------|-----------| | `if let Some(x) = opt { x } else { default }` | `opt.unwrap_or(default)` | | `match opt { Some(x) => Some(f(x)), None => None }` | `opt.map(f)` | | `if condition { Some(x) } else { None }` | `condition.then(\|\| x)` | | Nested `if let` / `match` | Combine with `and_then`, `map`, `ok_or` | | Manual loops building `Vec` | Iterator chains with `collect()` | --- ## 2. Limits | Metric | Limit | |--------|-------| | Source file length | 300 lines | | Cognitive complexity | 15 | | Function length | 75 lines | | Parameters | 5 | --- ## 3. Forbidden Constructs | Construct | Resolution | |-----------|------------| | `unsafe` | Remove - forbidden in this codebase | | `unwrap()` | Use `?`, `ok_or_else()`, or `expect()` with message | | `unwrap_