plugins/patterns/skills/fail-fast/SKILL.md
Detect and halt on precondition failures before expensive operations begin. Validate inputs, permissions, and state upfront in CI/CD and automation workflows.
npx skillsauth add adaptive-enforcement-lab/claude-skills fail-fastInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Fail fast is a design pattern that validates preconditions before executing expensive or irreversible operations. When validation fails, the system immediately reports the error rather than proceeding and failing later in an unpredictable state.
flowchart TD
subgraph validation[Validation Phase]
A[Request] --> B{Preconditions Met?}
end
subgraph execution[Execution Phase]
C[Execute Operation]
D[Success]
end
subgraph failure[Failure Phase]
E[Report Error]
F[No Side Effects]
end
B -->|Yes| C
C --> D
B -->|No| E
E --> F
%% Ghostty Hardcore Theme
style A fill:#65d9ef,color:#1b1d1e
style B fill:#fd971e,color:#1b1d1e
style C fill:#a7e22e,color:#1b1d1e
style D fill:#a7e22e,color:#1b1d1e
style E fill:#f92572,color:#1b1d1e
style F fill:#f92572,color:#1b1d1e
The key insight: fail before you start, not in the middle.
| Scenario | Apply Fail Fast? | Reasoning | | ---------- | ------------------ | ----------- | | Invalid user input | Yes | User error, report immediately | | Missing required config | Yes | Can't continue safely | | Insufficient permissions | Yes | Operation will fail anyway | | Resource allocation failure | Yes | Partial allocation is worse | | Network timeout | No | Use graceful degradation | | Cache miss | No | Expensive path still works |
Decision rule: Fail fast on precondition failures. Degrade gracefully on runtime failures.
See examples.md for detailed code examples.
See examples.md for detailed code examples.
Comprehensive techniques for implementing fail fast patterns:
Stop execution immediately when errors occur:
set -euo pipefail)Enable strictest validation and error detection:
Validate assumptions and fail if they're wrong:
Determine when to throw vs return, panic vs recover:
Prevent operations from running indefinitely:
See reference.md for additional techniques and detailed examples.
These patterns are complementary, not contradictory:
See examples.md for detailed code examples.
| Error Type | Pattern | Example | | ------------ | --------- | --------- | | Missing config | Fail Fast | Can't start without database URL | | Database timeout | Graceful Degradation | Retry, then use cache | | Invalid input | Fail Fast | Reject malformed request | | API unavailable | Graceful Degradation | Use backup endpoint | | Insufficient permissions | Fail Fast | Don't attempt forbidden operation | | Rate limited | Graceful Degradation | Exponential backoff |
Validating after side effects have occurred.
See examples.md for detailed code examples.
Continuing despite failures.
See examples.md for detailed code examples.
Executing some operations before checking all preconditions.
See examples.md for detailed code examples.
Failing fast but not explaining why.
# Bad: unhelpful error
[ -f "$CONFIG" ] || exit 1
# Good: actionable error message
[ -f "$CONFIG" ] || { echo "Config file not found: $CONFIG. Create it from config.example.yml"; exit 1; }
See examples.md for code examples.
See reference.md for complete documentation.
documentation
Workload Identity Federation implementation guide. GKE setup, IAM bindings, ServiceAccount configuration, migration from service account keys, and troubleshooting patterns.
development
Secure GitHub Actions trigger patterns for pull requests, forks, and reusable workflows. Preventing privilege escalation and code injection through trigger misconfiguration.
development
Structured framework for evaluating GitHub Actions security before adoption. Trust tiers, risk assessment checklist, and decision tree for action evaluation.
testing
Securely store GitHub App credentials across different environments. GitHub Actions secrets, external CI, Kubernetes, and automated rotation patterns.