Spark
Vibe coding: from idea to production

Reading and debugging the agent’s code

Topic 306 min read + 30 min for the taskRevised October 9, 2026

The agent from the “Vibe coding: websites” and “Vibe coding: interfaces” topics writes code fast, but not flawlessly. Sooner or later something breaks: the page won’t open, a button does nothing, red error text shows up instead of the interface. You don’t need to fix it by hand. What you need is to stay calm, understand what’s going on and describe the problem to the agent well. You definitely won’t have to delete the whole project and start over at the first error.

You don’t have to understand code to have an opinion about it

Looking at a few hundred lines of unfamiliar code is stressful if you expect yourself to understand every line. You don’t have to. Recognizing shape and scale matters more than reading the details. A 30-line file is most likely one small component. A 900-line file is doing too many things at once. That’s a reason to ask the agent “should we split this file into a few smaller ones?”, even without reading it line by line. It also helps to roughly recognize words you know from the “Web app technical foundations” topic: useState, fetch, SELECT * FROM. You don’t need to write them yourself. It’s enough to know roughly: “this is about screen state”, “this is about a request to the server”, “this is about the database”. That’s enough to have a meaningful conversation with the agent about what it just did.

How to read the browser when something breaks

When something breaks in a vibe-coded project open in the browser, your first source of truth is the browser’s developer tools (DevTools), not the agent. Open them with a right-click on the page → “Inspect”, or with F12 (⌘⌥I on a Mac). The Console tab shows technical errors as text (usually red). You don’t need to decode them yourself. Copy the whole text and give it to the agent with “here’s an error from the browser console, explain what went wrong and fix it”. The Network tab shows every request the page sends to the server. It helps when something “keeps spinning and never loads”: you can see exactly which request hung or returned an error.

A Chrome DevTools window with the Elements, Console, Sources and Network tabs. The Console is open: regular log lines and two red errors — a 404 while loading a file and an Uncaught TypeError with a link to a line of code
The Console tab: red lines are errors. On the right, each one links to the file and line where it happened. Copy exactly these lines, in full, to the agent. · Chrome DevTools · screenshot: Chrome for Developers, CC BY 4.0

How the agent recovers from a bad edit

Sometimes an edit makes things worse instead of better: it used to work, and now it doesn’t. Terminal agents (the “CLI and terminal AI agents” topic) work through git, and that gives you a clear way back:

  • Undo the last edit. Ask the agent to undo the last change and go back to the working version: “undo the last commit, get the project back to a working state”. This is called a rollback, a return to an earlier state.
  • Step by step. If it’s unclear which of several recent edits broke things, ask the agent to isolate the problem: “take the project back to before the last three changes and apply them one at a time, checking after each one that nothing broke”. That way you find the problem by narrowing it down, not by guessing.
  • /rewind and similar commands. Some terminal agents have a separate built-in command for rewinding the session state (for example, /rewind in Claude Code). It brings back not only the code but the conversation itself to an earlier point. This can be faster than dealing with git by hand. Check the exact command name in the tool’s documentation: it’s one of those details that change from version to version.

How to catch bugs before the user does

Everything above in this topic is a reaction to something that has already broken. But it’s more useful to build a habit of hunting for bugs on purpose, before a real user or client does. You don’t need to program for this. It’s enough to systematically “try to break” the interface and tell the agent what went wrong:

  • Edge-case and weird input. An empty field where text is expected. Text far too long where the layout expects something short. Special characters and emoji in the name field. Pasting formatted text from Word instead of plain text.
  • Fast repeated actions. Double-clicking the form’s submit button, quickly flipping “back and forward” in the browser, refreshing the page in the middle of loading.
  • Unusual screen states. A very narrow browser window, a very long list of data, a completely empty list (the empty state). These screens often get forgotten at the design stage.

You don’t have to run all this by hand. You can hand it to the agent:

Go through this sign-up form and try to break it: empty fields, text that's too long, special characters, double-clicking the submit button, a slow internet connection. Describe what went wrong and fix what you find

If it’s still unclear after the agent explains: ask a different model

Sometimes the same agent that wrote the code can’t clearly explain what went wrong. It circles around the same wrong explanation or keeps fixing the wrong spot. You don’t have to stick with one model to the end. Copy the code, the error text and the question “what’s wrong here and how do I fix it” into a different model. For example, if you’re stuck with Claude Code, ask the same question in ChatGPT or Gemini. This often gets you an answer faster than continuing to talk to a model that has already hit a dead end with its explanation. It works beyond code, too. The same principle applies to a confusing result of any kind: an image, a piece of text, a brief (more on cross-checking results between models in the “Evaluating and critiquing AI output” topic).

Review is a habit, not a formality

Even when the agent says “done, everything works”, that’s not yet a reason to take the result straight to the client. The agent can sincerely be wrong about what “works”: tests may have passed on crooked logic, not because everything is right. A useful habit: after every big change, ask the agent to briefly list what exactly it changed and why. And click through the interface yourself before you call the task closed. More on evaluating results systematically in the “Evaluating and critiquing AI output” topic.

Command examples for practice

Where to pasteThe agent you built the project in (web or terminal)
Here’s the error text from the browser console (paste it) — explain in plain words what happened and fix it
After the last edit, the page stopped opening — take the project back to the previous working state

The agent can only roll back if there’s something to roll back to: git history or /rewind in Claude Code. Web builders have a version history button for this.

Split this file (paste the path/name) into a few smaller ones — it’s too big to find your way around easily
Look at git log -3 -p and briefly list what changed in the last three edits, in plain words, without technical jargon

In a new session the agent doesn’t remember past edits, so it relies on git history.

Where to pasteA different model — not the one that wrote the code
Here’s the code and the error text (paste them) — another model couldn’t explain it or somehow couldn’t fix it. Take a fresh look and tell me what’s actually wrong here
Mini-task

In any of your vibe-coded projects, ask the agent to break something small on purpose (for example, remove a component import). Open DevTools and find the error in the console yourself before showing it to the agent. Then ask it to roll back the change and compare with what you found.

Time: 30 minutes
Done when: you found the error line in the Console yourself before showing it to the agent, and the project is back in working order

Sources

  1. Open Chrome DevToolsdeveloper.chrome.com

    keyboard shortcuts for opening DevTools on Windows and Mac

  2. Checkpointingcode.claude.com

    /rewind rolls back both the code and the conversation

Found a mistake or an outdated fact? Write to hey@iskra.guide