rust-development by laurigates/claude-plugins
npx skills add https://github.com/laurigates/claude-plugins --skill rust-development现代系统编程的专家知识,专注于内存安全、无畏并发和零成本抽象。
现代 Rust 生态系统
语言特性
所有权与内存安全
异步编程与并发
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
错误处理与类型安全
性能优化
测试与质量保证
# 项目设置
cargo new my-project # 二进制 crate
cargo new my-lib --lib # 库 crate
cargo init # 在现有目录中初始化
# 开发工作流
cargo build # 调试构建
cargo build --release # 优化构建
cargo run # 构建并运行
cargo run --release # 运行优化版本
cargo test # 运行所有测试
cargo test --lib # 仅运行库测试
cargo bench # 运行基准测试
# 代码质量
cargo clippy # 代码检查
cargo clippy -- -W clippy::pedantic # 更严格的检查
cargo fmt # 格式化代码
cargo fmt --check # 检查格式化
cargo fix # 自动修复警告
# 依赖管理
cargo add serde --features derive # 添加依赖
cargo update # 更新依赖
cargo audit # 安全审计
cargo deny check # 许可证/安全公告检查
# 高级工具
cargo expand # 宏展开
cargo flamegraph # 使用火焰图进行性能分析
cargo doc --open # 生成并打开文档
cargo miri test # 检查未定义行为
# 交叉编译
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown
惯用 Rust 模式
// 使用迭代器替代手动循环
let sum: i32 = numbers.iter().filter(|x| **x > 0).sum();
// 优先使用组合器处理 Option/Result
let value = config.get("key")
.and_then(|v| v.parse().ok())
.unwrap_or_default();
// 有效使用模式匹配
match result {
Ok(value) if value > 0 => process(value),
Ok(_) => handle_zero(),
Err(e) => return Err(e.into()),
}
// 使用 let-else 进行提前返回
let Some(config) = load_config() else {
return Err(ConfigError::NotFound);
};
项目结构
my-project/
├── Cargo.toml
├── src/
│ ├── lib.rs # 库根文件
│ ├── main.rs # 二进制入口点
│ ├── error.rs # 错误类型
│ └── modules/
│ └── mod.rs
├── tests/ # 集成测试
├── benches/ # 基准测试
└── examples/ # 示例程序
错误处理
use thiserror::Error;
#[derive(Error, Debug)]
pub enum AppError {
#[error("IO 错误: {0}")]
Io(#[from] std::io::Error),
#[error("解析错误: {message}")]
Parse { message: String },
#[error("未找到: {0}")]
NotFound(String),
}
pub type Result<T> = std::result::Result<T, AppError>;
常用 Crate
| Crate | 用途 |
|---|---|
serde | 序列化/反序列化 |
tokio | 异步运行时 |
reqwest | HTTP 客户端 |
sqlx | 异步 SQL |
clap | CLI 参数解析 |
tracing | 日志记录/诊断 |
anyhow | 应用程序错误 |
thiserror | 库错误 |
有关详细的异步模式、unsafe 代码指南、WebAssembly 编译、嵌入式开发和高级调试,请参阅 REFERENCE.md。
每周安装数
73
代码仓库
GitHub 星标数
20
首次出现
2026年1月29日
安全审计
安装于
opencode72
github-copilot70
codex70
gemini-cli69
cline69
cursor69
Expert knowledge for modern systems programming with Rust, focusing on memory safety, fearless concurrency, and zero-cost abstractions.
Modern Rust Ecosystem
Language Features
Ownership & Memory Safety
Async Programming & Concurrency
Error Handling & Type Safety
Performance Optimization
Testing & Quality Assurance
# Project setup
cargo new my-project # Binary crate
cargo new my-lib --lib # Library crate
cargo init # Initialize in existing directory
# Development workflow
cargo build # Debug build
cargo build --release # Optimized build
cargo run # Build and run
cargo run --release # Run optimized
cargo test # Run all tests
cargo test --lib # Library tests only
cargo bench # Run benchmarks
# Code quality
cargo clippy # Lint code
cargo clippy -- -W clippy::pedantic # Stricter lints
cargo fmt # Format code
cargo fmt --check # Check formatting
cargo fix # Auto-fix warnings
# Dependencies
cargo add serde --features derive # Add dependency
cargo update # Update deps
cargo audit # Security audit
cargo deny check # License/advisory check
# Advanced tools
cargo expand # Macro expansion
cargo flamegraph # Profile with flame graph
cargo doc --open # Generate and open docs
cargo miri test # Check for UB
# Cross-compilation
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown
Idiomatic Rust Patterns
// Use iterators over manual loops
let sum: i32 = numbers.iter().filter(|x| **x > 0).sum();
// Prefer combinators for Option/Result
let value = config.get("key")
.and_then(|v| v.parse().ok())
.unwrap_or_default();
// Use pattern matching effectively
match result {
Ok(value) if value > 0 => process(value),
Ok(_) => handle_zero(),
Err(e) => return Err(e.into()),
}
// Let-else for early returns
let Some(config) = load_config() else {
return Err(ConfigError::NotFound);
};
Project Structure
my-project/
├── Cargo.toml
├── src/
│ ├── lib.rs # Library root
│ ├── main.rs # Binary entry point
│ ├── error.rs # Error types
│ └── modules/
│ └── mod.rs
├── tests/ # Integration tests
├── benches/ # Benchmarks
└── examples/ # Example programs
Error Handling
use thiserror::Error;
#[derive(Error, Debug)]
pub enum AppError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("parse error: {message}")]
Parse { message: String },
#[error("not found: {0}")]
NotFound(String),
}
pub type Result<T> = std::result::Result<T, AppError>;
Common Crates
| Crate | Purpose |
|---|---|
serde | Serialization/deserialization |
tokio | Async runtime |
reqwest | HTTP client |
sqlx | Async SQL |
clap | CLI argument parsing |
tracing | Logging/diagnostics |
For detailed async patterns, unsafe code guidelines, WebAssembly compilation, embedded development, and advanced debugging, see REFERENCE.md.
Weekly Installs
73
Repository
GitHub Stars
20
First Seen
Jan 29, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode72
github-copilot70
codex70
gemini-cli69
cline69
cursor69
Swift Actor 线程安全持久化:构建离线优先应用的编译器强制安全数据层
1,700 周安装
Datadog自动化监控:通过Rube MCP与Composio实现指标、日志、仪表板管理
69 周安装
Intercom自动化指南:通过Rube MCP与Composio实现客户支持对话管理
69 周安装
二进制初步分析指南:使用ReVa工具快速识别恶意软件与逆向工程
69 周安装
PrivateInvestigator 道德人员查找工具 | 公开数据调查、反向搜索与背景研究
69 周安装
TorchTitan:PyTorch原生分布式大语言模型预训练平台,支持4D并行与H100 GPU加速
69 周安装
screenshot 截图技能:跨平台桌面截图工具,支持macOS/Linux权限管理与多模式捕获
69 周安装
anyhow| Application errors |
thiserror | Library errors |