rust

Rust language patterns and ecosystem covering ownership, borrowing, lifetimes, error handling (Result/Option, thiserror, anyhow), async with Tokio, traits, generics, serde serialization, Cargo workspaces, and testing. Includes axum web framework, ratatui terminal UI, clap CLI parsing, criterion benchmarking, cargo-deny supply chain security, cargo-dist binary distribution, and release-plz changelog automation. Use when writing Rust code, designing ownership models, building async services with Tokio/axum, creating terminal UIs with ratatui, setting up CLI applications with clap, configuring CI/CD pipelines for Rust, benchmarking with criterion, auditing dependencies with cargo-deny, or distributing binaries with cargo-dist.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "rust" with this command: npx skills add oakoss/agent-skills/oakoss-agent-skills-rust

Rust

Overview

Rust is a systems programming language focused on safety, concurrency, and performance. The ownership system guarantees memory safety without garbage collection, and the type system enforces thread safety at compile time.

When to use: Systems programming, web services (axum), CLI tools (clap), terminal UIs (ratatui), WebAssembly, performance-critical applications, anything requiring memory safety without runtime overhead.

When NOT to use: Rapid prototyping where compile times matter more than safety, simple scripting tasks, projects where the team has no Rust experience and deadlines are tight.

Quick Reference

PatternAPI / ToolKey Points
Ownership transferlet b = a;a is moved, no longer usable
Borrowing&T / &mut TOne mutable OR many immutable refs
Lifetime annotationfn f<'a>(x: &'a str) -> &'a strTies output lifetime to input
Error propagation? operatorConverts and propagates errors
Custom errorsthiserror::Error deriveStructured error types with Display
Ad-hoc errorsanyhow::Result<T>Context chaining for applications
Async runtime#[tokio::main]Entry point for async programs
Spawn tasktokio::spawn(async { })Concurrent async task execution
HTTP routeraxum::Router::new().route(...)Composable routing with extractors
ExtractorsJson<T>, Path<T>, State<T>Type-safe request parsing
Serialization#[derive(Serialize, Deserialize)]serde with format-agnostic derives
CLI parsing#[derive(Parser)]clap derive API for arg parsing
TUI renderingterminal.draw(|f| { })Immediate-mode ratatui rendering
Benchmarkingcriterion::CriterionStatistical benchmarking framework
Dep auditingcargo deny checkLicense, vulnerability, source audit
Binary releasecargo dist initCross-platform binary distribution
Changelogrelease-plz updateAuto semver bump and changelog

Common Mistakes

MistakeCorrect Pattern
Returning reference to local variableReturn owned type or use lifetime parameter
Using unwrap() in library codeReturn Result and let caller decide
clone() to satisfy borrow checkerRestructure code to avoid the borrow conflict
Blocking in async contextUse tokio::task::spawn_blocking
Shared mutable state without syncUse Arc<Mutex<T>> or channels
String where &str sufficesAccept &str in function parameters
Ignoring must_use warningsHandle or explicitly discard with let _ =
Large enum variantsBox the large variant to reduce overall size
async fn in traits without boundsAdd Send bound or use async-trait crate
Missing #[tokio::test] on async testsUse #[tokio::test] instead of #[test]

Delegation

  • Code exploration: Use Explore agent
  • Architecture review: Use Task agent
  • Code review: Delegate to code-reviewer agent

If the docker skill is available, delegate multi-stage container build patterns to it. If the github-actions skill is available, delegate CI pipeline configuration to it. If the openapi skill is available, delegate API specification and code generation to it.

References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Security

application-security

No summary provided by upstream source.

Repository SourceNeeds Review
Security

database-security

No summary provided by upstream source.

Repository SourceNeeds Review
Security

quality-auditor

No summary provided by upstream source.

Repository SourceNeeds Review