How this skill is triggered — by the user, by Claude, or both
Slash command
/developer-plugin:ms-rustThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
---
Apply these guidelines when writing or reviewing Rust code (.rs files).
Invoke this skill when:
.rs filesUse American English for all comments, documentation, and string literals.
Service, Manager, Factory, Handler, HelperFooService → FooBookingManager → BookingsUserFactory → use Builder pattern insteadResult<T, E> for recoverable errors/// Summary sentence under 15 words.
///
/// Extended description with more details.
///
/// # Examples
///
/// ```
/// let result = my_function(42);
/// ```
///
/// # Errors
///
/// Returns `MyError` when...
///
/// # Panics
///
/// Panics if...
pub fn my_function(value: i32) -> Result<Output, MyError> { }
All public types must implement Debug:
#[derive(Debug)]
pub struct MyType { }
// For sensitive data:
impl Debug for Secret {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "Secret(...)")
}
}
// Good - warns if lint no longer triggers
#[expect(clippy::unused_async, reason = "will add I/O later")]
pub async fn ping() { }
// Bad - accumulates stale overrides
#[allow(clippy::unused_async)]
pub async fn ping() { }
anyhow or eyre (M-APP-ERROR)// Library error struct
pub struct ConfigError {
backtrace: Backtrace,
path: PathBuf,
}
impl ConfigError {
pub(crate) fn new(path: PathBuf) -> Self {
Self { backtrace: Backtrace::capture(), path }
}
}
impl Display for ConfigError { /* ... */ }
impl std::error::Error for ConfigError { }
unsafe only for: novel abstractions, performance, FFIFor comprehensive guidelines, consult these reference files:
| Topic | File | Key Rules |
|---|---|---|
| AI-Friendly APIs | references/ai-guidelines.md | M-DESIGN-FOR-AI |
| Applications | references/application-guidelines.md | M-APP-ERROR, M-MIMALLOC-APPS |
| Documentation | references/documentation-guidelines.md | M-CANONICAL-DOCS, M-MODULE-DOCS |
| FFI | references/ffi-guidelines.md | M-ISOLATE-DLL-STATE |
| Library Design | references/library-guidelines.md | M-FEATURES-ADDITIVE, M-OOBE |
| Library UX | references/library-ux-guidelines.md | M-INIT-BUILDER, M-ERRORS-CANONICAL-STRUCTS |
| Performance | references/performance-guidelines.md | M-HOTPATH, M-THROUGHPUT |
| Safety | references/safety-guidelines.md | M-UNSAFE, M-UNSOUND |
| Universal | references/universal-guidelines.md | M-CONCISE-NAMES, M-PANIC-IS-STOP |
Enable in Cargo.toml:
[lints.rust]
missing_debug_implementations = "warn"
unsafe_op_in_unsafe_fn = "warn"
[lints.clippy]
all = "warn"
pedantic = "warn"
Use these tools:
rustfmt - formattingclippy - lintingcargo-audit - vulnerability scanningmiri - unsafe code validationWhen generating Rust code:
// M-XXX compliant commentsPathBuf for paths, strong types over primitivesBased on Microsoft Pragmatic Rust Guidelines.
npx claudepluginhub misteral/claude_plugins --plugin developer-pluginEnforces idiomatic Rust patterns for ownership, error handling, enums, traits, concurrency, and crate structure.
Enforces idiomatic Rust patterns for ownership/borrowing, error handling with anyhow/thiserror, enums, traits, concurrency, and crate design.
Reviews Rust code for ownership, borrowing, lifetimes, error handling, trait design, unsafe usage, and common mistakes. Covers Rust 2024 edition patterns and modern idioms.