r3bl-open-core: Skill for Claude Code

.agents/skills/check-bounds-safety/SKILL.md

check-bounds-safety is a skill for Claude Code, Codex from r3bl-org/r3bl-open-core. It costs 46 tokens per session (3,985 once invoked), scanned A, original, Apache-2.0.

A Rust coding guide for making array, buffer, cursor, and viewport positions unambiguous by using separate types for indices and lengths.

In plain words
What is it for?
Use it when checking ranges, accessing arrays or buffers, handling scrolling, positioning cursors, or converting terminal ranges into Rust ranges.
Why use it?
It helps prevent off-by-one mistakes and stops code from confusing a zero-based position with a length.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is r3bl-org/r3bl-open-core's own configuration. It tells Claude Code and Codex how to work on r3bl-open-core itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything r3bl-open-core configures →

Reuse

Borrowing it

Nothing to install: this file belongs to r3bl-org/r3bl-open-core. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/r3bl-org/r3bl-open-core/main/.agents/skills/check-bounds-safety/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/r3bl-org/r3bl-open-core

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for check-bounds-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/r3bl-org/r3bl-open-core/check-bounds-safety/github.svg)](https://agentmods.dev/skills/r3bl-org/r3bl-open-core/check-bounds-safety)
Your own site
<a href="https://agentmods.dev/skills/r3bl-org/r3bl-open-core/check-bounds-safety"><img src="https://agentmods.dev/badge/skills/r3bl-org/r3bl-open-core/check-bounds-safety/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for check-bounds-safety

Your own site · 80×15
<a href="https://agentmods.dev/skills/r3bl-org/r3bl-open-core/check-bounds-safety"><img src="https://agentmods.dev/badge/skills/r3bl-org/r3bl-open-core/check-bounds-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,985 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.03985
Opus 5 $0.00023 $0.01992
Sonnet 5 $0.00009 $0.00797
Haiku 4.5 $0.00005 $0.00398

Measured 13d ago against content hash edbe3a8bbb4c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

check-bounds-safety scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/check-bounds-safety/SKILL.md · 487 lines

How it starts

The opening of the file, as written. The whole thing — 487 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Type-Safe Bounds Checking

When to Use

  • Working with array access or buffer operations
  • Implementing cursor positioning logic (text editors, terminal emulators)
  • Handling viewport rendering and scrolling
  • Dealing with 0-based indices vs 1-based lengths
  • Validating range boundaries
  • Converting VT-100 ranges to Rust ranges
  • Before creating commits with bounds-sensitive code
  • When user asks about "bounds checking", "type safety", "off-by-one errors", etc.

The Problem

Raw usize values are ambiguous and error-prone:

// ❌ Bad - What is `x`? Index or length?
let x = 10_usize;
if x < length {  // Off-by-one error waiting to happen
    buffer[x]
}

// Is this an index (0-based) or a length (1-based)?
// The type system can't help us!

The Solution

Use type-safe wrappers from tui/src/core/coordinates/bounds_check/:

// ✅ Good - Types make it clear
use r3bl_tui::{vp_idx, vp_len, ArrayBoundsCheck};

let index = vp_idx(10);      // Clearly an index (0-based)
let length = vp_len(100);    // Clearly a length (1-based)

if index.overflows(length) {
    // Safely caught! Can't accidentally compare incompatible types
}

Core Principles

Follow these principles when working with indices and lengths:

  1. Use Index types (0-based) instead of usize

    • VPRow, VPCol, VPIndex
    • Construct with row(), col(), vp_idx()
  2. Use Length types (1-based) instead of usize

    • VPHeight, VPWidth, VPLength
    • Construct with height(), width(), vp_len()
  3. Type-safe comparisons

    • Cannot compare VPRow with VPWidth (compile error!)
    • Prevents category errors like "is row 5 < width 10?"
  4. Use .is_zero() for zero checks

    • Instead of == 0
    • More idiomatic with newtype wrappers
  5. Distinguish navigation from measurement

    • Navigation (index - offset → index): Moving backward in position space
    • Measurement (index.distance_from(other) → length): Calculating distance between positions
    • Use - for cursor movement, use distance_from() for calculating spans

Read the full file on GitHub · 487 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago First seen · 487 lines · 46 tokens per session scan A edbe3a8bbb4c

Subscribe to this mod's changes

check-bounds-safety is a skill published in the GitHub repository r3bl-org/r3bl-open-core (483 stars, last pushed today), licensed Apache-2.0. It adds 46 tokens to every session and 3,985 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories