Rust Template
A minimal CLAUDE.md template for Rust backend projects using Axum and SQLx.
Template (34 lines)
Section titled “Template (34 lines)”# Project Context
## What This Is[One sentence describing your project]
## Tech StackRust + Axum + SQLx + Tokio
## Commands- `cargo run` - Start dev server- `cargo test` - Run tests- `cargo clippy` - Lint- `cargo fmt` - Format code- `sqlx migrate run` - Run migrations
## Architecture- `/src/main.rs` - Application entry point- `/src/routes/` - Axum route handlers- `/src/services/` - Business logic- `/src/models/` - Domain types- `/src/db/` - Database queries- `/migrations/` - SQL migrations
## Gotchas- [Add project-specific gotchas here]- Example: Use `?` for error propagation- Example: SQLx compile-time query checking requires DATABASE_URL
## Code Style- No `unsafe` unless absolutely necessary- Use `thiserror` for custom error types- Prefer `impl Trait` over `dyn Trait` when possible- Document public APIs with `///` comments- Copy the template above
- Save as
CLAUDE.mdorAGENTS.mdin your project root - Review and update the Tech Stack to match your project
- Replace
[One sentence describing your project]with your description - Replace the example gotchas with your project’s actual gotchas
Customization Tips
Section titled “Customization Tips”Add gotchas when the AI:
- Uses
unwrap()instead of proper error handling - Suggests
unsafecode unnecessarily - Forgets about the borrow checker constraints
- Uses blocking I/O in async contexts
Remove sections if:
- You don’t use SQLx (remove migrations command)
- Your project doesn’t have a
/services/layer - The architecture is obvious from the folder structure