How to Code With AI · Part 3 · Prompt Patterns · Lesson 3.4
Ask the engine to break it before it builds it.
Get the LLM to enumerate failure modes BEFORE it writes code. Half the bugs surface in the analysis, not the implementation.
The lesson
The amateur prompt: "Implement X." The professional prompt: "If I were to implement X, what could go wrong? List the failure modes ranked by severity. Then implement, addressing the top three."
This single inversion catches more bugs than any test suite. The LLM is good at brainstorming failure modes — better than at preventing them — so use it for the brainstorm. Then make it implement WITH the failure modes already top of mind.
The failure modes also become your test cases for free.
Example
✓ Failure-modes-first
"I'm about to build a rate limiter at 5 req/sec. Before you write code: list the 5 most common ways rate limiters fail in production. Rank by severity. Then write the implementation + a test for each failure mode."
✗ Happy-path-only
"write a rate limiter" You receive a rate limiter. It passes the happy path. It fails at the boundary, under burst load, on clock skew, on restart. You discover this in production.
Try it · Vibe Trial
Build a rate limiter via failure-modes-first
~90 seconds. Drops you into the workbench. Coach the engine — no code required.
Try this trialWatch it · Codigami
Codigami: failure-modes loop on the rate limiter trial