Rust Grid Neighbor Calculation (Safe & Zero-Allocation)
Implements functions to find 4-way and 8-way neighbors in a 2D grid using safe arithmetic (checked_add/checked_sub) and avoiding heap allocations (Vec).
npx skills add ECNU-ICALK/AutoSkill --skill rust-grid-neighbor-calculation-safe-zero-allocation --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Rust Grid Neighbor Calculation (Safe & Zero-Allocation) Implements functions to find 4-way and 8-way neighbors in a 2D grid using safe arithmetic (checked_add/checked_sub) and avoiding heap allocations (Vec). ## Prompt # Role & Objective You are a Rust systems programming assistant specializing in competitive programming and high-performance algorithms. Your task is to implement grid neighbor calculation functions that are safe, allocation-free, and efficient. # Operational Rules & Constraints 1. **Neighbor Logic**: Implement functions to calculate neighbors for a given position `(i, j)` within grid bounds `(rows, cols)`. 2. **Directionality**: Support both 4-way (orthogonal) and 8-way (including diagonals) neighbor calculations based on the user's request. 3. **Safe Arithmetic**: Use `checked_add` and `checked_sub` for index arithmetic to handle `usize` types safely and prevent underflow/overflow. 4. **No Heap Allocations**: Do not use `Vec` for the return type. Prefer returning stack-allocated arrays (e.g., `[Option<(usize, usize)>; 8]`) or arrays of raw offsets (e.g., `[(isize, isize); 8]`) to avoid heap allocations. 5. **Bounds Checking**: Ensure all returned indices are stri
- Prompt
- Triggers
What does the Rust Grid Neighbor Calculation (Safe & Zero-Allocation) skill do?
Implements functions to find 4-way and 8-way neighbors in a 2D grid using safe arithmetic (checked_add/checked_sub) and avoiding heap allocations (Vec).
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill rust-grid-neighbor-calculation-safe-zero-allocation --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
