~/resources/patterns/pipeline-first-builds
// pattern

Pipeline-First Builds

If a feature has more than two steps, design the full pipeline before writing any code. Three fixes deep on the same bug means stop patching, start designing.

Origin: SuperNova form-filling incident Domain: process · agents

The anti-pattern

See symptom → fix symptom → test → new symptom → fix → test → repeat

Each cycle feels productive. None of them are. You're adding wheels to a shopping cart instead of designing a car.

The principle

  1. If the feature has more than 2 steps, design the full pipeline before writing code. Define every step: inputs, outputs, failure modes, user touchpoints.
  2. Present the design. Get alignment. Then build.
  3. Three fixes deep = stop patching, start designing. If you're on your third fix for the same system, you're not fixing — you're building without a plan.
  4. Audit external dependencies before building on them. Check issue trackers, changelogs, known limitations. Five minutes of reading beats hours of debugging.
  5. Irreversible agent actions always get a confirmation gate. Present plan, wait for approval. Applies to: form submissions, emails, purchases, API calls, anything hard to undo.
  6. Do the math, not vibes. Timeout budgets, resource limits, concurrency — calculate explicitly before shipping.

Applied example: form-filling pipeline

Wrong approach (what we did):

"Dropdowns don't work" → add fuzzy matching → still broken → add ARIA handling → still broken → add Stagehand fallback → timeout → add retry → infinite loop.

Right approach:

1. EXTRACT  — Parse form schema (fields, types, options, required)
2. MATCH    — Map schema against known data
3. CONFIRM  — Present plan to user, flag gaps, wait for approval
4. FILL     — Playwright for native elements, AI for custom
5. VERIFY   — Screenshot, compare against plan
6. SUBMIT   — Only on explicit approval

Design this pipeline first. Then ask: what can go wrong at each step? Then build safety mechanisms. Then build the feature.

Detection signals

You're in patch-mode when:

When you notice these signals: stop coding, start designing.