- Use feature-based structure.
- Prefer expression-oriented and functional code.
- Write idiomatic modern Rust with clear ownership and minimal to zero cloning.
- Prefer borrowing over cloning, but optimize for clarity before micro-optimizing allocations.
- Avoid
unwrap,expect, andpanic!. - Use your judgment, if code or design quality degrades or refactoring feels warranted, pause and ask before proceeding.
- Builder Pattern: For constructing complex objects step by step
- RAII Pattern: For resource management tied to object lifetimes
- Newtype Pattern: For type safety and abstraction
- Decorator Pattern: For adding behavior to objects dynamically
- Command Pattern: For encapsulating operations as objects
- Read the Unit Testing skill before modifying or adding unit tests.
- Smoke and perf tests are opt-in (excluded from
cargo test) and require Unix:- Smoke: after changes to terminal UI, input, Git workflows, or file watching, run
cargo test --locked --test smoke. - Perf: when changes may affect startup, collection, watching, or rendering performance, run
cargo test --release --locked --test perf -- --repo /path/to/repository --runs 5before and after on the same representative repository; compare medians. Seedocs/startup.mdfor metrics.
- Smoke: after changes to terminal UI, input, Git workflows, or file watching, run
- Adding runtime dependencies.
- Introducing persisted configuration or changing its format.
Before finishing code changes, run:
cargo fmt
cargo check --all-targets
cargo clippy --all-targets -- -D warnings
cargo test