Skip to main content
Technical Enough

Work with your AI coding tool and get unstuck

Chapter 2 of 7 in Build Your Website or Mobile App · 19 min

You start building the first version by asking the agent for three things in one message: a Join page, a new menu for the whole site, and the RSVP form moved to a new members' page. The agent changes eleven files and reports that all three are done. You open the site, and the RSVP page shows an error message where the list of runners used to be. You type "the RSVP page is broken, fix it." The agent changes four more files, and now the RSVP page opens but the Trails page is blank. An hour and six requests later, three pages are broken, and you cannot say which request broke which page.

The agent did not get worse during that hour. You asked for several changes at once and did not check any of them before asking for more, so each new request was added on top of a mistake you had not seen yet. In this chapter you learn a routine for working with the agent: ask for one change, check it, and save it. You also learn what to do with an error message, and when to stop asking for fixes and go back to a version that worked.

Ask for one change at a time

One change is something small enough that you can check it in about a minute by looking at the site. "Add a Join page" is one change. "Add a Join page, redo the menu, and move the RSVP form" is three changes.

A request the agent can act on has these parts:

  • What you want. "Add a Join page with a heading and one paragraph about the club."
  • Where it goes. "Put it at /join, and add a Join link to the menu."
  • What must not change. "Do not change any other page."

Always include the last part. An agent often edits files you never mentioned on the way to the result you asked for, and that sentence tells it which files to leave alone.

Sometimes a change depends on something the site has never used before, such as a sign-in service or a payment company. Ask for a test before the change: "Before you build the page, show me the smallest test that proves the sign-in service works from this project." The Playbook section The verify-first rule explains why this saves time.

Check each change, then make a save point

After the agent reports that a change is done, do these things before you ask for anything else:

  1. Open the page you asked for. Check that it does what you asked.
  2. Click through every other page. On a small site this takes a minute, and it is how you find a Trails page that went blank.
  3. Ask what changed. Type "Show me what changed since the save point." The agent lists the files it changed. If the list includes a file you did not expect, ask the agent why it changed that file before you go on.
  4. Make a save point. Type "Make a save point; call it 'join page added'." A save point is a snapshot of every file in the project that you can go back to, and Git: the undo that makes AI edits safe covers how it works.

The top row of the drawing is the routine. The two boxes under it are for the times something breaks, and the next two sections explain them.

Ask the agent for one change, check that the whole site still works, and make a save point before you ask for the next change. When a page breaks, you then know which change broke it, and you have a save point from just before that change.

What to do with an error message

An error message is the text a program prints when it cannot do what it was asked to do. It says what went wrong and, most of the time, where. You find error messages in three places: on the page in your browser, in the window where the agent is running the site, and in the host's log once the site is online, which you used in Environments: why it works on your machine and breaks online.

This is the error message from the RSVP page:

TypeError: Cannot read properties of undefined (reading 'map')
    at RsvpPage (app/rsvp/page.js:12)

You do not need to understand every word of an error message to use it. Do these things with it, in this order:

  1. Copy the whole message exactly. Do not retype it or describe it from memory. The agent needs the exact words and the line number.
  2. Say what you did and what you expected. For example: "I opened the RSVP page and expected the list of runners. I got this error." Then paste the message.
  3. Ask what it means before you ask for a fix. Type "Explain this error in plain words and tell me what you think caused it. Do not change anything yet." If you can follow the explanation, you can judge whether the fix that comes next makes sense.
  4. Ask for one fix, then check again. Go through the pages the same way you did after the original change.

When the same fix fails twice, go back to the save point

A session is one conversation with the agent, from the moment you open it until you close it or start a new one. The agent works from everything that has been said in the session so far, including every attempt that failed.

If you have asked for the same fix twice and the page is still broken, stop asking. Each failed attempt changes more files in the project, and it also stays in the session, where the next attempt is built on it. A third request in the same session usually gets you another version of the same mistake. Do this instead:

  1. Go back. Type "Put the project back to the save point 'join page added'." The site is now as it was the last time it worked.
  2. Start a new session. Close the conversation and open a new one, so that the failed attempts are no longer part of what the agent is working from.
  3. Write down what the failed attempts missed. For the RSVP page it was one fact: "The RSVP page reads its list of runners from data/club.json. Do not change that file or the way the page reads it."
  4. Ask again, in a smaller step. Put that fact first, then ask for one change.

The Playbook sections The iteration loop and The kill rule say more about this routine and about deciding when to stop.

When the same fix has failed twice, go back to the last save point and start a new session. A third request in the same session rarely works, because the failed attempts are still part of what the agent is working from.

The obvious objection: checking after every change is slow

Checking one change takes about a minute. You look at one page, click through the others, and read a short list of file names. In the opening scene, skipping those checks cost you an hour, and at the end of the hour you still did not know what was wrong.

You also do not need to read code to do this check. You look at pages and at file names, and you could already do both before this chapter.

What happened when an AI coding tool's steps were not checked

In July 2025 a user asked Gemini CLI, an AI coding tool made by Google, to rename a folder on their computer and move the files in it to a new folder. The tool ran a command to create the new folder and wrote, "Great, the new directory is created." The folder had not been created. The tool then ran a command to move every file into the folder that did not exist, and it reported that the files had been moved. The user then reported that the new folder was missing, and the original folder was empty. The tool searched for the files, could not find them, and wrote, "I have lost your data."

The user posted the whole conversation with their bug report. It shows no step, between creating the folder and moving the files, that checked whether the new folder was there.

The same thing can happen in your project on a smaller scale. The agent reports that a step worked when it did not, and then it builds the next step on top of it. You catch this by checking after every change. You limit the damage by making a save point before every session and pushing it to GitHub, so that a copy of the project exists in a place where the agent is not working.

What you can do now

You can ask the agent for one change in three parts, check the change by looking at the site and at the list of files that changed, and save it. When a page breaks, you can copy the error message, ask what it means, and allow one fix. When the same fix fails twice, you can go back to the last save point and ask again in a new session.

Try it now

This drill takes about fifteen minutes. It costs nothing on the first path and a few cents of usage on the second.

No setup: Open the AI chat you already use and paste the two lines of the RSVP error from this chapter, with this request: "Explain this error in plain words: what kind of error it is, what went wrong, and which file and line to look at. Do not suggest a fix." Compare the answer with the three parts in the drawing. Then write one request for a small change to any site you use, in three parts: what you want, where it goes, and what must not change.

With your tools: Open Claude Code in the running-club folder, or in your own project, and type: "Make a save point; call it 'before join page'." Then ask for one change: "Add a Join page at /join with a heading and one paragraph about the club, and add a Join link to the menu. Do not change any other page." When the agent says it is done, open the site and click through every page. Type "Show me what changed since the save point," and if the list includes a file you did not expect, ask why. Then type "Make a save point; call it 'join page added'." Codex and Cursor accept the same requests in their chat panels. If nothing is installed yet, The Setup Clinic covers the install.

Either way, finish by adding these lines to the idea file.

For every change: ask for one change, check every page,
                  read the list of changed files, save point
When a page breaks: paste the exact error, ask what it means,
                  allow one fix
Same fix fails twice: back to the save point, new session,
                  ask again in a smaller step

Chapter Summary

  • Ask the agent for one change at a time. One change is something you can check in about a minute by looking at the site.
  • A request has three parts: what you want, where it goes, and what must not change.
  • After every change, open the page you asked for, click through every other page, ask the agent to list the files it changed, and make a save point.
  • An error message is the text a program prints when it cannot do what it was asked. It says what went wrong and, most of the time, the file and the line where it happened.
  • When you get an error, copy it exactly, tell the agent what you did and what you expected, and ask what the error means before you ask for a fix.
  • A session is one conversation with the agent, and every failed attempt stays in it. When the same fix has failed twice, go back to the last save point and start a new session.
  • In July 2025 Gemini CLI reported that it had created a folder when it had not, moved a user's files into it, and could not find them afterward. The conversation shows no check between the two steps.
  • An agent's report on its own work can be wrong, so check what it did yourself.
  • Your artifact is the idea file, which now has your routine for every change and what you do when a page breaks.
  • The next chapter is Make your site look right on a phone and a computer, where you decide how the pages should look and check them at the width of a phone.

Sources

  • Bug report "Gemini CLI 'lost' files during a failed file move operation", issue 4586 in the google-gemini/gemini-cli repository on GitHub, opened July 21, 2025, with the full conversation attached (last verified November 2026).