Rust Project CLAUDE.md Template

CLAUDE.md for Rust applications and libraries

Category:templates
Type:template
Difficulty:advanced
Language:Markdown
rust
cli
advanced

Description

CLAUDE.md template for Rust projects. Covers Cargo workspace setup, common patterns, error handling with thiserror/anyhow, async with Tokio, and testing strategies for Rust code.

Content

Resource Content
# Rust Project

## Overview
Rust application/library with modern tooling.

## Tech Stack
- Language: Rust (stable)
- Async: Tokio
- Web: Axum/Actix-web
- Serialization: serde

## Key Commands
```bash
cargo run                     # Run project
cargo build --release         # Release build
cargo test                    # Run tests
cargo clippy                  # Lint
cargo fmt                     # Format code
cargo doc --open              # Generate docs
```

## Project Structure
```
/
├── src/
│   ├── main.rs               # Entry (binary)
│   ├── lib.rs                # Library root
│   ├── error.rs              # Error types
│   └── modules/              # Feature modules
├── tests/                    # Integration tests
├── benches/                  # Benchmarks
├── Cargo.toml                # Dependencies
└── Cargo.lock                # Lock file
```

## Conventions
- Use `Result<T, E>` for fallible ops
- Implement `From` for error conversion
- Prefer `&str` over `String` in params
- Use `#[derive]` for common traits

## Important Notes
- Run clippy before committing
- Use `#[cfg(test)]` for test modules
- Feature flags for optional deps