Programming with AI
ENRU
1.2

The working cycle

task → description → generation → reading → checking → iteration

What it is

The working cycle is the order of steps in which a task turns into working code. Six steps, repeated until the result is good enough.

The cycle is worth knowing by heart, because almost every problem with an AI is a skipped step rather than a bad model. Each chapter of this book takes one of the steps apart in detail, and we will keep coming back to this list.

The six steps

Diagram from the book — to be redrawn for the web
The working cycle. Blue is what you do, amber is the AI. Four of the six steps are yours, and generation is the shortest of them.
#StepWhat comes out
1Taskan understanding of what the result should be
2Descriptiona prompt or a mini-spec
3Generationcode
4Readingan understanding of what it wrote
5Checkinga run, a test, an answer: works or not
6Iterationthe next prompt, or a finished feature

A common misconception is that working with an AI means step 2 and step 3. In reality it is steps 1, 2, 4 and 5 — and generation is the shortest and easiest part.

What to look for

The main mistake looks like this: got the code → didn't understand it → ran it → doesn't work → "doesn't work, fix it" → got the code → didn't understand it → ran it…

This is the no-reading loop. It feels like work, because something keeps happening, but no lap adds any understanding. Five laps in, you have a project you don't know and a bug nobody can find.

The only way out of the loop is step 4. You don't have to read every line — it's enough to understand what the code does and where. But the step cannot be skipped.

What to tell the AI

Each step has its own kind of prompt. These are not separate tricks — they are one cycle, broken into turns.

Prompt
Step 2, description:
Add a /weather command to bot.py. It takes a city name,
requests the weather from api.openweathermap.org and replies
with one line: temperature and conditions. Take the key from
the OWM_API_KEY environment variable. If the city is not
found, reply "City not found".
Prompt
Step 4, reading:
Explain line by line what the function you added does.
Separately, tell me what happens if the API returns an error.
Prompt
Step 5, checking:
Which three cases should I check by hand to be sure
the command works correctly?

The third prompt is underrated. The AI knows perfectly well where its own code is fragile — you only have to ask.

Cheat sheet

  • Six steps: task → description → generation → reading → checking → iteration.

  • Four of the six are yours. Generation is the easiest part.

  • The no-reading loop is the main way to lose control of a project.

  • Can't explain the code in two sentences — don't keep it.