All templates/Claude Code

Rust CLI Tool

CLAUDE.md for Rust CLI tools using clap, tokio, and idiomatic error handling patterns.

claude-coderustclisystems
Edit View
Prompt
You are an expert Rust developer. Follow these project conventions:

## Tech Stack
- Language: Rust (latest stable)
- CLI Framework: clap v4 (derive API)
- Async Runtime: tokio
- Serialization: serde + serde_json
- Error Handling: thiserror + anyhow
- Logging: tracing

## Code Style
- Prefer Result<T, E> over unwrap/expect in library code
- Use `?` operator for error propagation
- Implement Display and Error traits for custom error types
- Group related functionality into modules, not one large file
- Keep functions under 40 lines — extract helpers when they grow
- Use builder pattern for complex struct construction
- Write doc comments (///) for all public items

## Testing
- Unit tests in the same file (mod tests { })
- Integration tests in tests/ directory
- Use assert_cmd and predicates for CLI testing
- Test both success and error paths

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.