Escape the Vibe Coding Death Spiral (Code With AI Faster)

AI coding agents often trap you in loops of progress and failure. Watch for agents that lie about finished work, ignore instructions, or generate duplicate code. Break tasks into small pieces, commit frequently to GitHub, and validate everything against solid engineering principles.
Chapters
The way that I think about these, these agents is that they have the knowledge within them. If you can unlock it, they know how to build pretty much anything you want to build. However, they might not know how to access that exact way that you want them to build it. So in today's video, we're going to talk about a topic that I'm sure you've experienced as a developer, and it's one of the most frustrating parts of working with AI agents at the moment. Which I like to call the vibe coding death spiral. Try a completely novel approach and keep in mind the component structure. No, no, no, no, no, no. And in today's video, I'm going to show you firstly what we're going to talk about, what this death spiral is. We're going to talk about the reality of coding with agents, how you can develop your BS detector to basically understand why you get stuck in these loops with agents, and then also how to mitigate these risks. I've got this image over here of these ants going in circles. And if you've never seen this before, you can actually Google this. It's basically a phenomenon where these army ants will detect the pheromones of the ant in front of it. And sometimes it leads to them kind of going in a circle and then it just becomes this death trap where they just keep going round and round and round in circles. So when you're coding with AI agents, it can sometimes feel like this. Where you're trying to create a feature and the agent will just lead you in circles for hours and you can keep trying to prompt it. You can ask it and it just ends up not only like sometimes doesn't create the feature, but it can break other stuff that was working. So it's just really frustrating. And I want to talk about how I've been overcoming this. And yeah, let's get into it. So reality of AI agentic coding. Uh, first thing that I just want to mention is it's kind of like 10 steps forward, 5 steps back. And you can see this graph over here. It shows like you go up and then you go down, you go up and you go down. This has been my experience is that, you know, even with all the prompting techniques in the world, the AI agent is still going to break things while you build out new features. So it's just important to be aware that you have to kind of ride the wave essentially of it creating stuff and then fixing, and then you have to fix the stuff. So as I say here, the benefits of AI coding is that you can give it a massive task list and have have it run for hours executing everything on the task list. If you haven't seen my video on 24/7 AI agentic coding, you can take a look at that video. But also, it's going to make a ton of mistakes. And it's also going to break a lot of things that were probably working before, especially if you're trying to build high, like very large enterprise-level apps, which I'm busy working on right now. The next thing is AI agents equals dynamite. I'm not sure if you've ever seen this before, but the Mount Rushmore faces were actually built, interestingly enough, using dynamite. So to create the original shape, they first had to carve huge, you know, different like craters out of the mountain. And so they used dynamite in strategic places and slowly started to shape it into the faces of the presidents. Um, and so it's similar with the AI coding because you can make a lot of progress with these agents. Like they can do so much for you, especially if you have them running in parallel, but you're also going to create a lot of destruction in your path. And so we need to learn how to manage that destruction and turn the chaos into something that, yeah, we can actually build with. Um, so let's talk about some of the problems that generally come up when we're discussing AI agentic coding. I've got a whole list here, and this is all from my own personal experience. But first one, so AI agents are constantly lying, lying to you. So I've got some examples. You can see first one is the agent says the implementation is now complete and safe. Here's what we've done. We've changed the default model. We've created a state management system that saves the last used model to the local storage. So it told me it did all of these things. And then I said to it, hey, I noticed that I just updated this. I didn't see that it was updated. And then it literally says like, oh, I see the issue. This thing, which I just told you I fixed, is actually not saving to the local storage. And so we only added like one of the features and then it has to go and fix it again. So the next thing here, another example, it seems you only updated the max tokens and it's like, oh yeah, I see you're right. The temperature handler is still using the old pattern without saving, even though it literally just told me that it fixed that. So this is one of the things that I see coming up quite a lot. Basically, we need to be aware of that. We need to be aware that these agents are not always doing things exactly like you would expect. The next one is quite a fascinating idea, but it's essentially sycophancy, sycophancy bias, which is that the agent is overly agreeable. So if you see over here, and, you know, sometimes my top, my conversations with these agents can get quite heated. Especially when you're just working for hours trying to build something. But sometimes the, the agent will actually agree with you without really understanding what it's supposed to be doing. So if you're trying to code something that you are still learning yourself, the agent can sometimes just agree with what you think the right answer is instead of trying to, you know, correct you and really think from first principles, what is the best way to approach what you're building? So very interesting. you know, kind of phenomena that happens with these agents. And yeah, as I said here, the deceptiveness of AI cannot be understated. If you let it, AI will lead you astray and you might not even realize it. The context-limited window, uh, context window means that it doesn't always have a full understanding, and so it can sometimes go in the wrong direction. It's very important that you actually keep it on track. All right, next one. AI creates duplicate code. So I have found this so many times and I'm still in the process of overcoming this, but sometimes the agent will just blatantly create multiple versions of the same thing in your codebase and lead to a lot of bloated code. And it's very important to be aware of this because it's just not good. And then you have to update it in multiple places. Here's an example. I said, um, whoa, whoa, whoa. You don't need to add anything. It should already be there. And it goes. You're absolutely right. Let me check if it's already there by searching more carefully. Oh yeah, let me undo my change since it's already there. So it's literally like I have to correct it and point out to it, like, don't add things that are already there. So yeah, as I said, lazy, sometimes it doesn't thoroughly check and think before it acts. So next one, making breaking slash incomplete changes. This is again, the AI will sometimes just fix things halfway, so If you ask it to implement a feature, it will do like half the feature and then it will tell you that it's done. And then when you test it out, suddenly it's just not working correctly, or it looks like it's working, but it's missing some of the aspects of it. And ultimately, like, this is a huge error. So, so what I say here is like, yeah, sometimes it only makes changes to the code that you specifically asked instead of thinking about all the dependencies that also need to be updated. And this creates a lot of stupid mistakes that can Yeah, make debugging very time-consuming after the fact. I've had it before where I let the agent run all night and came back in the morning and it basically implemented a bunch of features that took me probably like a full day of work to, to fix because yeah, only did like half of the, the specs correctly. All right. Uh, bad solutions, taking shortcuts. So again, such an interesting one over here, but I've seen this many times where the agent will actually say like. It will basically create something that doesn't really solve the problem in the right way. Of course, you know, when we're building amazing applications, we don't want to take shortcuts in how we build things. We want our features to work correctly and give the users the best experience possible. So this is of course like a really important thing to be aware of that the AI can sometimes just find the shortest path to solve the problem. Even sometimes it will literally do a full 180 on what your goal was. So if I give it, I've seen it before, if I give it a really challenging prompt, sometimes it will just work on that prompt and then eventually be like, oh, you know, we can just undo everything that we've done and just go back to the previous solution. And I'm like, no, that's not what I asked. I want to implement the new solution. Yes. Like we have to do the hard thing of making the new solution work. So yeah. So that's happening. Um, doesn't look carefully, it lacks foresight. So another thing that happens quite often is while you're fixing things or making changes to your code, it might overlook places where it also needs to update the same thing. So for example, over here, I think this was an example where, yeah, like it basically started updating, you know, different parts of the, of the file, but there was multiple instances of the same kind of like declaration or code in the, in the file and it had to. If it actually just thought a little bit longer, longer term, it would have seen that, oh, if we updated it over here, we probably need to update it in these 3 other places that are also in the same file. Sometimes that just doesn't happen though. So you end up with like half working versions of the solution. And, uh, and then the last one is oftentimes just not in, not following your instructions at all before executing. So sometimes I will ask it to check the GitHub logs or to check a certain file before that it goes ahead with fixing something. And instead of doing that, it just tries to guess what it's supposed to do. And it just comes with an error and it says like, um, yeah, like it will try to implement things. And this is a perfect example. What I took the screenshot, you can see over here. I said, I asked it to check the GitHub logs and then it went, oh, perfect. Yeah. We, we created all of this, this stuff. And I said, you didn't even take my advice and look how we're doing the, the previous, um, you know, file. And it said, oh, you're absolutely right. I should look at how the chat streaming actually works. And then it said, holy shit, you're absolutely right. The chat streaming is so much simpler. So it wasted all these credits trying to build something when it was already built. And it could have literally just looked at the thing that I told it to. So yeah, I know there was a lot of different things that, that come up, but that's really the reality of coding with these AI agents is we have to be aware of the shortcomings because if you're trying to build like real applications, these things are going to shoot you in the foot. And that's where I see a lot of people getting stuck. So next, let's talk about how to mitigate these risks. All right. So first thing is I like to get the AI to actually think through latent space. So oftentimes, especially if you've been working on trying to solve something that has just not like, like just not been working, like the AI is just not able to figure it out. You've tried different models. You've tried different approaches. Sometimes the best thing you can do is to ask the agent and kind of guide it through the decision-making process. So you're essentially breaking the task down, cuz the way that I think about these, these agents is that they have the knowledge within them. If you can unlock it, they know how to build pretty much anything you wanna build. However, they might not know how to access that exact way that you want them to build it. So. What I like to do, and you can see this example over here, I actually say to it, um, can you, uh, can you, can you come up with 10, 10, uh, likely reasons why this is not working? And here you can see it said, uh, top 10 most likely reasons, and it comes up with a lot of different options here. So it's like file didn't deploy correctly, syntax errors, dependency issues, malfunctions, file encoding, TypeScript, Vercel building, and then after that. Now interestingly enough, it's like, oh, most likely culprits, deployment issue, compilation issue. And then it says, okay, let's check if there's obvious syntax differences. So what I've been doing, what I did over here is I got the agent to scan through its own possible, you know, the possible reasons why something might not be working. And by doing that, oftentimes the agent can start to logically see like, oh, this is probably the most likely reason. A lot of times also worth saying is that The reason it's not able to build what you want is because you don't understand how to give it the right prompt to actually build it. This is the thing with coding and it's, it's one of my favorite quotes in coding is that the only limit to what you can build in coding is how well you understand the problem. And that's what our role as AI developers is now becoming is how well can we understand what we are trying to build because the agents can build it. But they don't have that, that deeper level thinking. And that's what we need to get good at. All right. So that's latent space. Uh, next one is get good at committing to GitHub. I know this might seem like an obvious, an obvious thing to say to some people. It wasn't to me. I've been used to coding on Cursor and I've, you know, I've, I've, I haven't really had to get good at actually telling the agent like, hey, commit. The work that was done, but you learn very quickly once you're working with multiple agents that if you do not commit stuff, you will end up just wasting so much time because the agent will create something amazing and then break it. And then now you don't have a working version and you can't go back to it because you don't have the backups. So that being said, um, what I like to do is I'm always committing. So whenever I'm building something, as soon as that feature is working, I commit. I say, okay, amazing. Please commit this to GitHub. And then you can see over here, what you can do is you can use these logs. So if there is ever times where the AI breaks something, you can go back and say to it, hey, please can you search through the GitHub logs because we've already done this before when it was working. And then you can see Claude can actually go through and it can look at all of the previous, you know, commits that we have over here. And based on that, it's able to find the working solution again and then fix it. So it makes it much, much easier. Once you back up your work, then the next one, uh, break down your tasks neurotically. So, so this is something I need to speak much more about. I'll probably make even separate videos, but the only way to consistently and reliably ensure that you're going to get what you want from these AI agents is to be neurotic in how you break down and share with it what you want. Now, the cool thing is Claude can actually do this for you. So with the right prompting strategy, you can get it to create the spec sheets. And then your job is just to make sure that those spec sheets actually say and actually do the feature that you wanted to build. So for example, this is just a screenshot, but you can kind of see this is one of the specs, spec documents that I got the agent to create. And this is a very, very long document. But you can see the top part over here. It breaks down the architecture requirements. It looks at what exact features we want to build. It's talking about the existing patterns to follow. And it builds this, it builds a spec sheet by first looking through your whole codebase and planning. So using Claude plan, Claude Code planning mode is very key over here. Using the MCP Gemini 2.5 Pro that I shared in another video, really powerful to create these spec sheets. All right, then root cause analysis documentation. So this is another technique that I have started playing around with, and I see a lot of potential with this, especially as I'm starting to get much more, a much bigger application that I'm building. So documenting the root cause analysis, it kind of looks similar to what we've got over here. The idea is that whenever the agent gets stuck and then you're able to solve it, you can get Claude to actually, you can prompt it and maybe even put in the ClaudeMD file to tell it to go and document firstly, what was the problem? How did it, like, what was, what was the reason it got stuck? And then how was it able to find the working solution and break that down in plain English. And I think this is slightly different than GitHub, like committing Git, because Git obviously is the code, like the specific code that made it work. But sometimes just explaining it in plain English allows you to go back to it. So what I'm gonna start doing in my coding is I'm gonna get the agent to create files. Each file will be a written analysis of a feature that we built, and it kind of goes through the story of, you know, what didn't work and how did we get that feature to actually work correctly, right? So documenting that, and then the next one, and actually the last one over here is just don't accept solutions at face value. So, you know, I've been coding for a long time now, 10 years, and obviously AI has only been a relatively new development. So oftentimes like that is kind of a benefit is that I'm able to see what it's doing. And I'm able to course correct when I start to notice that the logic is wrong or it doesn't make sense what it's doing. Ultimately, there is so many ways that you can improve at this. If you look at the SOLID framework, like SOLID principles, creating like single responsibility, there's a lot of these principles that you can look up, like just do a Google search on SOLID methodology. This is stuff that is core programming fundamental knowledge that you will definitely need to learn if you wanna get good at coding. Coding with AI Agents. And, um, yeah, like you can see over here, uh, again, I just showed the same picture where it created this and then I told it like, I'm not happy with this. Like you didn't even take my advice. Look at the previous, uh, solution and it was able to go back and eventually get the correct answer. So that pretty much covers it for today's video. So that is how you can escape the VibeCoding death spiral. And, uh, yeah, I hope that you found this valuable. I hope that this was new information and something that you can learn from. And I really enjoyed creating these tips. I've got a ton more stuff that I want to make videos about. Of course, I just want to— like, I'm going through them as fast as I can. But thanks so much for watching this video. If you like this video, please go ahead and click the like button and subscribe, and I will see you in the next one.










