Phase 2: Hooks System - Event-driven execution with HookEvent/HookAction types - HookManager for registration and execution Phase 3: Multi-Agent Workflow - Workflow orchestration with dependency graphs - WorkflowStep with conditions and retry support Phase 4: MCP (Model Context Protocol) Support - McpServer for external tool servers - McpManager for multiple server management Also includes core modules: cache, error_policy, feature_flags, git, logger, plugin, retry, rules 662 tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1.3 KiB
1.3 KiB
Rust Best Practices Checklist
When writing or reviewing Rust code, ensure:
Error Handling
- Use
Result<T, E>for fallible operations - Avoid
.unwrap()and.expect()in library code - Use
?operator for error propagation - Create custom error types with
thiserror - Provide context with
.context()or.with_context()
Memory & Performance
- Prefer
&stroverStringfor function parameters - Use
Cow<str>when ownership is conditional - Avoid unnecessary cloning
- Use iterators instead of index loops
- Consider
Vec::with_capacity()for known sizes
Safety
- Minimize
unsafecode - Document safety invariants for
unsafeblocks - Validate all external input
- Use
#[must_use]for important return values
Async
- Use
tokio::spawnfor concurrent tasks - Avoid blocking operations in async context
- Use
tokio::select!for racing futures - Handle cancellation properly
Testing
- Unit tests in same file with
#[cfg(test)] - Integration tests in
tests/directory - Use
#[should_panic]for expected panics - Test error cases, not just happy paths
Documentation
- Doc comments for public items (
///) - Examples in doc comments
- Module-level documentation (
//!) - Link related items with
[item]