用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill godmoderust-conventions命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
基于 SOC 职业分类
正在显示 SKILL.md
| name | godmoderust-conventions |
| description | > Use when this capability is needed. |
Apply these rules to all Rust code written in this workspace. Prioritise readability, safety, and maintainability in that order.
Follow RFC 430 naming conventions throughout:
| Item | Convention | Example |
|---|---|---|
| Types, traits, enums | UpperCamelCase | TaskGraph, PolicyAction |
| Functions, methods, variables | snake_case | check_tool, max_calls |
| Constants, statics | SCREAMING_SNAKE_CASE | MAX_NODES, DEFAULT_TIMEOUT |
| Modules | snake_case | mod graph_store |
| Lifetimes | short lowercase | 'a, 'src |
| Type parameters | short UpperCamelCase | T, E, Fut |
&T over cloning unless ownership transfer is required.&mut T when you need to mutate borrowed data.Rc<T> for single-threaded reference counting; Arc<T> for multi-threaded.RefCell<T> for interior mutability in single-threaded contexts;
Mutex<T> or RwLock<T> for multi-threaded.&str instead of String for function parameters when ownership is not required.Result<T, E> for all recoverable errors. Never unwrap() or expect() in library
code — return Result instead.? operator for error propagation. Avoid unwrap() unless in a test or a context
where panic is explicitly acceptable.thiserror; use anyhow for application-level error
aggregation.Option<T> for values that may legitimately be absent.Debug and
Display at minimum.panic! is only for unrecoverable programmer errors (broken invariants). Never panic in
response to external input.// Prefer
fn load(path: &str) -> anyhow::Result<Config> {
let text = std::fs::read_to_string(path)?;
Ok(serde_json::from_str(&text)?)
}
// Avoid
fn load(path: &str) -> Config {
let text = std::fs::read_to_string(path).unwrap(); // panics on missing file
serde_json::from_str(&text).unwrap()
}
.collect() — keep iterator chains lazy until a collection is actually
needed..filter_map() over .filter().map() when the two operations can be combined..fold() for accumulation rather than a mutable variable outside the loop.mod + pub to encapsulate logic. Keep internal types
private; expose only what callers need.bool parameters or integer flags. Type
safety catches misuse at compile time.async/await and tokio. Avoid blocking in async
contexts.rayon for CPU-bound parallel iteration.main.rs thin — move all logic into lib.rs and its
modules. This enables integration tests and downstream crate reuse.unwrap() / expect() in non-test, non-prototype code.if/match blocks — extract functions or use combinators.-D warnings as the standard in CI.unsafe without necessity and thorough documentation..clone() where a borrow would suffice.Eagerly derive or implement these where appropriate:
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct MyType { ... }
| Trait | When |
|---|---|
Debug | Every public type — required |
Clone | When callers need owned copies |
PartialEq, Eq | For value comparison and use in collections |
Hash | When used as a HashMap/HashSet key |
Default | When a zero-value construction is meaningful |
Display | For user-facing output |
From / Into | For idiomatic type conversions |
AsRef, AsMut | For generic borrowing interfaces |
FromIterator, Extend | For collection types |
Send and Sync are auto-implemented by the compiler. Avoid manual unsafe impl Send/Sync
unless you fully understand the invariants.
struct UserId(u64) vs struct OrderId(u64)).Deref/DerefMut: Only smart pointers should implement these. Do not implement Deref
to gain method inheritance.bool parameters. A bool argument
at a call site conveys no intent (create(true) vs create(CreateMode::Overwrite)).tokio as the async runtime. Do not mix runtimes..block_on() inside an async context.tokio::spawn for background tasks; propagate JoinHandle errors.tokio::fs over std::fs in async code.async boundaries at the edges — pure computation should be synchronous.rustfmt (cargo fmt --all) before every commit.cargo clippy -- -D warnings and fix all warnings.///) immediately above the item they document.//! for module-level documentation.#[cfg(test)] modules in the same file as the code under test.tests/ with descriptive file names.cargo nextest run (preferred over cargo test) for test filtering and parallelism.?, not unwrap().#[cfg(test)]
mod tests {
use super::*;
#[test]
fn check_tool_denies_blocked() {
let policy = GovernancePolicy {
blocked_tools: vec!["shell_exec".into()],
..Default::default()
};
assert_eq!(policy.check_tool("shell_exec"), PolicyAction::Deny);
}
}
Cargo.toml.description, license, repository, keywords, categories in every crate.main.rs and lib.rs minimal — move logic to named modules.context.rs) rather than mod.rs directories where
possible (cleaner in editor file pickers).Before submitting any Rust code:
DebugResult<T, E> — no bare unwrap() in non-test code/// rustdoc with at least one sentenceunsafe without a // SAFETY: comment explaining the invariantcargo fmt --all — no format diffcargo clippy -- -D warnings — zero warningscargo nextest run — all greenskills/agent-governance/SKILL.md — Rust implementations of governance patternsskills/systematic-debugging/SKILL.md — debugging approach for Rust-specific issuesskills/verification-before-completion/SKILL.md — CI gate checklistSource: 89jobrien/godmode — distributed by TomeVault.