Agent skill
error-handling-patterns
Master when to fail fast vs degrade gracefully. Production-tested error handling strategies for GitHub Actions, CI/CD pipelines, and platform automation.
Install this agent skill to your Project
npx add-skill https://github.com/adaptive-enforcement-lab/claude-skills/tree/main/plugins/patterns/skills/error-handling-patterns
SKILL.md
Error Handling Patterns
When to Use This Skill
Error handling is about when and how your automation responds to problems.
| Pattern | When to Use | Strategy |
|---|---|---|
| Fail Fast | Invalid input, missing config | Stop immediately, report clearly |
| Prerequisite Checks | Complex preconditions | Validate all upfront before work |
| Graceful Degradation | Fallbacks exist | Degrade to safer state, continue |
Implementation
See the full implementation guide in the source documentation.
Techniques
Overview
Error handling is about when and how your automation responds to problems.
| Pattern | When to Use | Strategy |
|---|---|---|
| Fail Fast | Invalid input, missing config | Stop immediately, report clearly |
| Prerequisite Checks | Complex preconditions | Validate all upfront before work |
| Graceful Degradation | Fallbacks exist | Degrade to safer state, continue |
Decision Flow
flowchart TD
A[Error Detected] --> B{Can recover?}
B -->|No| C[Fail Fast]
B -->|Yes| D{Before work started?}
D -->|Yes| E[Prerequisite Check]
D -->|No| F[Graceful Degradation]
%% Ghostty Hardcore Theme
style A fill:#f92572,color:#1b1d1e
style B fill:#fd971e,color:#1b1d1e
style C fill:#f92572,color:#1b1d1e
style D fill:#fd971e,color:#1b1d1e
style E fill:#65d9ef,color:#1b1d1e
style F fill:#a7e22e,color:#1b1d1e
Quick Reference
| Scenario | Pattern | Reasoning |
|---|---|---|
| Missing required config | Fail Fast | Can't continue safely |
| Invalid user input | Fail Fast | User error, report immediately |
| Complex deployment requirements | Prerequisite Checks | Validate tools, access, state |
| API timeout | Graceful Degradation | Retry or use backup |
| Service unavailable | Graceful Degradation | Fall back to alternatives |
Fail fast when you can't recover. Degrade gracefully when you can.
References
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
github-token-permissions-overview
Understanding GITHUB_TOKEN scope, default permissions, and implementing least-privilege principle for GitHub Actions workflows.
secure
Find and fix security issues before they become incidents. Vulnerability scanning, SBOM generation, supply chain security, and secure authentication workflows.
complete-workflow-examples
Copy-paste hardened CI/CD workflows with SHA-pinned actions, minimal GITHUB_TOKEN permissions, OIDC authentication, and comprehensive security scanning for GitHub Actions.
ephemeral-runner-patterns
Disposable runner patterns for GitHub Actions. Container-based, VM-based, and ARC deployment strategies with complete state isolation between jobs.
action-pinning-overview
Why pinning GitHub Actions to SHA-256 commits matters for supply chain security. Attack vectors from unpinned actions and comparison of tag vs SHA pinning.
github-actions-security-patterns-hub
Complete security patterns for GitHub Actions covering action pinning, GITHUB_TOKEN permissions, third-party action risks, secret management, and runner security.
Didn't find tool you were looking for?