2.1 KiB
2.1 KiB
Agent Configuration
IMPORTANT: Prefer to use the write_file tool if the edit is for the majority of a file, or if you are correcting previous problems made edits from other tools.
Commands
IMPORTANT: Always export TERM=dumb.
IMPORTANT: The cargo command cannot be ran in parallel.
Build
- Build:
TERM=dumb cargo build - Build release:
TERM=dumb cargo build --release
Test
- Run all tests:
TERM=dumb cargo test - Run specific test:
TERM=dumb cargo test TEST_NAME - Run tests with output:
TERM=dumb cargo test -- --nocapture
Lint/Format Commands
- Check formatting:
TERM=dumb cargo fmt --check - Format code:
TERM=dumb cargo fmt - Lint:
TERM=dumb cargo clippy - Lint with errors:
TERM=dumb cargo clippy -- -D warnings
Code Style Guidelines
Imports
- Group imports in order: standard library, external crates, local modules
- Use explicit imports over glob imports (
use std::fs::File;notuse std::fs::*;)
Formatting
- Use rustfmt (configured via rustfmt.toml if exists)
- Max line length: 100 characters
- Indent with 4 spaces
Types
- Prefer explicit types in public API
- Use
&strfor string literals,Stringfor owned strings - Use
Option<T>for optional values,Result<T, E>for error handling
Naming Conventions
- Use snake_case for variables and functions
- Use PascalCase for types and traits
- Use UPPER_SNAKE_CASE for constants and statics
Error Handling
- Use
anyhow::Resultfor most error handling - Use
anyhow::Contextto add context to errors - Avoid
unwrap()in production code
Documentation
- Document all public APIs with rustdoc
- Use examples in documentation when helpful
Procedures
Fix build problems
Use this plan with sequential thinking:
- Check the project using
TERM=dumb cargo check - Identify the cause of any errors and warnings
- If there are no errors or warnings, stop
- If there are errors are warnings, create a plan to fix errors and warnings
- Fix the files one at a time, not in parallel
- Use the
write_filetool to output the complete version of the corrected file