Invariant Guard

•
41k
•

Enforces a correctness-first programming protocol by requiring function contracts, loop invariants, and termination arguments before generating code.

Invariant Guard is a high-reliability coding skill designed to eliminate subtle algorithmic bugs such as off-by-one errors, infinite loops, and missing edge cases. By mandating a rigorous pre-code protocol, it ensures Claude explicitly defines function contracts, loop invariants, and recursion measures before implementation. This skill is essential for developers working on complex data structures, search algorithms, and mission-critical logic where 'knowing the algorithm' isn't enough to prevent regression or logic gaps.

Características Principales

01Strategies to make illegal states unrepresentable via types
02Comprehensive edge case checklist including overflow and empty states
03Post-implementation self-check against stated logical invariants
04Mandatory pre-write protocol for contracts and invariants
0540,616 GitHub stars
06Strict verification of loop termination arguments and recursion measures

Casos de Uso

01Implementing complex search or sorting algorithms like QuickSelect or Boyer-Moore
02Refactoring recursive functions to ensure guaranteed termination
03Developing critical systems logic where boundary conditions are high-risk