# AI writes bad code? Describe how it should behave

Published 30 June 2026

[Originally posted on LinkedIn](https://www.linkedin.com/feed/update/urn:li:activity:7477683742380134400/)

![Cartoon of a developer drowning in a sea of waves made of prompt fragments such as "must be fault tolerant", "optimize this SQL" and "debug this infinite loop".](https://ovchyn.me/api/media/file/ai-writes-bad-code-describe-how-it-should-behave-1.jpg?prefix=production)

AI writes bad code? You just can't describe how it should behave. 🙃

For seventy years we were drowning in a sea of unstructured code, and slowly we learned to structure it, so that it becomes predictable, maintainable, and behaves the way we want.

Now that AI writes 10K lines of code a day, what we're up against has drifted to "how to explain to AI what this code should do." So **instead of a sea of unstructured code, we're falling into a sea of unstructured prompts**, and over the next few years, we're simply forced to learn to structure it too. 🌊

The main gap is that **we never learned to describe HOW a system should work**. Gherkin was built exactly for this, to describe behaviour, and somehow we never learned to use it properly.

Maps are a good way to see it.

Code always described the path: walk 3 km up, 2 km left, dig there and you'll hit the treasure. 🗺️ Dropping a pin so everyone knows where to arrive is something we never managed in software.

From what I've researched, no single product fixes this, and we'll probably spend next years just learning to find the tools that structure this new ocean. My TrueBDD is *one of them, probably*: an open-source CLI where the behavioral spec becomes the source of truth and the code turns into an artifact you regenerate from it. A first step in this direction rather than the answer. 🤖

It's not the AI writing bad code, it's on us to explain to it how the system should actually behave.
