Agent Skills: Prerequisite Checks

>-

UncategorizedID: adaptive-enforcement-lab/claude-skills/prerequisite-checks

Install this agent skill to your local

pnpm dlx add-skill https://github.com/adaptive-enforcement-lab/claude-skills/tree/HEAD/plugins/patterns/skills/prerequisite-checks

Skill Files

Browse the full folder contents for prerequisite-checks.

Download Skill

Loading file tree…

plugins/patterns/skills/prerequisite-checks/SKILL.md

Skill Metadata

Name
prerequisite-checks
Description
>-

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