Skip to content

Instantly share code, notes, and snippets.

@AlexMikhalev
Created December 1, 2025 12:19
Show Gist options
  • Select an option

  • Save AlexMikhalev/63074fbbd9e51944be05a88436146553 to your computer and use it in GitHub Desktop.

Select an option

Save AlexMikhalev/63074fbbd9e51944be05a88436146553 to your computer and use it in GitHub Desktop.
Rust agents guidelines

Testing Guidelines

  • Keep fast unit tests inline with mod tests {}; put multi-crate checks in tests/ or test_*.sh.
  • Scope runs with cargo test -p crate test; add regression coverage for new failure modes.

Rust Performance Practices

  • Profile first (cargo bench, cargo flamegraph, perf) and land only measured wins.
  • Borrow ripgrep tactics: reuse buffers with with_capacity, favor iterators, reach for memchr/SIMD, and hoist allocations out of loops.
  • Apply inline directives sparingly—mark tiny wrappers #[inline], keep cold errors #[cold], and guard cleora-style rayon::scope loops with #[inline(never)].
  • Prefer zero-copy types (&[u8], bstr) and parallelize CPU-bound graph work with rayon, feature-gated for graceful fallback.

Commit & Pull Request Guidelines

  • Use Conventional Commit prefixes (fix:, feat:, refactor:) and keep changes scoped.
  • Ensure commits pass cargo fmt, cargo clippy, required cargo test, and desktop checks.
  • PRs should explain motivation, link issues, list manual verification commands, and attach UI screenshots or logs when behavior shifts.

Configuration & Security Tips

Keep secrets in 1Password or .env. Use build-env.sh or scripts/ helpers to bootstrap integrations, and wrap optional features (openrouter, mcp-rust-sdk) with graceful fallbacks for network failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment