OpenParable
Skip to content
← Back to skills

Audit Arithmetic

Testing & Quality
audit-arithmetic

Audit Arithmetic is an Agent Skill for testing & quality published in the ben-manes/caffeine repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Audit for arithmetic and boundary bugs (overflow, off-by-one, drift)

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/ben-manes/caffeine/blob/HEAD/.claude/skills/audit-arithmetic/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/audit-arithmetic, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Assume there is at least one arithmetic or boundary bug in this code.

Audit for:

  • Off-by-one errors
  • Incorrect inequality direction (< vs <=, > vs >=)
  • Overflow / underflow (int, long, specifically nanoTime arithmetic)
  • Implicit narrowing or widening conversion
  • Incorrect rounding or truncation
  • Sign errors
  • Sentinel value collisions (can a valid value equal a sentinel?)
  • Counter drift (can a counter diverge from the quantity it tracks over a long-running cache?)
  • Timer wheel bucket arithmetic (modular arithmetic, wrap-around)
  • Frequency sketch counter saturation and reset arithmetic
  • Hill climber / adaptive sizing: window vs main partition adjustment (percentage calculations, rounding, overshoot, oscillation)
  • FrequencySketch table size calculation (ensureCapacity rounding to power of two, interaction with maximumSize)
  • Weight delta computation in UpdateTask (sign conventions, can intermediate sums overflow when weights are near Integer.MAX_VALUE?)

For each suspected issue:

  • Provide a concrete input (specific key, value, weight, time values)
  • Show step-by-step evaluation through the code
  • Show expected vs actual behavior
  • If it requires billions of operations, state the count needed

Ignore style and performance. Only report high-confidence defects supported by evaluation traces.