The Engineering of Intent, Chapter 25: The Debugging Playbook
This is Part 25 of a series walking through my book The Engineering of Intent. In the previous chapter, we catalogued what goes wrong in the process. Chapter 25 catalogs what goes wrong in the code — ten classes of bug and the investigation pattern that fits each.
A Flipbook, Not a Narrative
Use this chapter as a flipbook when a specific bug is in front of you. Each entry names the class, the typical symptoms, the investigation pattern, the prompts to use, and a worked example. I’ll list the ten here and quote a few of the worked examples.
The Ten Classes
- Deterministic-But-Wrong — easiest class. Minimum repro + Bug-Hypothesis prompt + regression test.
- Intermittent — gather pattern data before investigating. When it happens matters more than what fails.
- Regression After Refactor — bisect, then compare line-by-line. The bug is almost always an unnoticed behavior change.
- Only In Production — find the environmental difference. Reproduce the difference in staging.
- Performance Regression — profile before hypothesizing. The bottleneck is rarely where you expect.
- Concurrency Bug — do not trust your first intuition. Enumerate interleavings. Agents are unusually patient about this.
- External-Service Bug — the third party’s docs are often wrong. Reproduce exact request/response.
- Configuration Bug — diff the deployed config against the source. Agents are excellent at this.
- Data-Shape Bug — sample the data. Look for nulls and extra fields you didn’t anticipate.
- The “It Cannot Happen” Bug — the statement is wrong. Find out why. An agent will check the code, not the claim.
Two More Worked Examples
On Only In Production: a serialization bug that only occurred with records containing a specific unicode character. Staging didn’t have that record. Once we copied a minimal version with the character, staging reproduced. One-line encoding correction.
On Configuration Bug: an environment variable correct in staging and missing in production. The agent flagged it when given both templates side by side. Fix: one line added to the production template and a template-consistency test added to CI. The test costs nothing; the incident would have cost a weekend.
“The ‘it cannot happen’ bug is my favorite one to work on, because the team has told me multiple times that it cannot. Agents are useful here because they do not share your confidence — they will check the actual code rather than believing the claim. After a merger, a rare class of users had been migrated and now had two IDs, breaking an invariant the team had trusted for years.”
Next up — Chapter 26: Checklists for the Working Engineer. Chapters 23 to 25 gave patterns and playbooks. Chapter 26 gives the short-form artifacts I actually reach for mid-task — the pre-ship checklist, the review checklist, the incident checklist, and a few others that fit on one screen.
📖 Want the full picture?
The chapter walks each of the ten classes with symptoms, full investigation pattern, prompt templates, and the complete worked example including the exact fix.
Sho Shimoda
I share and organize what I’ve learned and experienced.Categories
Tags
Search Logs
Development & Technical Consulting
Working on a new product or exploring a technical idea? We help teams with system design, architecture reviews, requirements definition, proof-of-concept development, and full implementation. Whether you need a quick technical assessment or end-to-end support, feel free to reach out.
Contact Us