The Five Stages of Coding with AI

The Five Stages of Coding with AI - 2026-11-13


I recently created a meme for LinkedIn called The Five Stages of Coding with AI.

The Five Stages of Coding with AI Meme

It was not particularly well received, but it was certainly based on my own experience, so I thought I would give it some substance by walking through the writing of Rons Markdown Edit.

Background

The experiences in this article came from building a new product, Rons Markdown Edit. But why create yet another Markdown editor, when there were already so many?

In a nutshell, it boiled down to:

  1. The existing editors never quite hit the spot. Either they were too heavy, and far too keen to pack in features that had nothing to do with Markdown, or they were too light and did nothing more than add a preview to a text editor.
  2. We already had a lot of the framework and support code available to use.
  3. And yes, if I am totally honest, I had a great new toy to play with, called AI, which I had recently been experimenting with, and I had great hopes for it.

That leads neatly into the five stages.

Stage 1 - Awe

Before I even thought about building a real product, I did build a blog as an experiment, back end and all. I used an AI agent, defined how I wanted it structured, and iterated through the Agents.md file until I had effectively vibe-coded a well-structured blog engine.

It had a front end, a middle business-logic layer, and a database back end, all working nicely on .NET 10. It could edit and display articles, and it supported tagging. That is about as far as I took it. The world does not actually need another blog engine, right? (If you do, drop me a message.)

The experience was not entirely smooth, and I had to fight a bit with the MinBot (minion robot) to get the blog where I wanted it, but I was basically stunned at the results: nicely structured, clean code, and, well, y'know, actually working.

Unknown to me at the time, that little project was way too simple. Pain would follow.

Stage 2 - Power

From the blog experience, I felt empowered to tackle something much more ambitious.

We do much of our blogging, communication, and notes in Markdown here at Rons Place Software. I was putting the finishing touches to another of our products, Rons Data Merge, which we use for sending out customer mailings (among other things). That was when I realised we already had a large chunk of the code needed for a Markdown editor.

I was using another editor at the time, and it was beginning to get on my nerves, so I decided to dive in.

Creating the structure of the application was relatively simple, because that code already existed. I told the MinBot to create an empty application by replicating the structure of another product, but skipping the application-specific code. It was really good at that, and remains so.

I carried on and told the MinBot to:

  • Create a Markdown parser, and a matching HTML renderer.
  • Add the text editor and HTML preview.
  • Build out the basic editing commands.

I had a working application, if not a complete one, with editing, syntax highlighting, and preview. All of this was happening at breakneck speed, and I was in a little developer heaven, thinking of all the donkey work I was so happily delegating to the MinBot.

Stage 3 - Horror

At some point, though, I needed to take a closer look at the code.

I noticed something was not right with the syntax highlighting in the text editor. The highlighter was having trouble with a line like this, because it treated * as both a begin and an end token and got confused:

**Bold text with some *italic* inside it**

I understood the problem, and decided to take a different approach: apply the highlighting from the output map of the parsed Markdown. After all, I had a nice clean Markdown parser, right?

When I looked at the code that had been generated, I was shocked. It was a rat's nest of helper functions, embedded conditions, and layers of over-complicated code. Blocks of code like this were everywhere:

if(token == '#' || token == '-')
{
	// Something
}
else
{
	_skipNext = true;
}

The code was spread across the back-end libraries — where it belonged, though it was not organised in any sensible way — and peppered all over the front end, in whatever place looked most convenient at the time.

The structure was no better. That breezy instruction I gave, to skip the application-specific code, had been taken far more literally than I meant. Whole branches of code that existed in the application I had based the Markdown editor on, and that I had assumed were still there, were simply gone. Every instruction since had been aimed at a codebase that existed mainly in my head.

The project could not continue like this. Even if I managed to drag it over the finish line, the code would be so horrible that even the MinBot would not be able to maintain it.

I have read various articles about humans being made redundant in the coding process, in the not-too-distant future, but I don't see it. In this case, the wonders of AI were consistently re-applied to the wonders of AI, and that was NOT heading to a good place. Now, I had made some mistakes, admittedly, but not enough to explain this.

Stage 4 - Realisation

At this point I had to take a serious step back. A few beers and a brisk walk were involved, not necessarily at the same time, whilst I digested what I was looking at and had a bit of a think.

Some clear mistakes began to materialise:

  • I was not giving the MinBot explicit enough instructions, either in the Agents.md file or in the prompts, which left it free to make decisions. Those decisions were not always good, and they were not always consistent.
  • The MinBot was not good at iterative development, so:
    • Changes were not made systemically. They were applied only to the immediate context, which fragmented the code.
    • Earlier problems with structure, and existing bugs, were compounded. Rather than fix an issue at the core, or alter the existing code so it worked better, the MinBot layered every new request on top of what had come before.

My Outsourcing Theory

Now, I have engaged with outsourcing teams on many occasions in my illustrious career, and as I pondered the MinBot, I began to see some parallels.

  • Good at boilerplate. Outsourcing teams are good at boilerplate work, such as forms or APIs that have a defined structure and, quite often, design patterns or standards already established for them. With a drawing of a screen, or an outline of a data schema, the plumbing and the modelling fall out of the design process quite easily.
  • Bad at specific business knowledge. Getting business knowledge into an outsourced team has always been painful. In the end, the effort of conveying the intent well enough to get the required result is almost as much work as writing it myself.
  • Variable at bug fixing. Outsource teams are paid by the hour, and bug fixing usually falls inside their budget, not the customer's, so it is often treated as work that must be done, but as fast as possible and with the minimum of resources. It is also often handed to juniors, who are paid less. The result is often the minimum required to achieve the goal.
  • Variable at adding features. When features are added, time has often passed, and you may be dealing with a new team inside the outsourcing company. Because understanding an established codebase takes real effort, new features are often grafted on rather than implemented properly.

In many ways, this matched what I had found:

  • Good at boilerplate. The MinBot is great at boilerplate plumbing, especially when it has an example.
  • Bad at specific business knowledge. Features specific to the application need very careful definition. The MinBot also has a vast amount of prior knowledge to draw on, from its training data, so the gap is often hidden. Things can progress smoothly and then, suddenly, the MinBot falls flat on its face because it has hit a scenario not previously seen in its training data. The worst part is that the failure can be buried somewhere inside a large change.
  • Variable at bug fixing. Blindly telling the MinBot to fix bugs often produces a local fix, without looking at the underlying cause. If it is told to do a deep dive, though, it can get over-enthusiastic and shore up every layer of the code between the fix and the place the bug showed up.
  • Variable at adding features. As with bug fixing, the MinBot needs to be told how the new feature fits into the codebase.

Tests

Then there are tests. In the past I have not always been as obsessive about unit tests as some of my colleagues, but I have always used them to best advantage, by weighing the time spent writing them against the results they actually deliver. Basically, writing unit tests is not a development goal, whereas creating good, reliable code is.

With an outsourcing team, tests are what keep the arrangement honest. You run them so a change can be checked for regressions, etcetera and so forth. There is no point beating that drum again.

With the MinBot, that barely begins to cover it. The best way to illustrate is by example.

The MinBot had made an absolute dog's dinner of the Markdown parsing and processing. It was by far the most spectacular failure in the work I had done with it so far. Ironically, it worked . . . mostly . . . but every addition to the functionality was just another spade of dung on the dung heap.

Markdown parsing is not as trivial as it first appears, but what I wanted was something like this pipeline:

Markdown (text)
  |
Parser
  |
Token stream
  |
HTML Translator
  |
HTML Formatter
  |
HTML (text)

Now, plenty of examples and tests already exist for Markdown processing in the wild and can be harnessed. Most of these are end-to-end tests, i.e. Markdown-to-HTML tests, so we already had tests from the first step to the last step. We also needed tests for every stage, and multi-stage tests, including round-trip tests.

Once those tests existed, I could refactor and, to a certain extent, redesign the Markdown processing in Rons Markdown Edit in one or two exchanges with the MinBot. Performance went up, and the code got smaller.

The realisation point was this: the tests were part of the design for the MinBot. My previous stance on the pragmatic application of tests was totally irrelevant now. Tests were as important as good MinBot instructions, and in some cases more so.

Stage 5 - Resignation

At times, understanding how the MinBot works — what it is good at, and what it is bad at — starts looking more like psychology than programming.

The mistakes I made throughout the development of Rons Markdown Edit largely came down to communication. More specifically, there was a gap between my understanding of the codebase, my sense of what the MinBot was capable of, and the reality.

And yes (sigh), my days of hacking out code are now largely replaced by hacking out MinBot instructions.

It can still be used to great effect. After all, most software is 5% core logic and 95% plumbing.

In practice, I distilled the whole experience (so far) down to a few guidelines:

  • When talking to the MinBot, directly or through an Agents.md file, ask it whether it understands, and get it to rewrite your rules in a way that it understands.
  • Tell it exactly how you want the application structured.
  • Expand on any specific area of domain knowledge.
  • Add tests at every possible opportunity. Get the MinBot to do it, but check carefully. Those tests will direct future output as much as any instruction.
  • Try to keep domain knowledge out of the prompts and in the core instruction files.
  • Iterative programming is natural to us, but it seems to confuse the MinBot. Get it to review its own code regularly, and to reapply the instructions already established.
  • Tell it to make bug fixes that are systemic, but still minimal.

Wrapping Up

Well, it was a journey.

The MinBot is fantastic at producing good-quality, functional code, removing hours of laborious donkey work from my day, and generally making my life easier. It can undertake huge refactors, clean up redundant code, and turn tasks that would take hours into minutes. It can even review this article for obvious mistakes ;-)

HOWEVER . . .

. . . without solid direction from someone who has a strong idea of how to architect the final product, the MinBot will produce a huge pile of dung.

At some point that might change, but right now the role of architect seems to be more important than ever.

What I have not touched on is code exploration and experimentation. That is a whole other story.