fail-early-pattern SKILL.md skillA
fail-early-pattern from pjt222/agent-almanac is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.
mdr add pjt222/agent-almanac/fail-early-pattern@v1.0Pins v1.0 in mdr.lock. Pin the fingerprint instead.
- Audit grade
- A, 17 of 17 checks passed
- Kind
- SKILL.md skill
- Repository
- pjt222/agent-almanac
- Path
i18n/caveman-lite/skills/fail-early-pattern/SKILL.md- Versions recorded
- 3
- Latest version
- v1.0, committed Aug 17, 2026
- First version recorded
- Apr 19, 2026
- Size
- 13,214 bytes
- Repository stars
- 43
- License
- MIT
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…
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# Fail Early If something is going to fail, it should fail as early as possible, as loudly as possible, with as much context as possible. This skill codifies the fail-early pattern: validating inputs at system boundaries, using guard clauses to reject bad state before it propagates, and writing error messages that answer *what* failed, *where*, *why*, and *how to fix it*. ## When to Use - Writing or reviewing functions that accept external input (user data, API responses, file contents) - Adding input validation to package functions before CRAN submission - Refactoring code that silently produces wrong results instead of erroring - Reviewing pull requests for error-handling quality - Hardening internal APIs against invalid arguments ## Inputs - **Required**: Function or module to apply the pattern to - **Required**: Identification of trust boundaries (where external data enters) - **Optional**: Existing error-handling code to refactor - **Optional**: Target language (default: R; also applies to Python, TypeScript, Rust) ## Procedure ### Step 1: Identify Trust Boundaries Map where external data enters the system. These are the points that need validation: …
Read the whole file at its exact version.
How to install
mdr add pjt222/agent-almanac/fail-early-pattern@sha256:c88d02e4b7273da7The line at the top of this page pins the label v1.0, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
[](https://markdownregistry.com/a/art_2dcpltfq3svok7a3)
3 badge image fetches in 30 days. What the badge shows.
Versions
The registry has recorded 3 versions of this file, between Apr 19, 2026 and Aug 17, 2026, about one every 60 days.
| version | committed | commit | size | audit | |
|---|---|---|---|---|---|
| v1.0 latest | 2026-08-17 | a784899 | 13,214 B | A | view · diff |
| v1.0 | 2026-04-24 | 0b91b04 | 13,185 B | A | view · diff |
| v1.0 | 2026-04-19 | e334ebd | 13,248 B | A | view |
Audit of the latest version
- pass: Frontmatter block present
- pass: Frontmatter declares a name
- pass: Frontmatter declares a description
- pass: Size between 200 bytes and 200 KB (13214 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
pjt222/agent-almanac · 43 stars · license MIT · pushed 2026-11-06 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_2dcpltfq3svok7a3 GET https://markdownregistry.com/api/v1/resolve?ref=pjt222/agent-almanac/fail-early-pattern GET https://markdownregistry.com/api/v1/blob/c88d02e4b7273da7235b8ebd96ef3d28a98731e565353db2fb10d27d00c579c6
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.