check-bounds-safety
OfficialType-safe bounds for indices and cursors.
System Documentation
What problem does it solve?
This Skill enforces type-safe bounds handling by replacing ambiguous raw indices with explicit Index/Length wrappers, reducing off-by-one errors and cross-type comparisons in Rust UI code.
Core Features & Use Cases
- Type-safe index and length wrappers (idx(), len()) to prevent mixed-type comparisons and off-by-one errors.
- Dedicated bounds-check traits: ArrayBoundsCheck, CursorBoundsCheck, ViewportBoundsCheck, RangeBoundsExt, and RangeConvertExt.
- Use cases across text editors, rendering pipelines, and range processing where indices and boundaries matter, including cursor positioning and viewport visibility checks.
- Encourages using TermRowDelta/TermColDelta for safe ANSI cursor movement.
Quick Start
Import the bound-checking primitives (idx, len, ArrayBoundsCheck, CursorBoundsCheck, ViewportBoundsCheck). Replace raw indices with Index/Length types and perform the appropriate checks before access or rendering. Example: let i = idx(10); let l = len(12); if i.overflows(l) { /* handle out of bounds */ } let pos = idx(5); l.check_cursor_position_bounds(pos) // validate cursor position; let visible = i.check_viewport_bounds(start, viewport_size) // determine visibility.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: check-bounds-safety Download link: https://github.com/r3bl-org/r3bl-open-core/archive/main.zip#check-bounds-safety Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.