Skip to content
Khaled.dev
infrastructure1 min read

Graceful Degradation for Build Pipelines

A skill that teaches an agent to design build steps that never hard-fail on missing credentials or services — always falling back to a safe default.

Build pipelines die when a secret is missing on a fork, a fresh clone, or a CI job without access. This skill makes an agent design steps that degrade gracefully instead of blocking the build.

Principle

The build must succeed with zero credentials. Secrets are an enhancement, not a requirement.

Procedure

  1. Detect, don't assume. Check for the credential before using it.

    if (!process.env.NOTION_TOKEN) {
      console.log("skipping Notion (no creds) — using bundled samples");
      return; // not an error
    }
    
  2. Ship a fallback artifact. Bundle sample data so the rest of the pipeline has something real to consume.

  3. Log the path you took. A clear one-line message ("using bundled samples") saves hours of confused debugging.

  4. Never throw on absence. Missing optional input is a normal state, not an exception.

  5. Keep downstream code path-agnostic. Consumers shouldn't know or care whether data came from the live source or the fallback.

Checklist

[ ] Every external dependency has a no-creds path.
[ ] The fallback produces the same artifact shape as the real source.
[ ] The chosen path is logged.
[ ] No step throws purely because a secret is absent.

Success criteria

  • A clean clone with no env vars builds successfully.
  • The logs clearly state which path ran.
#agents#ci#reliability#build