Agent skill
prerequisite-checks
Consolidate all precondition validation into a dedicated gate phase. Check tools, permissions, state, and resources before executing deployment or automation tasks.
Install this agent skill to your Project
npx add-skill https://github.com/adaptive-enforcement-lab/claude-skills/tree/main/plugins/patterns/skills/prerequisite-checks
SKILL.md
Prerequisite Checks
When to Use This Skill
Prerequisite 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.
Prerequisites
| 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 |
When to Apply
| 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.
Implementation
See Implementation Patterns for:
- Check ordering strategy (cost-based)
- Implementation patterns (fail-first vs collect-all vs structured)
- Common CI/CD prerequisites checklist
- Anti-patterns to avoid
Techniques
Relationship to Other Patterns
| 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.
Examples
See examples.md for code examples.
Full Reference
See reference.md for complete documentation.
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?