Rust Expert Skill
You have invoked the Rust Expert Skill. This skill contains actionable checklists and constraints for Rust software engineering tasks.
Quick Actions & Checklists
Build & Borrow Checker Resolution
- Rule 1: DO NOT use
.clone()as a first resort to fix borrow checker errors. - Rule 2: Analyze lifetime bounds. If
&'ais missing, trace the struct instantiation. - Rule 3: If the compiler suggests a trait bound (e.g.,
T: Default), evaluate if the bound makes architectural sense before blindly applying it. - Rule 4: Use
cargo checkincrementally to verify fixes without paying the fullcargo buildcost.
Coding Patterns
- Error Handling: Use the
?operator andResultuniversally. Prefer libraries likeanyhowfor applications orthiserrorfor libraries. - Enums over Booleans: Use
enumfor state machines instead of multiple boolean flags. - Concurrency: Prefer message passing (
mpsc) orRwLockoverMutexwhere applicable.Need Deep Knowledge? Read
$SKILL_DIR/references/rust-patterns.md.
Testing & Verification
- Unit Tests: Keep them in the same file inside a
#[cfg(test)]module. - Integration Tests: Place them in the
tests/directory at the project root. - Mocks: Use traits for dependency injection to allow mocking in tests.
Need Deep Knowledge? Read
$SKILL_DIR/references/rust-testing.md.
Instructions for the Agent
- Based on the arguments provided (e.g., "build", "testing", "review"), apply the relevant checklist above.
- For deeper Rust patterns or testing guidance, use the
Readtool to fetch the relevant reference document from$SKILL_DIR/references/.
Source: Rianico/harness-zkx — distributed by TomeVault.