Jonathan Bennett

How I handle bugs without losing my mind

I have a confession: I’ve written bugs before.

😱

But here’s the thing: bugs happen. What matters is having a consistent, reliable process for dealing with them—especially one that keeps you from fixing the same bug more than once.

Here’s the approach I use when a bug shows up:

🪲 The Bug-Fix Loop 🐞

  1. Quick triage:
    Is this bug worth fixing? If it’s clearly a one-off or edge case that’s not affecting users, sometimes it’s okay to leave it alone. Triage saves you from wasting time.

  2. Replicate it:
    Get it to happen again—ideally in a local or staging environment. This is usually the hardest step. Once you can consistently reproduce the bug, the fix often reveals itself.

  3. Write a test that fails:
    This is the step most people skip. Before you fix the bug, write a test that demonstrates it. This proves the bug exists and protects you from accidentally reintroducing it later.

  4. Fix the bug:
    With a failing test in place, write the code that makes the test pass. Nice and tidy.

  5. Deploy (and celebrate):
    Your test suite is stronger, your code is better, and you’ve earned a snack.


Most of all: don’t pay for the same bug twice.
Regression bugs are costly, embarrassing, and usually avoidable—if you write the test.