Fail Early Pattern

Apply the fail-early (fail-fast) pattern to detect and report errors at the earliest possible point. Covers input validation with guard clauses, meaningful error messages, assertion functions, and anti-patterns that silently swallow failures. Primary examples in R with general/polyglot guidance. Use when writing functions that accept external input, adding input validation before CRAN submission, refactoring code that silently produces wrong results, reviewing PRs for error-handling quality, or hardening internal APIs against invalid arguments.

pjt222 Updated

File contents

pjt222/agent-almanac/tree/main/i18n/caveman/skills/fail-early-pattern commit 101c0f0fcf

Frequently asked questions

npx skillmds@latest add pjt222/fail-early-pattern-6