Error-first patterns specialist for writing robust, predictable code that fails loudly with actionable messages and recovers gracefully where appropriate. Use when writing functions that call external APIs, parse user input, access the filesystem, perform database operations, or any logic where failure is possible. Trigger for asks like "add error handling", "handle failures", "what if this fails", "make this more robust", "add validation", "improve error messages", or when reviewing code that uses bare try/catch, ignores error returns, or has deeply nested conditionals.
Use this skill to write code that fails loudly, recovers predictably, and produces error messages that tell users and operators exactly what went wrong and what to do.
Enumerate all failure modes.
Apply guard clauses at function entry.
Design typed error classes.
ValidationError, NotFoundError) from infrastructure errors (DatabaseError, NetworkError).Handle edge cases explicitly.
Write actionable error messages.
| Topic | Reference | Load when |
|---|---|---|
| Error patterns | references/error-patterns.md | Guard clauses, early returns, result types, error classification |
| Error messages | references/error-messages.md | Writing clear, actionable, non-leaking error messages |
| Language-specific | references/error-by-language.md | TypeScript, Python, Go, Rust — idiomatic error handling per language |
Error).catch (e) {} or except: pass that silently swallows errors.null or -1 to signal failure without clear documentation.// TODO: handle errors and ship it.AppError class for all failure modes with no distinction.For error-handling tasks, provide: