What problem does it solve?
It helps engineers write internal logic and data flow that avoids hidden edge cases, prevents illegal states from slipping into core algorithms, and produces clearer failures instead of ambiguous behavior.
Core Features & Use Cases
- Early guard clauses: Handle invalid inputs and edge cases immediately to keep control flow shallow and readable (e.g., quickly rejecting missing or malformed request state).
- Make illegal states unrepresentable: Parse and structure data at boundaries so internal logic can trust typed, validated state (e.g., converting raw payloads into a safe domain model once).
- Atomic predictability: Design functions so they behave consistently for the same inputs, minimizing hidden mutations (e.g., returning new derived state instead of mutating globals).
- Fail fast, fail loud: Throw descriptive errors when state is invalid rather than attempting to patch corrupted scenarios (e.g., stopping execution with clear diagnostics).
- Intentional naming: Use expressive names so the code reads like an unambiguous English sentence (e.g., naming booleans and predicates clearly to reflect intent).
Quick Start
Ask an AI to review a specific function or module against the 5 laws by identifying where to add guard clauses, where to parse at boundaries, and what invalid states should trigger descriptive errors.