How do you make sure an AI answer never saves wrong data or charges twice?Deterministic Validation Gates & Idempotency
- Module
- 03/05
- To read
- ~7 min
An outside service keeps taking too long to answer, so request after request times out. A payment agent retries a billing step several times. What do you think goes wrong?
In the module you make your guess first, then read what happened and why.
Trust no AI answer until code checks it
One unique key per action, reused on every retry
Say no when in doubt (fail closed)
Make every step safe to run twice
A check-before-save and no-double-charge plan
A spec for your own app, as a text file you download. The module also gives you the prompt to paste into the AI you build with (Lovable, Bolt, Replit, Cursor, Claude Code or Codex), a checklist to check what it built, and recommended skills.
- A database rule that blocks repeats (unique index)
- Keeping the first answer (caching)
- The same message can arrive twice