I was having a drink with a friend last weekend and the topic turned to AI - particularly about why so much AI-generated code is just slop.
Does it work? Sure (well, most of the time). But it’s hard to understand, hard to maintain, and often not written in a way that’s easy to test. You take one look at it and know you’re going to be paying for it later.
We aren’t really talking about prompts or model quality. The problem is more fundamental than that. LLMs are extremely good at producing output, and extremely eager to do so. When you ask for code, they start writing immediately, and all the thinking that should have happened beforehand gets mixed in with the implementation.
That’s where the slop comes from.
You are letting design decisions get made implicitly. Assumptions sneak in without being named. Early guesses harden into structure before you’ve had a chance to question them. By the time you’re reading the code, you’re reacting to a finished artifact instead of shaping a solution.
What consistently avoids this, in my experience, is forcing a planning step that most people skip entirely.
Before any code gets written, I have the model produce a plan as a Markdown file. It’s a real document I can read and edit, and I treat it like a small design doc. It lays out how the model understands the problem, what constraints it’s assuming, what’s out of scope, and the general approach it plans to take.
Then I edit it.
I remove things that feel like overengineering. I add constraints the model couldn’t have known. I fix misunderstandings while they’re still cheap to fix. Only once that document looks right do I ask the model to write code that implements it.
That separation matters more than it sounds. Without a plan, the model is designing and coding at the same time, and you end up reviewing a big block of code that already bakes in questionable decisions. With a plan, there’s something concrete to react to before the code exists.
This is exactly the same as when you are working with other engineers. You wouldn’t skip the design phase on anything non-trivial and jump straight to implementation, and you shouldn’t expect better results just because the person writing the code happens to be an LLM.
If you let the model design and implement at the same time, you end up with code that’s hard to reason about, hard to test, and painful to maintain. Writing the plan first is how you slow things down just enough to get something intentional instead of slop.
If you want less AI slop in your codebase, be less sloppy with your engineering practices. Always write the plan.