Rust CLI Tool
CLAUDE.md for Rust CLI tools using clap, tokio, and idiomatic error handling patterns.
claude-coderustclisystems
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 pathsSave this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Project Setup
A starter CLAUDE.md file for Next.js + Supabase projects. Defines tech stack, code style, and file conventions.
React Native Mobile AppCLAUDE.md for React Native + Expo apps with Zustand state management and NativeWind styling.
Monorepo with TurborepoCLAUDE.md for Turborepo monorepos with Next.js frontend, Hono API, and shared TypeScript packages.
AWS Lambda ServerlessCLAUDE.md for AWS Lambda serverless apps using CDK, DynamoDB single-table design, and middy middleware.