Stuck when vibecoding, Now what?

Imagine this: you are vibecoding, everything is working, you are cruising your project, getting things done.

You encounter a bug. Oh, a simple bug. Here comes my SONNET Monster to kill that bug. And it is promising, model replies in its very hopeful and charming way

Ah, I see the problem. I am gonna do this and that to fix your life.

Yes, it made the changes, but you rechecked, the code is still not working 😲. You tell it again that it is not fixed, and again, it  replies in its charming way

Ah, I see the problem now. I am gonna do this and that to fix your life now.

But still, the bug is there, and it was not fixed just like first attempt. You try many times, and nothing is working. You grow hopeless and start to think your father was right, you should have become a doctor. Oh, God, I should have studied more for that stupid MDCAT 🥲.

Alas, but what can done you now? You are stuck here with this stupid AI. Now, the amount of code is so big that if you start to debug it by yourself, it will take a lot of time.

But I have a solution for you.

Write Tests

The basic solution is to write tests. They work great if you are working with backend code and the stupid model does not skip the failing test (Actually happened with me 😂). Give ai the test command to run the test. After that, models are smarter now they will figure things out.

Prompts to the Rescue

Some methods that worked for me.

  • First, define the problem, then ask it to think deeply about it and read the code. Then, think of 10 different ways that might be causing the problem and add pros and cons for each method.
  • Ask it to add console logs to investigate what problem is causing the issue. Then, in the next message, pass the logs with the message
  • Hopefully, after going through these steps model and you both get an understanding of the problem, and problem is solved by the model🎉

Now you can tell yourself, you are the best software engineer in the 🌎.