Reviewed by 20X · No signed release verified
- Works with (as stated by the author)
- Claude Code, Cursor
Review details
- Human review
- Review recorded for these files
- Limited checks
- Limited checks recorded (v2.1.0)
- Source
- Source not verified
A verified signature checks published file bytes against a trusted publisher’s signed manifest. It does not verify safety, authorship, rights or assistant use.
Declarations and limited checks do not guarantee safety or sharing rights. Review the files before use. Access that the author has not stated is unknown.
How to use it
- 1Save the file under ~/.claude/rules/ (all projects) or .claude/rules/ inside a project.
- 2Remove any sections that don't apply to your work.
- 3Start a new Claude Code session so the rule is loaded.
Community results
0 reportsNo one has shared a result yet.
1 file. Filenames and raw files are in Technical details.
paths:
- "**/*.rs"
Rust Coding Style
This file extends common/coding-style.md with Rust-specific content.
Formatting
- rustfmt for enforcement — always run
cargo fmtbefore committing - clippy for lints —
cargo clippy -- -D warnings(treat warnings as errors) - 4-space indent (rustfmt default)
- Max line width: 100 characters (rustfmt default)
Immutability
Rust variables are immutable by default — embrace this:
- Use
letby default; only uselet mutwhen mutation is required - Prefer returning new values over mutating in place
- Use
Cow<'_, T>when a function may or may not need to allocate
use std::borrow::Cow;
// GOOD — immutable by default, new value returned
fn normalize(input: &str) -> Cow<'_, str> {
if input.contains(' ') {
Cow::Owned(input.replace(' ', "_"))
} else {
Cow::Borrowed(input)
}
}
// BAD — unnecessary mutation
fn normalize_bad(input: &mut String) {
*input = input.replace(' ', "_");
}
Naming
Follow standard Rust conventions:
snake_casefor functions, methods, variables, modules, cratesPascalCase(UpperCamelCase) for types, traits, enums, type parametersSCREAMING_SNAKE_CASEfor constants and statics- Lifetimes: short lowercase (
'a,'de) — descriptive names for complex cases ('input)
Ownership and Borrowing
- Borrow (
&T) by default; take ownership only when you need to store or consume - Never clone to satisfy the borrow checker without understanding the root cause
- Accept
&stroverString,&[T]overVec<T>in function parameters - Use
impl Into<String>for constructors that need to own aString
// GOOD — borrows when ownership isn't needed
fn word_count(text: &str) -> usize {
text.split_whitespace().count()
}
// GOOD — takes ownership in constructor via Into
fn new(name: impl Into<String>) -> Self {
Self { name: name.into() }
}
// BAD — takes String when &str suffices
fn word_count_bad(text: String) -> usize {
text.split_whitespace().count()
}
Error Handling
- Use
Result<T, E>and?for propagation — neverunwrap()in production code - Libraries: define typed errors with
thiserror - Applications: use
anyhowfor flexible error context - Add context with
.with_context(|| format!("failed to ..."))? - Reserve
unwrap()/expect()for tests and truly unreachable states
// GOOD — library error with thiserror
#[derive(Debug, thiserror::Error)]
pub enum ConfigError {
#[error("failed to read config: {0}")]
Io(#[from] std::io::Error),
#[error("invalid config format: {0}")]
Parse(String),
}
// GOOD — application error with anyhow
use anyhow::Context;
fn load_config(path: &str) -> anyhow::Result<Config> {
let content = std::fs::read_to_string(path)
.with_context(|| format!("failed to read {path}"))?;
toml::from_str(&content)
.with_context(|| format!("failed to parse {path}"))
}
Iterators Over Loops
Prefer iterator chains for transformations; use loops for complex control flow:
// GOOD — declarative and composable
let active_emails: Vec<&str> = users.iter()
.filter(|u| u.is_active)
.map(|u| u.email.as_str())
.collect();
// GOOD — loop for complex logic with early returns
for user in &users {
if let Some(verified) = verify_email(&user.email)? {
send_welcome(&verified)?;
}
}
Module Organization
Organize by domain, not by type:
src/
├── main.rs
├── lib.rs
├── auth/ # Domain module
│ ├── mod.rs
│ ├── token.rs
│ └── middleware.rs
├── orders/ # Domain module
│ ├── mod.rs
│ ├── model.rs
│ └── service.rs
└── db/ # Infrastructure
├── mod.rs
└── pool.rs
Visibility
- Default to private; use
pub(crate)for internal sharing - Only mark
pubwhat is part of the crate's public API - Re-export public API from
lib.rs
References
See skill: rust-patterns for comprehensive Rust idioms and patterns.
Latest changes
Initial reviewed release.
Version history
v1.0.0
Initial reviewed release.
File access pausedFile verification
- File integrity
No signed release verified for this version.
This checks published bytes, not safety, authorship, rights or assistant use.
Full compatibility
As stated by the author: Claude Code, Cursor
Included files
1 filecoding-style.md
markdownPublic file access is temporarily paused.
Use in your own tool
Save this resource and connect your assistant in the Use with flow before copying a test request.
Related resources
Dart/Flutter Coding Style (ECC)
Dart/Flutter-specific coding style: formatting tools, idioms, immutability, error handling, and naming.
Claude Code, Cursor
- Rating
- Not rated
- Recorded downloads in the past 90 days
- 0
- Updated
- Nov 11
Cypress E2E Testing Rules
Cypress end-to-end testing conventions: selectors, commands, fixtures, and flake prevention.
Cursor
- Rating
- Not rated
- Recorded downloads in the past 90 days
- 0
- Updated
- Nov 11
Karpathy-Inspired Coding Guidelines (CLAUDE.md)
Four behavioral rules that stop AI coding agents from over-engineering, guessing, and making unrelated edits.
Claude Code
- Rating
- Not rated
- Recorded downloads in the past 90 days
- 0
- Updated
- Oct 3