Consolidate all precondition validation into a dedicated gate phase. Check tools, permissions, state, and resources before executing deployment or automation tasks.
Consolidates all precondition validation into a dedicated gate phase that checks tools, permissions, state, and resources before executing deployment or automation tasks. Claude uses this when starting any operation that could fail due to missing prerequisites, ensuring all requirements are verified upfront to fail fast and avoid partial execution.
/plugin marketplace add adaptive-enforcement-lab/claude-skills/plugin install patterns@ael-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
examples.mdreference.mdscripts/example-1.mermaidscripts/example-2.yamlPrerequisite checks are a structured approach to fail fast validation. Instead of scattering validation throughout code, you consolidate all precondition checks into a dedicated phase that runs before any work begins.
flowchart LR
subgraph prereq[Prerequisite Phase]
A[Check Tools]
B[Check Access]
C[Check State]
D[Check Resources]
end
subgraph gate[Gate]
G{All Pass?}
end
subgraph exec[Execution Phase]
E[Execute Operation]
end
A --> B --> C --> D --> G
G -->|Yes| E
G -->|No| F[Abort with Report]
%% Ghostty Hardcore Theme
style A fill:#65d9ef,color:#1b1d1e
style B fill:#65d9ef,color:#1b1d1e
style C fill:#65d9ef,color:#1b1d1e
style D fill:#65d9ef,color:#1b1d1e
style G fill:#fd971e,color:#1b1d1e
style E fill:#a7e22e,color:#1b1d1e
style F fill:#f92572,color:#1b1d1e
The key insight: check everything, then do everything.
| Category | What to Check | Example | Guide |
|---|---|---|---|
| Environment | Required tools and variables | kubectl, $DATABASE_URL | Environment |
| Access | Permissions are granted | API tokens, RBAC roles | Permissions |
| State | System is in expected state | Resource exists, not locked | State |
| Input | Inputs are valid | Required fields, formats | Input |
| Dependencies | Dependencies are ready | Upstream jobs, services | Dependencies |
| Scenario | Apply Prerequisite Checks? | Reasoning |
|---|---|---|
| Kubernetes deployment | Yes | Check cluster access, namespace, resources |
| GitHub Actions workflow | Yes | Check secrets, tools, permissions |
| Database migration | Yes | Check connectivity, schema version, backup |
| API request handling | Depends | Check inputs yes, runtime state no |
| File processing | Depends | Check file exists yes, content format no |
Decision rule: Use prerequisite checks for validation you can do upfront, not validation that requires starting the operation.
See Implementation Patterns for:
| Pattern | How Prerequisite Checks Applies |
|---|---|
| Fail Fast | Prerequisite checks are structured fail-fast validation |
| Graceful Degradation | Prerequisites determine if graceful degradation is even possible |
| Idempotency | Check-before-act is a prerequisite pattern |
| Work Avoidance | Prerequisites can include "work already done" checks |
See reference.md for additional techniques and detailed examples.
See examples.md for code examples.
See reference.md for complete documentation.