rust-engineeringlisted
Install: claude install-skill mfmezger/ai_agent_dotfiles
# Rust Engineering
Produce Rust that is safe, explicit, and maintainable under review. Default to stable language features, minimal `unsafe`, narrow APIs, and code that passes formatting, linting, and tests.
## Workflow
1. Identify the artifact.
Library: optimize for explicit API boundaries, typed errors, docs, and semver-safe design.
Application or CLI: optimize for operability, context-rich errors, tracing, and clear failure modes.
2. Model types before writing control flow.
Prefer enums, newtypes, and private fields over ad hoc strings, flags, or loosely related values.
3. Choose ownership deliberately.
Accept borrowed inputs where practical, return owned outputs when crossing boundaries, and make cloning explicit.
4. Choose the failure model early.
Libraries usually use `thiserror`; applications usually use `anyhow` at the outer boundary and typed errors internally when helpful.
5. Choose the concurrency model deliberately.
Use synchronous code unless async is justified by I/O concurrency needs. When async is justified, use Tokio and design cancellation, timeouts, and shutdown explicitly.
6. Verify before finalizing.
Run `cargo fmt --check`, `cargo clippy --all-targets --all-features`, and relevant tests. Address warnings instead of normalizing them.
## Load References By Need
| Need | Reference |
|---|---|
| Project setup, crate structure, CLI patterns, tracing | `references/workflow.md` |
| Error model, `thiserror` vs `anyhow`, context, path/fi