一键导入
rust-standards
Full Rust code quality standards for starbunk-rs. Read this before writing or reviewing any Rust code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Full Rust code quality standards for starbunk-rs. Read this before writing or reviewing any Rust code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | rust-standards |
| description | Full Rust code quality standards for starbunk-rs. Read this before writing or reviewing any Rust code. |
These rules apply to every file written or changed in this project.
mod.rs is wiring only. Declares submodules, exposes pub async fn run(). No business logic.crates/starbunk-shared/.crates/starbunk-shared/ but never from another bot's crate.crates/starbunk-shared/ with Arc<Mutex<_>> or DashMap.Arc<dyn Trait> for all injected dependencies — never concrete types. Mandatory for testability.#[derive(Debug)] on every public struct and enum.LazyLock<Regex> for all compiled regexes. Never call Regex::new(...) in a hot path:
static PAT: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"...").expect("pattern name"));
anyhow::Result. run() returns anyhow::Result<()>..unwrap() in production code. Use ? or .expect("reason") on programmer-error panics only.if let Err(e) = sender.send(channel_id, &resp).await {
tracing::error!(strategy = name, "failed to send: {}", e);
}
tokio::spawn. Blocking handlers stall the executor.async fn only where the function actually awaits something.triggers_on_blue_variants not test_blue_regex.build_msg / fake_ctx helpers live at the top of mod tests. Build serenity::Message with serde_json::json!.mod tests block of the file that uses them.Strategy must test: triggers on canonical input, does not trigger on non-matching input, returns the expected response.MessageFilter must test: pass case, fail case, and composition inside all_of / any_of.Evaluate the CI/CD pipeline on the PR, check for failures, and fix any issues.
Analyzes the current branch/PR and adds comprehensive, well-formatted structured logging and spans for observability.
Review PR comments, categorize them into critical/nitpicks, fix user-selected ones, and close resolved comments.
Create a PR using the current branch. Generates a PR description, commits changes, and pushes.
Mandatory rules for general git use in this repository. Follow these constraints before starting work, committing, or pushing.
Feature developer and task runner. Start a new task on a fresh branch, orchestrate worktrees, do the implementation work, and open a PR when done.