# Fail Fast A design philosophy where systems detect and report errors as early as possible rather than propagating bad state. The earlier a failure surfaces, the cheaper it is to diagnose and fix. ## How it works - Validate inputs at the boundary, before doing work - Throw exceptions immediately rather than returning error codes that might be ignored - Prefer compile-time errors over runtime errors, and runtime errors over silent corruption ## The alternative: fail slow Systems that fail slowly propagate bad state. A function receives invalid input, produces a slightly wrong output, which feeds into the next function, which produces a more wrong output. By the time the error surfaces, it is far from its cause. Debugging becomes archaeology. ## In AI skills AI skills that fail fast check preconditions before doing work: - Does the target file exist before trying to read it? - Is the required context loader available? - Does the input match expected format? A skill that silently proceeds with missing context produces plausible but wrong output. A skill that stops and says "missing required context: seb-writing" is immediately diagnosable. [[AI Skill Resilience]] is built on fail-fast: check before assuming, fail gracefully with clear messages. ## References - ## Related - [[AI Skill Resilience]] - [[AI Skill Best Practices]] - [[Design by Contract]] - [[SOLID Principles]] - [[Software Design Patterns for AI Skills and Agents]]