rust-patterns
Skill8 starsChanged 10 months agoMITView on GitHub
Rust patterns, ownership best practices, and production-ready code guidelines
14 other projects use a version of this.
Adopted by
Most recently taken up by
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- MortuisVMain/ai-agent-superpowerstheir own version, first seen Sep 15, 2026
- talayash/agentriumtheir own version, first seen Sep 11, 2026
- lukemurraynz/hve-agent-skillstheir own version, first seen Aug 27, 2026
- idexal/idexal-skillstheir own version, first seen Aug 26, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
Used with
Projects with it also use kotlin-testing, carrier-relationship-management and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
tpavanipradeepSkillkotlin-testing
Kotlin testing patterns with Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. Follows TDD methodology with idiomatic Kotlin practices.
Also in 4 projects that use this
InfopibeSkillcarrier-relationship-management
Codified expertise for managing carrier portfolios, negotiating freight rates, tracking carrier performance, allocating freight, and maintaining strategic carrier relationships. Informed by transportation managers with 15+ years experience. Includes scorecarding frameworks, RFP processes, market intelligence, and compliance vetting. Use when managing carriers, negotiating rates, evaluating carrier performance, or building freight strategies.
Also in 5 projects that use this
InfopibeSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 5 projects that use this
mryeastcodeSkillsanta-method
Multi-agent adversarial verification with convergence loop. Two independent review agents must both pass before output ships.
Also in 4 projects that use this
tpavanipradeepSkillbun-runtime
Bun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support.
Also in 5 projects that use this
saxon-ySkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 5 projects that use this
- +1 more from Infopibe
- +1 more from tpavanipradeep
Other versions14 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 14
- loulanyue/awesome-claude-notes★ 272same name
- tpavanipradeep/everything-claude-code★ 134same name
- templetongroup/radiant★ 113same name
- FlorianBruniaux/ccboard★ 96same name
- Jamkris/everything-gemini-code★ 87same name
- talayash/agentrium★ 42same name
- idexal/idexal-skills★ 13same name
- peopleforrester/claude-dotfiles★ 3same name
- JunMystery/Agent-Guidance-Python★ 2same name
- lukemurraynz/hve-agent-skills★ 2same name
4 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- api-rest-designSkill
- brandkitSkill
- industrial-brutalist-uiSkill
- bug-fixingSkill
- ci-cd-pipelinesSkill
- code-documentationSkill
- context7Skill
- design-an-interfaceSkill
- docker-patternsSkill
- feature-developmentSkill
- frontend-designSkill
- git-commitSkill
- git-releaseSkill
- git-team-workflowSkill
- go-conventionsSkill
- gpt-tasteSkill
- imagegen-frontend-mobileSkill
- imagegen-frontend-webSkill
- image-to-codeSkill
- issue-writingSkill
- kubernetes-patternsSkill
- microservices-patternsSkill
- minimalist-uiSkill
- mongodb-patternsSkill
- observability-monitoringSkill
- full-output-enforcementSkill
- performance-optimizationSkill
- postgresql-patternsSkill
- prdSkill
- pr-writingSkill
- python-patternsSkill
- redesign-existing-projectsSkill
- refactoring-safelySkill
- security-best-practicesSkill
- skill-creatorSkill
- high-end-visual-designSkill
- spec-driven-developmentSkill
- sqlserver-patternsSkill
- stitch-design-tasteSkill
- task-managementSkill
- design-taste-frontendSkill
- testing-strategiesSkill
- ts-react-nextjsSkill
- ts-vue-svelteSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 337
Use this skill when:
“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust Patterns Skill
Overview
This skill provides guidelines for writing safe, efficient, and idiomatic Rust code, covering ownership, lifetimes, error handling, and async patterns for production systems with Actix/Tokio.
Core Principles
1. Ownership and Borrowing
// DO: Use ownership transfer for large data
fn process_data(data: Vec<u8>) -> ProcessedData {
// Takes ownership, no copy
ProcessedData::from(data)
}
// DO: Borrow for read-only access
fn print_info(data: &[u8]) {
// Immutable borrow
println!("{:?}", data);
}
// DO: Mutable borrow for modification
fn update_buffer(buf: &mut Vec<u8>) {
buf.push(0);
}
// DON'T: Create multiple mutable references
let mut data = vec![1, 2, 3];
let ref1 = &mut data;
let ref2 = &mut data; // ERROR!2. Lifetimes
// DO: Explicit lifetimes for function signatures
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
if x.len() > y.len() { x } else { y }
}
// DO: Struct lifetimes
struct Parser<'a> {
input: &'a str,
}
impl<'a> Parser<'a> {
fn new(input: &'a str) -> Self {
Self { input }
}
fn parse(&self) -> Result<&str, Error> {
Ok(&self.input[..5])
}
}
// DO: 'static for owned data
const CONFIG: Config = Config {
timeout: 30,
};3. Error Handling
// DO: Use Result for recoverable errors
fn read_config(path: &str) -> Result<Config, io::Error> {
let content = fs::read_to_string(path)?;
let config: Config = serde_json::from_str(&content)?;
Ok(config)
}
// DO: Custom error types
#[derive(Debug, thiserror::Error)]
enum AppError {
#[error("io error: {0}")]
Io(#[from] io::Error),
#[error("parse error: {0}")]
Parse(#[from] serde_json::Error),
#[error("validation failed: {message}")]
Validation { message: String },
#[error("not found: {resource}")]
NotFound { resource: String },
}
type Result<T> = std::result::Result<T, AppError>;
// DO: Use ? operator for early returns
fn process_file(path: &str) -> Result<ProcessedData> {
let content = fs::read_to_string(path)?; // Early return on error
let data = parse_content(&content)?;
validate_data(&data)?;
Ok(data)
}4. Option and Result Combinators
// DO: Use combinators instead of match where clear
let value = config.get("timeout")
.and_then(|v| v.parse::<u64>().ok())
.unwrap_or(30);
// DO: map for transformations
let upper = maybe_string.map(|s| s.to_uppercase());
// DO: ok_or for converting Option to Result
let port = env::var("PORT")
.ok()
.and_then(|p| p.parse().ok())
.ok_or(AppError::Validation {
message: "PORT must be a valid number".into(),
})?;5. Smart Pointers
// DO: Box for recursive types
enum Node {
Value(i32),
Cons(i32, Box<Node>),
}
// DO: Rc for shared ownership (single-threaded)
use std::rc::Rc;
let shared_data: Rc<Vec<u8>> = Rc::new(vec![1, 2, 3]);
let clone1 = Rc::clone(&shared_data);
let clone2 = Rc::clone(&shared_data);
// DO: Arc for thread-safe shared ownership
use std::sync::Arc;
let data: Arc<Vec<u8>> = Arc::new(vec![1, 2, 3]);
// DO: Mutex/RwLock for interior mutability
use std::sync::{Arc, Mutex};
let counter = Arc::new(Mutex::new(0));
let counter_clone = Arc::clone(&counter);
std::thread::spawn(move || {
let mut num = counter_clone.lock().unwrap();
*num += 1;
});Async Patterns (Tokio)
// DO: Use async/await
async fn fetch_data(url: &str) -> Result<Vec<u8>, reqwest::Error> {
let response = reqwest::get(url).await?;
let bytes = response.bytes().await?;
Ok(bytes.to_vec())
}
// DO: Concurrent execution with join!
use futures::join;
async fn fetch_multiple() -> Result<(Vec<u8>, Vec<u8>), Error> {
let (result1, result2) = join!(
fetch_data("https://api1.example.com"),
fetch_data("https://api2.example.com"),
);
Ok((result1?, result2?))
}
// DO: Spawn tasks for parallel work
async fn process_batch(items: Vec<Item>) -> Vec<Result<ProcessedItem, Error>> {
let handles: Vec<_> = items
.into_iter()
.map(|item| {
tokio::spawn(async move {
process_item(item).await
})
})
.collect();
let mut results = Vec::new();
for handle in handles {
results.push(handle.await.unwrap());
}
results
}
// DO: Use channels for communication
use tokio::sync::mpsc;
async fn worker(mut rx: mpsc::Receiver<Job>) {
while let Some(job) = rx.recv().await {
process_job(job).await;
}
}Actix Web Patterns
// DO: Application state with Arc
struct AppState {
db: Arc<dyn Database>,
config: Arc<Config>,
}
async fn handler(data: web::Data<AppState>) -> impl Responder {
let result = data.db.query().await;
HttpResponse::Ok().json(result)
}
// DO: Extractors for request data
#[derive(Deserialize)]
struct CreateUserRequest {
name: String,
email: String,
}
async fn create_user(
data: web::Data<AppState>,
req: web::Json<CreateUserRequest>,
) -> Result<HttpResponse, Error> {
let user = data.db.create_user(req.into_inner()).await?;
Ok(HttpResponse::Created().json(user))
}
// DO: Custom middleware
fn auth_middleware() -> impl Transform<ServiceRequest, Response = ServiceResponse, Error = Error> {
fn transform<S>(service: S) -> AuthMiddleware<S> {
AuthMiddleware { service }
}
middleware::from_fn(|req, srv| async move {
if !is_authenticated(&req) {
return Err(ErrorUnauthorized("Unauthorized"));
}
srv.call(req).await
})
}Structs and Enums
// DO: Builder pattern for complex structs
#[derive(Default)]
struct ConfigBuilder {
host: Option<String>,
port: Option<u16>,
workers: Option<usize>,
}
impl ConfigBuilder {
fn host(mut self, host: impl Into<String>) -> Self {
self.host = Some(host.into());
self
}
fn port(mut self, port: u16) -> Self {
self.port = Some(port);
self
}
fn build(self) -> Config {
Config {
host: self.host.unwrap_or_else(|| "localhost".into()),
port: self.port.unwrap_or(8080),
workers: self.workers.unwrap_or(4),
}
}
}
// DO: Use enums for state machines
enum ConnectionState {
Disconnected,
Connecting { since: Instant },
Connected { socket: TcpStream },
Error { reason: String },
}
impl ConnectionState {
fn is_connected(&self) -> bool {
matches!(self, ConnectionState::Connected { .. })
}
}Testing
// DO: Unit tests in the same file
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_async_function() {
let result = async_function().await;
assert!(result.is_ok());
}
#[test]
fn test_with_fixture() {
let fixture = create_test_fixture();
let result = process(fixture);
assert_eq!(result, expected);
}
}
// DO: Mock with traits
trait Database {
async fn query(&self) -> Result<Vec<Row>, Error>;
}
struct MockDb {
results: Vec<Row>,
}
#[async_trait]
impl Database for MockDb {
async fn query(&self) -> Result<Vec<Row>, Error> {
Ok(self.results.clone())
}
}When to Use
Use this skill when:
- Writing or reviewing Rust code
- Handling complex ownership/lifetime scenarios
- Implementing async/await code
- Building web services with Actix
- Writing concurrent/parallel code
- Designing Rust APIs
- Refactoring for performance
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

