// 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.
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
- If the feature has more than 2 steps, design the full pipeline before writing code. Define every step: inputs, outputs, failure modes, user touchpoints.
- Present the design. Get alignment. Then build.
- 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.
- Audit external dependencies before building on them. Check issue trackers, changelogs, known limitations. Five minutes of reading beats hours of debugging.
- 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.
- 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:
- You've fixed the same area 3+ times this session
- Each test reveals a different failure in the same system
- You're adding workarounds instead of understanding root causes
- You haven't read the docs/issues for the tool you're building on
When you notice these signals: stop coding, start designing.