rust-essentials
Idiomatic Rust product discipline — fmt/clippy/test, Result errors, serde, Docker-always services. Use when the product stack is rust.
- License 许可
- MIT
- 最近更新
- 2026-10-20
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- rust-essentials
- license
- MIT
- description
- Idiomatic Rust product discipline — fmt/clippy/test, Result errors, serde, Docker-always services. Use when the product stack is rust.
- compatibility
- opencode
03 SKILL.md 正文
What I do
- Keep Rust products warning-free and idiomatic per the Rust Book and API Guidelines: ownership-first,
Resulteverywhere, clippy-clean.
When to use me
Use on every task whose effective stack (task.stack ?? roadmap.stack, or workspace/Cargo.toml) is rust.
Rules
- Toolchain only:
cargo run/cargo test/cargo build. Gate oncargo fmt --checkANDcargo clippy -- -D warningsclean before exit. - Verify:
cargo test(0 failures, including at least one error-path case per new behavior) before exit; paste real output intoworkspace/TASK_PROGRESS.md. Unit tests in#[cfg(test)]modules beside code, integration tests intests/; examples use?, neverunwrap!. - Errors:
Result<T, E>for recoverable errors,panic!only for unrecoverable; propagate with?; domain errors viathiserror, app glue viaanyhow;Option<T>for maybe-values. Nounwrap()/expect()in library paths. - Style:
&strparams overStringunless ownership is needed; borrow overclone(); lazy iterators over prematurecollect();serdefor serialization;tokiofor async (+#[tokio::test]); splitlib.rs(logic, testable) frommain.rs(thin binary). Test naming: scenario verbs (creates_user_with_valid_email,rejects_order_when_insufficient_stock). - Data access: connect via env to declared Docker services (
std::env::var, fail fast when missing); parameterized queries always (sqlx$1/?binds — neverformat!SQL). No fallback data layers. Parse, don't validate: newtypes (Email::parse) make invalid states unrepresentable. - Security: every
unsafeblock carries a// SAFETY:comment or it doesn't land;cargo auditon dependency changes; never expose internal paths/stack traces/DB errors in API responses (log server-side, return generic messages).
Depth (vendored ECC reference, MIT © 2026 Affaan Mustafa — read on demand)
-
vendor/ecc/rules/rust/coding-style.md,patterns.md,security.md,testing.md -
vendor/ecc/skills/rust-patterns/SKILL.md,vendor/ecc/skills/rust-testing/SKILL.md(rstest, proptest, mockall, criterion, cargo-llvm-cov) -
Review checklist:
vendor/ecc/agents/rust-reviewer.md -
Reloadable staged IDs:
ecc-rust-patterns,ecc-rust-testing(skill tool, on-demand — staged by workflow/runner, never auto-injected)
04 同仓库更多 Skills
demo-skill
暂无简介
web-accessibility
WCAG 2.2 AA practice for keyboard, screen reader, contrast, and motion. Use when building or auditing user interfaces.
ui-conventions
Black/white token system, accessible components, and copy rules for frontend work. Use when building screens, components, or design tokens.
test-evidence
stack-toolchain test matrices, concurrency cases, and TASK_PROGRESS proof format for QA verification. Use when writing tests or proving deliverables work.
test-driven-development
RED-GREEN-REFACTOR cycle for new behavior. Use when implementing any feature, fix, or endpoint before writing production code.
systematic-debugging
Reproduce-isolate-fix-verify loop for defects and flaky behavior. Use when facing a bug, test failure, or unexpected behavior.