Preface
- Who this book is for
- What an AI coding agent actually is
- How this book is organized
- How to read a case
- An honest note about the cases
- A safety note
- What this book is not
- A note on the code
- How to get the most out of this book
- Let us begin
Chapter 01: Why Agent-Built Software Fails Differently
- What you will learn
- The agent does not think. It predicts.
- “Looks right” is a trap for humans, too
- The four properties of agent failures
- The agent is not the enemy
- Why this is different from ordinary debugging
- The three places to stand
- The cost of skipping the check
- A short example to set the tone
- Summary
- Try it yourself
Chapter 02: How to Read a Case, and How to Keep Your Own Failure Log
- What you will learn
- How a case is built
- Symptom-first reading
- A worked match
- Two ways to read this book
- Read the root cause, not just the fix
- The difference between a fix, a check, and a guardrail
- Why keep a failure log
- A simple log format
- The habit that keeps the log alive
- From log to guardrail
- The log is not a record of shame
- Summary
- Try it yourself
Chapter 03: Spec and Context Failures
- Case 1: The Requirement Nobody Read Twice
- Case 2: The Feature That Grew Overnight
- Case 3: The Constraint That Vanished
- Case 4: Two Answers to One Question
- Case 5: The Bonus Feature Nobody Asked For
- Case 6: The Prompt With Three Meanings
- Summary
- Try it yourself
Chapter 04: Code and Logic Failures
- Case 7: Looks Right, Does Wrong
- Case 8: The Package That Does Not Exist
- Case 9: Off by One, Off by Everything
- Case 10: The Error Nobody Saw
- Case 11: Copy, Paste, Diverge
- Case 12: Yesterday’s API
- Summary
- Try it yourself
Chapter 05: Data Failures
- Case 13: The Migration That Ate the Table
- Case 14: The Schema That Drifted
- Case 15: The Row That Was Overwritten
- Case 16: Seed Data That Should Not Ship
- Case 17: The Midnight Bug
- Case 18: No Backup, No Mercy
- Summary
- Try it yourself
Chapter 06: Security Failures
- Case 19: The Key in the Code
- Case 20: The Door With No Lock
- Case 21: The Input That Became a Command
- Case 22: The Upload That Took the Server
- Case 23: Everyone Is an Admin
- Case 24: Secrets in the Logs
- Case 25: Trusting the Client
- Summary
- Try it yourself
Chapter 07: Dependency and Environment Failures
- Case 26: Dependency Hell, Assembled
- Case 27: The Package Nobody Maintains
- Case 28: Works on My Machine
- Case 29: The Missing Environment Variable
- Case 30: The Build That Broke Itself
- Summary
- Try it yourself
Chapter 08: Testing Failures
- Case 31: The Test That Tests Nothing
- Case 32: Mocking Away Reality
- Case 33: The Test That Disappeared
- Case 34: The Happy Path Only
- Case 35: The Test That Breaks on Refactor
- Summary
- Try it yourself
Chapter 09: Workflow and Agent-Behavior Failures
- Case 36: The Endless Fix Loop
- Case 37: The Thousand-Line Diff
- Case 38: The File That Was Overwritten
- Case 39: The Session That Forgot
- Case 40: “All Tests Pass”
- Case 41: The Edit in the Wrong File
- Case 42: The Permission Nobody Needed
- Summary
- Try it yourself
Chapter 10: Deployment and Operations Failures
- Case 43: Debug Mode in Production
- Case 44: The Silent Outage
- Case 45: The Deploy With No Way Back
- Case 46: The App That Ate the Server
- Case 47: The Secret in the Git History
- Summary
- Try it yourself
Chapter 11: Human Failures
- Case 48: Trusting the Summary
- Case 49: The Review That Never Happened
- Case 50: Shipping Code You Do Not Understand
- Summary
- Try it yourself
Chapter 12: Building Your Guardrails
- What you will learn
- The rules file
- Turning a failure into a rule
- A ready-made starter set
- Prompt lines that ship with every request
- Small steps
- Version control habits
- Marketing the guardrails
- Rules growing, rules shrinking
- Making the tools show their work
- Summary
- Try it yourself
Chapter 13: A Review Routine You Can Run in 15 Minutes
- What you will learn
- The setup
- Phase 1: What is here (3 minutes)
- Phase 2: The sensitive files (5 minutes)
- Phase 3: The three questions for the whole change (4 minutes)
- Phase 4: Run it (3 minutes)
- The one-line verdict
- Keeping it honest when you are tired
- Fitting it into a small habit
- A worked fifteen minutes
- The five-minute fast version
- Summary
- Reviewing the review
- Try it yourself
Chapter 14: When to Stop and Start Over
- What you will learn
- The three stop conditions
- Sunk work does not vote
- A worked decision
- Make the start-over small
- Messy versus tangled
- When to keep the old thing anyway
- The cost of a rebuild, honestly counted
- Avoiding the decision altogether
- The after-action, briefly
- The three stop conditions, as a decision tree
- Summary
Appendix A: Failure-Log Template
- The weekly review
- Examples
- Labels
Appendix B: Prompt Snippets Library
- Setup and scope
- Boundaries and quality
- Data safety
- Security
- Testing
- Workflow
- Operations
- Rebuild
- The three that ship with everything
Appendix C: Pre-Ship Checklist
- Data and backups
- Secrets and security
- Environment and dependencies
- Tests and review
- Data that must never ship
- After the deploy
- The last line
Appendix D: Case Index by Symptom
- App behavior
- Data
- Agent behavior
- The human side
- Noticing and catching (the “odd smell” list)