cairo-coding
Installation
SKILL.md
Coding Cairo
Rules and patterns for writing efficient Cairo code. Sourced from audit findings and production profiling.
When to Use
- Implementing arithmetic (modular, parity checks, quotient/remainder)
- Optimizing loops (slow iteration, repeated
.len()calls, index-based access) - Splitting or assembling integer limbs (u256 → u128, u32s → u128, felt252 → u96)
- Packing struct fields into storage slots
- Using
BoundedIntfor zero-overhead arithmetic with compile-time bounds - Choosing integer types (u128 vs u256, BoundedInt vs native types)
Not for: Profiling/benchmarking (use benchmarking-cairo)