Vibecoding
15 minutes
linux
macos
windows

Asking for Fixes Without Spiraling

Learn how to get AI help with bugs and errors without the conversation (and code) spiraling out of control.

What you'll accomplish

Know how to describe problems clearly and constrain AI responses to stay focused.

Prerequisites

  • Completed lesson 2 or equivalent experience
  • A code editor with AI assistance

The Spiral Problem

When debugging with AI, conversations can spiral:

  1. You report an error
  2. AI suggests a fix
  3. The fix creates a new error
  4. AI suggests a bigger fix
  5. Now your code is completely different
  6. Nothing works
Warning

If the AI's fix involves rewriting more than 10-20 lines, stop and reassess. You might be solving the wrong problem.

How to Avoid Spiraling

1. Describe the Problem Precisely

Bad prompt:

"It doesn't work"

Good prompt:

Precise Bug Report

vibecoding

A structured way to report bugs to AI

I'm getting an error in main.py.

**Expected behavior:** When I enter my name, I should see "Hello, [name]!"

**Actual behavior:** I see a TypeError

**Error message:**
TypeError: can only concatenate str (not "NoneType") to str

**Relevant code:**
name = input("What's your name?")
print("Hello, " + name + "!")

What's wrong and how can I fix it with a minimal change?
Variables:
{{expected}}
{{actual}}
{{error_message}}

2. Ask for Minimal Fixes

Always include constraints:

  • "Fix this with the smallest possible change"
  • "Don't refactor other code"
  • "Keep the same structure"
  • "Just fix the bug, don't add features"

3. Request Explanations

Fix With Explanation

vibecoding

Ask for understanding, not just code

Fix this error and explain:
1. What was wrong
2. Why your fix works
3. How to avoid this in the future

Keep the fix minimal - don't refactor.

4. One Fix at a Time

If AI suggests multiple changes:

  • Apply only the first one
  • Test it
  • Then consider the next change

Escape Hatches

When things are spiraling, use these escape hatches:

The Reset

bash
# Discard all changes since last commit
git checkout .

Then start fresh with a clearer prompt.

The Constraint

Add to your prompt:

"Do not modify any other files. Only change [specific file/function]."

The Simplification

"Ignore my previous request. Let's start simpler: what is the minimal code needed to [core requirement]?"

The Explanation Request

"Before suggesting a fix, explain what you think the bug is. I want to understand before changing code."

Red Flags to Watch For

Stop and reassess if:

  • The AI suggests installing new packages
  • The fix involves rewriting large sections
  • You're on your third "fix" without improvement
  • The AI says "let's refactor this"
Tip

When in doubt, roll back and try a different approach. Fresh starts often work better than accumulated fixes.

Practice: Intentional Bug

Let's practice with an intentional bug:

python
# buggy.py - This has a bug!
numbers = [1, 2, 3, 4, 5]
total = 0

for i in range(1, len(numbers)):  # Bug: starts at 1, not 0
    total += numbers[i]

print(f"Sum: {total}")  # Prints 14, should be 15

Try this prompt:

Practice Bug Fix

vibecoding

Practice asking for minimal fixes

This code should sum all numbers in the list, but it's giving the wrong answer.

Expected: Sum should be 15 (1+2+3+4+5)
Actual: Sum is 14

What's the minimal fix? Don't refactor the code, just fix the bug.

Verify Your Understanding

You've completed this lesson if you can:

0/4

Next: Ship something small, quickly.