Infrastructurepattern

State-machine capability check (7-state)

"Why is the integration broken?" eats 20-minute Slack threads. Seven precise states, each with the exact fix and time cost printed.

TierBMedium — Solid coverage with concrete examples
EffortM · Weeks
Forengineer · ops lead · any tool that integrates with a shared resource

What

Before offering an auto-write to a shared Google Sheet (or Notion DB, or Linear project, or any team-owned external resource), the tool runs a capability check that returns one of seven precise states, each with the exact fix and a realistic time estimate:

StateMeaningFix (with time)
readyBoth targets auto-writableProceed
partialOne target works, other doesn'tAuto-write the good one, manual paste for the other
schema_mismatchRequired headers missingSet *_TAB env vars (~30s)
needs_shareCreds exist but resource 403/404sShare resource with printed service-account email (~30s)
no_credentialsNo service-account JSONRun setup_google_sheets.sh (~5–15min)
no_idTEAM_SHEET_ID env var unsetSet it in .env
lib_missingRequired Python library missingpip install <name>

The user picks based on time cost; nothing is forced.

Why it matters

"Why is the integration broken" is the #1 support burden for any tool that touches a shared external resource. Every failure mode having a printed fix with a realistic time cost converts a 20-minute Slack thread into a 30-second self-service. A founder-discovery CLI uses this pattern; users go from "I'm stuck" to "I picked manual paste" in seconds.

End-to-end

  1. Enumerate every failure mode in the integration. Group into 5–9 states.
  2. For each state, document: the exact symptom, the exact fix command, a realistic time estimate.
  3. Implement tool check that runs probes in order (cheapest first: env vars → library import → API auth → resource read → schema match).
  4. Return early on the first failing state; print the state name, fix, time.
  5. Support --json output for scripting.
  6. In SKILL.md, document the state table so the agent surfaces the right choice without re-discovering it.

Gotchas

  • Don't gate the entire tool on ready. Many states have valid fallback modes (manual paste, partial auto-write); surface them as menu options, don't force the auto path.

Tools

  • Whatever the integration uses (Google API libs, Notion SDK, etc.)
  • A YAML / JSON definition of the schema you require