2.0 KiB
2.0 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Build/Lint/Test Commands
Building
- Build debug version:
cargo build - Build release version:
cargo build --release - Run the application:
cargo run
Testing
- Run all tests:
cargo test - Run a specific test:
cargo test test_name - Run tests for a specific module:
cargo test module_name - Run tests with feature flags:
cargo test --features test_utils
Linting
- Run clippy linting:
cargo clippy - Format code:
cargo fmt
Code Style Guidelines
Architecture
- This project follows a hexagonal/clean architecture pattern:
application: Contains services (use cases), DTOs, and portsdomain: Contains core entities, repositories (interfaces), and domain servicesinfrastructure: Contains concrete implementations of repository interfacesinterfaces: Contains HTTP/API handlers and routes
Error Handling
- Use the
DomainErrortype for domain-level errors - Use the
AppErrortype for API/HTTP-level errors - Use the
ErrorContexttrait to add context to errors from external crates - Follow the error factory pattern for creating common error types
Naming Conventions
- Types and structs: PascalCase
- Functions and methods: snake_case
- Constants and statics: SCREAMING_SNAKE_CASE
- Modules and files: snake_case
- Use descriptive names that express intent
Testing
- Use mock objects for dependencies in unit tests
- Use the
#[tokio::test]attribute for async tests - Include both positive and negative test cases
- Follow the Arrange-Act-Assert pattern in tests
Imports
- Group imports by source:
- Standard library imports
- External crate imports
- Local crate imports (with
crate::prefix)
- Use explicit imports (no glob imports except in tests)
Documentation
- Document public API functions and types with doc comments
- Include examples where helpful
- Document error cases and conditions