check-hotpath

Detect allocation, lock, syscall, copy, and branch-density violations in Rust hot-path code.

2|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/pilotspace/moon --skill check-hotpath
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: check-hotpath
Source: https://github.com/pilotspace/moon/tree/main/.claude/skills/check-hotpath
Command: npx skills add https://github.com/pilotspace/moon --skill check-hotpath

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Audit hot-path code to detect allocation and synchronization issues that can cause performance regressions or correctness bugs.

Core Features & Use Cases

  • Allocation Violations: scan hot-path files for patterns like Box::new, Vec::new(), String::new(), Arc::new, .clone(), .to_string(), .to_owned() and flag risky allocations; Exceptions: Vec::with_capacity() at end of path is acceptable.
  • Lock Violations: flag usage of Mutex::new, RwLock::new, .lock(), .read(), or .write() with across .await boundaries; encourage use of non-blocking or parking_lot primitives;
  • Syscall Violations: detect Instant::now(), SystemTime::now(), or std::time patterns that introduce non-deterministic timing; prefer shard-cached timestamps.
  • Copy Violations: detect .to_vec(), .to_owned(), copy_from_slice and advocate zero-copy alternatives like Bytes::slice().
  • Branch Density: identify match arms with excessive cases or nested branches that hinder performance.

Quick Start

Run the hot-path audit on your Rust codebase to identify allocation, lock, syscall, copy, and branch-density violations and generate a remediation report.

Frequently Asked Questions about check-hotpath

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect hot-path allocation violations in Rust code?

Detect hot-path allocation violations in Rust code by scanning for risky patterns like Box::new, Vec::new(), String::new(), Arc::new, .clone(), .to_string(), and .to_owned(). The audit flags these issues while allowing exceptions like Vec::with_capacity() at the end of a path.

Why does holding a lock across an .await boundary cause performance issues in Rust?

Holding a lock across an .await boundary in Rust introduces blocking behavior that degrades hot-path performance. The audit flags Mutex::new, RwLock::new, .lock(), .read(), and .write() usage across awaits, encouraging non-blocking or parking_lot primitives instead.

What is the best way to audit Rust hot-path code for non-deterministic syscalls?

Audit Rust hot-path code for non-deterministic syscalls by detecting Instant::now(), SystemTime::now(), or std::time patterns that introduce timing variance. The audit identifies these violations and recommends using shard-cached timestamps for deterministic execution.

How do I find zero-copy alternatives to .to_vec() and copy_from_slice in Rust?

Find zero-copy alternatives in Rust by detecting copy violations like .to_vec(), .to_owned(), and copy_from_slice. The audit advocates using zero-copy alternatives such as Bytes::slice() to eliminate unnecessary memory duplication on hot paths.

Can I use this hot-path audit on specific Rust source directories like src/io/ and src/storage/?

You can apply this hot-path audit to specific Rust source directories including src/command/, src/protocol/, src/io/, src/storage/dashtable/, and event loop files. It enforces a zero-tolerance policy by flagging high-severity issues and providing concrete fixes.

When should I check branch density and nested match arms in Rust code for performance?

Check branch density and nested match arms in Rust code when optimizing hot paths, as excessive cases or nested branches hinder performance. The audit identifies these structural violations to streamline critical execution paths and reduce branching overhead.