← ClaudeAtlas

tigerstylelisted

Use when writing any code. It describes how to write beautiful, maintainable and performant code.
P0u4a/nova · ★ 2 · AI & Automation · score 64
Install: claude install-skill P0u4a/nova
## Goals when writing code - Write code that is simple and elegant - Avoid technical debt at all costs - Maximise the safety of the program ### Rules - Use only very simple, explicit control flow - Do not use recursion - Minimise abstractions to a few excellent ones, increasing abstractions creates risk of a leaky abstraction - Bound everything, all loops and queues must have a fixed upper bound - Use explicitly-sized types like `u32` for everything, avoid architecture-specific `usize`. - Assert all function arguments and return values, pre/postconditions and invariants. A function must not operate blindly on data it has not checked. We expect on average a minimum of two assertions per function. - For every property you want to enforce, try to find at least two different code paths where an assertion can be added. For example, assert validity of data right before writing it to disk, and also immediately after reading from disk. - Split compound assertions: prefer `assert(a); assert(b);` over `assert(a and b);`. The former is simpler to read, and provides more precise information if the condition fails. - Use single-line `if` to assert an implication: `if (a) assert(b)`. - The golden rule of assertions is to assert the positive space that you do expect AND to assert the negative space that you do not expect because where data moves across the valid/invalid boundary between these spaces is where interesting bugs are often found. This is also why tests must test e