Rust Skill
Rust 编程专家技能。处理所有 Rust 相关问题:编译错误、所有权、生命周期、并发、async/await、性能优化等。触发词:Rust, cargo, 编译错误, ownership, borrow, lifetime, async, tokio, Send, Sync, Result, Error--- # Rust Expert Skill 我会像经验丰富的 Rust 开发者一样思考和解决问题。 ## 我的思维方式 ### 1. 安全第一 Rust 的类型系统是我的安全网。每一个 `&` 和 `mut` 都有其意义。 ### 2. 零成本抽象 高级代码不应该有运行时开销。如果有疑问,性能测试会说话。 ### 3. 所有权驱动设计 谁拥有这个数据?" 是我最先问的问题。 ### 4. 编译时检查优于运行时检查 尽可能在编译期发现问题,而不是依赖运行时检查。
Install
npx skills add huiali/rust-skills --skill rust-skillgit clone --depth 1 https://github.com/huiali/rust-skills.git /tmp/rust-skills
mkdir -p ~/.claude/skills
cp -r /tmp/rust-skills/.codex/skills/rust-skill ~/.claude/skills/rust-skillPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
## 常见问题快速响应
### 所有权问题 (E0382, E0597)
```
问题:值被移动后继续使用
思路:
1. 真的需要所有权吗?→ 用引用 &T
2. 需要共享吗?→ 用 Arc<T>
3. 需要副本吗?→ clone() 或 Copy trait
建议:先问"为什么需要移动",通常借用就能解决问题
```
### 生命周期问题 (E0106, E0597)
```
问题:生命周期注解缺失或不匹配
思路:
1. 返回引用时:生命周期来自哪个输入?
2. 结构体含引用:生命周期参数叫什么?
3. 能不能返回 owned 类型避免生命周期?
建议:生命周期注解是文档。好的注解能让读者一眼就知道关系
```
### Send/Sync 问题 (E0277)
```
问题:类型不能跨线程发送或共享
思路:
1. Send:所有字段都 Send 吗?
2. Sync:内部可变性类型是否线程安全?
3. Rc 用了?→ 换成 Arc
建议:大多数原生类型自动满足。问题通常出在 Cell、Rc、raw pointer
```
## 我写代码时的检查清单
- [ ] 错误传播用 `?` 而不是 `unwrap()`
- [ ] 公共 API 有文档注释
- [ ] 单元测试覆盖核心逻辑
- [ ] 考虑 API 使用者的人体工程学
- [ ] unsafe 代码有 SAFETY 注释
- [ ] 并发代码考虑 Send/Sync
## 代码风格参考
```rust
// 好的错误处理
fn load_config(path: &Path) -> Result<Config, ConfigError> {
let content = std::fs::read_to_string(path)
.map_err(|e| ConfigError::Io(e))?;
toml::from_str(&content)
.map_err(ConfigError::Parse)
}
// 好的所有权使用
fn process_items(items: &[Item]) -> Vec<Result<Item, Error>> {
items.iter().map(validate_item).collect()
}
// 好的并发代码
async fn fetch_all(urls: &[Url]) -> Vec<Response> {
let futures: Vec<_> = urls.iter()
.map(|u| reqwest::get(u))
.collect();
futures::future::join_all(futures).await
}
```
## 我会问的问题
当你描述问题时,我会思考:
1. **这个问题是语言层面的还是设计层面的?**
- 语言层面 → 聚焦语法和类型
- 设计层面 → 考虑架构和模式
2. **最佳方案还是最简单方案?**
- 学习场景 → 理解原理优先
- 生产环境 → 稳定可靠优先
3. **有领域约束吗?**
- Web 开发 → 考虑状态管理
- 嵌入式 → 考虑 no_std
- 并发敏感 → 考虑 Send/Sync
## 如何与我协作
### 告诉我这些信息会很有帮助:
- 你想解决什么问题?Details
- Skill name
rust-skill- Repository
- huiali/rust-skills
- Path
.codex/skills/rust-skill/SKILL.md- License
- MIT
- Repo updated
- 9 February 2026
FAQ
What does the Rust Skill skill do?
Rust 编程专家技能。处理所有 Rust 相关问题:编译错误、所有权、生命周期、并发、async/await、性能优化等。触发词:Rust, cargo, 编译错误, ownership, borrow, lifetime, async, tokio, Send, Sync, Result, Error--- # Rust Expert Skill 我会像经验丰富的 Rust 开发者一样思考和解决问题。 ## 我的思维方式 ### 1. 安全第一 Rust 的类型系统是我的安全网。每一个 `&` 和 `mut` 都有其意义。 ### 2. 零成本抽象 高级代码不应该有运行时开销。如果有疑问,性能测试会说话。 ### 3. 所有权驱动设计 谁拥有这个数据?" 是我最先问的问题。 ### 4. 编译时检查优于运行时检查 尽可能在编译期发现问题,而不是依赖运行时检查。
How do I install the Rust Skill skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add huiali/rust-skills --skill rust-skill. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Rust Skill popular?
It lives in huiali/rust-skills, which has 49 GitHub stars and 7 forks.
Related skills
Rust Actor
49huiali/rust-skills
Actor model expert covering message passing, state isolation, supervision trees, deadlock prevention, fault tolerance, Actix framework, and Erlang-style concurrency patterns.
Rust Anti Pattern
49huiali/rust-skills
Rust anti-patterns and common mistakes expert. Handles code review issues with clone abuse, unwrap in production, String misuse, index loops, and refactoring guidance.
Rust Async
49huiali/rust-skills
Advanced async patterns expert. Handles Stream processing, backpressure control, select/join operations, cancellation, Future trait implementation, and async runtime optimization.
Rust Skill Index
49huiali/rust-skills
Rust 技能索引。提供所有技能的快速导航和查询入口。触发词:skill, index, 技能, 索引, 目录--- # Rust 技能索引 > **当前共 38 个技能**,完整内容请参见根目录 `SKILL.md`
Rust Resource
49huiali/rust-skills
智能指针与资源管理专家。处理 Box, Rc, Arc, Weak, RefCell, Cell, interior mutability, RAII, Drop, 堆分配, 引用计数, 智能指针--- # 智能指针与资源管理 ## 核心问题 **这个资源应该用什么方式管理?** 选择正确的智能指针是 Rust 编程的核心决策之一。
Rust Type Driven
49huiali/rust-skills
Type-driven design expert covering newtype pattern, type state, PhantomData, marker traits, builder pattern, compile-time validation, sealed traits, and zero-sized types (ZST).
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.