2.5 KiB
2.5 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.
Tools
IMPORTANT: Be very careful when quoting text in tool calls to add the right amount of escaping.
write_file
When editing files use the write_file tool to output the complete version of the corrected file.
IMPORTANT: You must provide the whole file to write_file, even the unchanged parts.
Build/Test Commands
IMPORTANT: Do not run application, start the web server, or the trunk server. IMPORTANT: The cargo command cannot be ran in parallel.
# Check project
TERM=dumb cargo check
# Build project
TERM=dumb cargo build
# DO NOT RUN RUN APPLICATION (native)
# TERM=dumb cargo run
# Run all tests
TERM=dumb cargo test
# Run specific test (by name substring)
TERM=dumb cargo test test_function_name
# Run specific test with verbose output
TERM=dumb cargo test test_function_name -- --nocapture
# Check formatting
TERM=dumb cargo fmt --check
# Apply formatting
TERM=dumb cargo fmt
# Lint with clippy
TERM=dumb cargo clippy -- -D warnings
# Build for release
TERM=dumb cargo build --release
Prefix commands with TERM=dumb for consistent output.
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::*;)
Documentation
- Document all public APIs with rustdoc
- Use examples in documentation only when helpful
Procedures
Fix build problems
- Check the project:
TERM=dumb cargo check. - If there are errors or warnings, create a new sub agent (expert rust developer) that uses the
TERM=dumb cargo checkoutput as input, planned using strategic thinking. a. Read all affected files d. Plan the fixes using strategic thinking:- Read other files if they provide context or examples
- Look up relevant API information
- Do not downgrade versions
- Preserve functionality
- Use
TERM=dumb cargo fixif appropriate. - Prefer the
write_filetool if there is evidence of double escaping - You must generate the full file contents when using
write_fileor it will be truncated. c. Return the list of files modified
- If any files were modified, loop back to 1.
Fix formatting
- Format the project the project:
TERM=dumb cargo fmt - Continue with the fix build problems procedure.