omh-rust
它能做什么
该技能指导 Rust 代码改动,对所有权、错误处理和不安全代码格外谨慎。适合编写或修复 Rust 程序的开发者。
适用场景
- ✓当你遇到 Rust 借用检查器或生命周期错误,需要一个清晰的修复方案时。
- ✓当你要用 Rust 重写代码,并希望有所有权和错误处理的计划时。
- ✓当你的 Rust 代码使用了 unsafe 或外部函数代码,需要仔细审查时。
技能链接
https://github.com/rlaope/oh-my-hermes/blob/main/agent-skills/omh-rust/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请用 Rust 重写这个解析器,并修复借用检查器错误,同时不破坏生命周期。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体规划所有权和错误处理,准备改动,并列出需要运行的检查。在被认定为安全之前,unsafe 或外部代码会经过更严格的审查。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Rust
This is an OMH rust workflow skill, projected for Agent Skills hosts (Claude Code, Codex, Cursor, opencode, OpenClaw, pi).
Why This Exists
rust closes OMH's zero-coverage Rust domain and makes the escalation from ordinary Rust work to undefined-behavior discipline a deterministic routing rule rather than something a model is trusted to notice.
Do Not Use When
- The request is a server, API, or schema design that happens to mention a Rust stack; use
omh-backendfor the contract and name Rust as the stack. - The request is debugging a stripped or source-less native binary; use
omh-native-debugging. - The request is a general code review of finished Rust; use
omh-code-review. - The request is a Rust vocabulary or concept question with no change to prepare; answer it directly.
Examples
Good example:
- Prompt: Rewrite this parser in Rust and fix the borrow checker errors.
- Expected behavior: Prepare rust_change_contract/v1 with the escalation verdict, ownership_shape/v1 for the parser's borrows, error_and_api_contract/v1, and rust_gate_list/v1.
- Why: The request is a Rust change whose difficulty is ownership shape, which is exactly what the contract has to settle before code.
Bad example:
- Prompt: It compiles and the unsafe block looks fine, so call the FFI wrapper safe.
- Expected behavior: Escalate on the
unsafe/FFI trigger, mark Miri and sanitizer evidence as not_observed, and name them as blocking items. - Why: Compilation proves nothing about the invariant an
unsafeblock asserts, and the escalation is not optional.
Completion Checklist
- The escalation verdict is stated with the trigger that decided it.
- The ownership shape names owners, borrows across boundaries, and every deliberate clone.
- The error type, its conversion boundary, and every surviving
unwrap/expect/panic!are named. - The gate list names the exact commands the executor must run and pass, covering every target, the feature extremes, doc tests, and the declared MSRV.
- An escalated change carries the Miri, sanitizer, and concurrency-testing requirements as blocking items.
- Compiler, clippy, test, Miri, sanitizer, and loom results stay observed-only.
Recovery Notes
- If the crate cannot be inspected, escalate by default and say the verdict is conservative rather than measured.
- If the toolchain cannot run Miri or a sanitizer for the escalated change, keep the change blocked and name the smallest substitute proof instead of downgrading the verdict.
When to Use
Use when Hermes should prepare a Rust change: ownership and lifetime shape, error and API types, cargo/clippy gates, and the mandatory UB escalation when the change touches unsafe, raw pointers, FFI, MaybeUninit, or lock-free primitives.
Strong routing signals: `rust`, `rust code`, `rust skill`, `rustlang`, `borrow checker`, `lifetime error`, `ownership error`, `trait bound`, `cargo build`, `cargo clippy`, `clippy lint`, `unsafe rust`, `unsafe block`, `raw pointer`, `maybeuninit`, `rust ffi`, `extern c`, `undefined behavior`, `miri`, `loom`, `ボローチェッカー`, `所有権エラー`, `ライフタイムエラー`, `トレイト境界`, `러스트`, `러스트 코드`, `빌림 검사기`, `소유권 에러`, `라이프타임 에러`, `언세이프`, `미정의 동작`, `借用检查器`, `所有权错误`, `生命周期错误`, `特征约束`, `bantu atasi error borrow checker`, `perbaiki masalah ownership Rust`, `jelaskan error lifetime Rust`, `tolong beresin error cargo clippy`, `tinjau blok unsafe Rust ini`, `giúp xử lý lỗi borrow checker`, `sửa vấn đề ownership trong Rust`, `giải thích lỗi lifetime trong Rust`, `hãy sửa lỗi cargo clippy`, `rà soát khối unsafe Rust này`
Catalog Metadata
Category: planning
Phase: rust-development
Quality tier: rust-safety-gated
Reasoning demand: standard
Quality bar:
- Run the escalation check before anything else and state the verdict; a change whose
unsafe/FFI status is unknown is escalated by default. - Load
references/rust-discipline.mdfor the ownership, error, API, binary-interface, and dependency rules, and name the gate commands from it rather than assumingcargo buildis the whole bar. - When the escalation triggers, load
references/ub-escalation.mdand carry its Miri, sanitizer, and loom-style concurrency requirements into the handoff as blocking items. - Name the ownership decision behind every clone,
Arc, interior-mutability wrapper, and lifetime annotation the change introduces. - Name the error type and its conversion boundary; a surviving
unwrapneeds a written reason, not silence. - Keep compilation, c
常见问题
它会替我运行 Rust 编译器吗?
它准备改动和需要运行的检查。构建和测试由你或你的工具运行。
编译通过是否意味着我的 unsafe 代码是安全的?
不是。unsafe 代码需要它自己的检查,该技能对此有明确说明。
它能审查已经完成的 Rust 代码吗?
对于已经完成的代码,代码审查技能更合适。
详情
作者的原始描述
[omh] Rust ownership, lifetime, or unsafe trouble: prepare Rust changes with ownership, error, and API discipline, and escalate any unsafe, FFI, or lock-free change to the UB checklist. Use when the user says: rust, rust code, rust skill, rustlang, borrow checker, lifetime error, ownership error, trait bound.
repo: rlaope/oh-my-hermes
热度
- GitHub 星标
- 5.1k
- 排名
- #15159
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
omh-accessibility-audit
5.1k帮你的智能体检查某个界面或流程是否存在无障碍问题,例如键盘使用、屏幕阅读器标签、对比度和触控目标大小。
omh-adversarial-consensus
5.1k在你做出决定之前,帮你的智能体从几个独立角度质疑一个技术方案,然后总结哪些观点经得起推敲。
omh-agent-debug
5.1k帮你的智能体找出另一个 AI 智能体为何卡住、陷入循环或偏离任务,并提出最小且安全的恢复方法。
omh-agent-instructions
5.1k帮你的智能体编写或更新指令文件,例如 AGENTS.md 或 CLAUDE.md,告诉 AI 工具如何在项目中工作。