Rust Expert - CLAUDE.md Rules for Claude Code
Transform Claude into a Rust specialist with deep knowledge of ownership, borrowing, error handling, async, and production systems patterns.
Open the source and read safety notes before installing.
Privacy notes
- Rules reference API keys and database credentials; store them in environment variables or a secrets manager, never in committed source files.
Schema details
- Install type
- copy
- Reading time
- 4 min
- Difficulty score
- 85
- Troubleshooting
- Yes
- Breaking changes
- No
Full copyable content
You are an expert Rust developer with deep knowledge of ownership, borrowing,
traits, and safe systems programming.
## Core Philosophy
- Let the borrow checker guide API design; prefer owned values at boundaries
- Use `Result` and `Option` explicitly; avoid `unwrap` in production paths
- Model invariants with types (`enum`, newtypes) instead of comments alone
- Keep `unsafe` tiny, documented, and reviewed — default to safe Rust
## Ownership & Borrowing
```rust
pub fn summarize_titles(books: &[Book]) -> Vec<String> {
books.iter().map(|b| b.title.clone()).collect()
}
```
- Prefer `&str` over `String` in arguments when borrowing suffices
- Return owned data (`String`, `Vec`) when callers need to store it
- Use lifetimes only when the compiler cannot infer relationships
## Error Handling
- Library code returns `Result<T, E>`; applications may log and exit at the top
- Use `thiserror` for library errors, `anyhow` sparingly at app boundaries
- Propagate with `?`; add context with `.context("...")` where it helps operators
## Traits & APIs
- Implement `Debug`, `Clone`, `PartialEq` deliberately — not by default
- Prefer trait bounds (`impl Trait`, `T: Trait`) over trait objects unless dynamic dispatch is required
- Keep public APIs minimal; use modules to hide internals
## Concurrency
- Share state with `Arc<Mutex<_>>` or channels; avoid unbounded shared mutation
- Use `tokio` for async I/O; do not block the runtime on CPU or sync I/O
- Prefer structured tasks with cancellation tokens for long-running work
## Testing
- Unit tests in `#[cfg(test)]` modules beside the code they cover
- Integration tests in `tests/` for public API behavior
- Property tests (`proptest`) for parsers and invariants when helpfulAbout this resource
Usage
Add this rule set to your project's CLAUDE.md to configure Claude as a Rust expert.
It covers ownership, error handling, traits, and async patterns — grounded in the
The Rust Programming Language and
standard library documentation.
Sources
Source citations
Add this badge to your README
How it compares
Rust Expert - CLAUDE.md Rules for Claude Code side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Rust Expert - CLAUDE.md Rules for Claude Code Transform Claude into a Rust specialist with deep knowledge of ownership, borrowing, error handling, async, and production systems patterns. Open dossier | .NET and C# Expert - CLAUDE.md Rules for Claude Code A CLAUDE.md rule set that turns Claude into a senior .NET reviewer aligned with current Microsoft guidance across ASP.NET Core, Entity Framework Core, asynchronous programming, typed options, and automated testing. Open dossier | Django Expert - CLAUDE.md Rules for Claude Code Transform Claude into a Django specialist with deep knowledge of models, views, DRF serializers, migrations, middleware, and production deployment patterns. Open dossier | Go Golang Expert - CLAUDE.md Rules for Claude Code Transform Claude into a Go language expert with deep knowledge of concurrency, performance optimization, and idiomatic Go Open dossier |
|---|---|---|---|---|
| Trust | ||||
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety · Privacy ✓ | Safety · Privacy ✓ | Safety · Privacy ✓ | Safety · Privacy · |
| Category | rules | rules | rules | rules |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | jaso0n0818 | jaso0n0818 | jaso0n0818 | JSONbored |
| Added | 2026-06-16 | 2026-06-13 | 2026-06-14 | 2025-09-16 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | — missing | — missing | — missing | — missing |
| Privacy notes | ✓Rules reference API keys and database credentials; store them in environment variables or a secrets manager, never in committed source files. | ✓Rules reference dotnet user-secrets and Azure Key Vault for credential storage; secrets must never be committed to source control or hard-coded in application settings files. | ✓Rules reference SECRET_KEY, database credentials, and API tokens; store them in environment variables, never in settings.py committed to git. | — missing |
| Prerequisites | — none listed | — none listed | — none listed | — none listed |
| Install | — | — | — | — |
| Config | — | — | — | — |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.