Sitemap

How to stop Replit Agent and Lovable from “fixing” the wrong thing (3 copy-paste prompts)

3 min read4 days ago

--

Note: I wrote this with help from an AI assistant, and I reviewed and edited it before publishing. The prompts come from my own prompt library, Prompts That Ship.

When an AI coding agent breaks something, the expensive habit is typing “still broken, try again.” Each retry is a fresh charge for the same failure, and the model often treats a symptom while quietly rewriting three other files. The cheaper habit is structural: diagnose first, lock what already works, and change one class of problem at a time.

Here are three copy-paste prompts that turn a flailing fix loop into a short, reviewable pass.

Why “try again” makes it worse

These models fill gaps. A vague bug report leaves gaps. The agent invents a cause, invents a fix, and invents side effects. If you then say “still broken,” it invents again — usually from the same incomplete picture.

Get PocketStudio’s stories in your inbox

Join Medium for free to get updates from this writer.

A good bug report removes the gaps. A checkpoint gives you a 60-second undo. Separating cosmetic fixes from structural ones stops the model from doing one well and botching the other in the same message.

Prompt 1: Diagnose before any fix

Paste the full error. Not a paraphrase. Not “some auth error.” Then force a diagnosis before code.

There is a bug. Diagnose the root cause before proposing any fix.

EXPECTED BEHAVIOR:
[what should happen — specifically]

ACTUAL BEHAVIOR:
[what happens instead — specifically]

ERROR TEXT (copy-paste complete, no paraphrasing):
[full error message + stack trace]
WHAT CHANGED:
The last modification before this bug: [describe the change]
Files modified: [list file paths]

INSTRUCTIONS:
1. Read the error and the relevant source files
2. Trace the error back to a root cause — do not treat the symptom
3. Report your diagnosis before writing any fix
4. Only after I confirm, propose the minimal fix

DO NOT refactor unrelated code. DO NOT install new packages.

On Lovable, run the diagnosis pass in Plan mode so it cannot touch code while it thinks. On Replit, paste this before any repair prompt.

Prompt 2: One change class per message

Cosmetic and structural feedback mixed together is how a spacing fix becomes a data-layer rewrite. Batch the small stuff. Do structural changes one at a time. If the whole approach is wrong, roll back and regenerate — do not “refine” a bad plan.

Original goal: [one sentence]
Locked constraints (DO NOT modify): [file list + behaviours that must stay]
Change class for THIS prompt: MINOR | STRUCTURAL | DIRECTIVE
(If DIRECTIVE: stop. I will roll back and regenerate instead.)
Specific change:
[one batch of cosmetic items, OR one structural change with current vs desired]
After the change: re-check the locked constraints and list anything you noticed outside scope without touching it.

MINOR means cosmetic only. STRUCTURAL means one careful change. DIRECTIVE means the approach is wrong — regenerate, do not patch.

Prompt 3: Checkpoint, then smoke-test before you call it done

A rollback that takes a minute beats an hour of “almost fixed.” Snapshot before anything risky, then verify the journeys that matter before you trust the build.

Before we call this done, run this verification. Do not add features.

BUILD:
- Production / publish build completes with no errors
- No new console warnings from our change

SMOKE TESTS (exact journeys):
1. [Primary journey, e.g. open app → do main action → see result]
2. [Error journey, e.g. submit invalid input → see validation]
ROLLBACK PLAN:
- If any smoke test fails, rollback to: [checkpoint / commit]
- Last known good state: [checkpoint / commit]

Reply with a checkbox-style report. DO NOT proceed past a failed box.

On Replit, use a checkpoint or commit before the risky step. On Lovable, use version history the same way. Name the recovery point in the prompt so the agent cannot “helpfully” keep going after a failed smoke test.

The habit that makes this stick

Two failed fixes means stop. Roll back. Paste the full error. One diagnosis. One minimal fix. If you cannot say what changed last and what “done” looks like in one journey, you are not ready to ask the agent to fix anything yet.

About these prompts: I am PocketStudio, and I sell Prompts That Ship, a PDF of 45 copy-paste prompts for building with AI coding agents. The three prompts above are trimmed from it and work fine on their own. There is a free sample chapter on stopping agents from making things up:

Free Chapter 7 sample (no signup): https://drive.google.com/file/d/1Jb_lScEURiCSr8CKW5GPb3CxDjd-2lRR/view

The full pack is here: https://prompts-that-ship.pocket-studi-6520.chatgpt.site

--

--