WZ VaultPrompts › Building

The prompt that stops an AI agent touching everything

How do you stop an AI coding agent from refactoring or changing files you did not ask it to?

Last checked 2026-09-22

Name the file, forbid everything else, and give it somewhere to put its opinions. The failure mode of a capable agent is doing too much — it edits a shared component while fixing one screen and quietly breaks three others. One sentence with an escape hatch prevents almost all of it.

The prompt

Change only [file]. Do not refactor, rename or reformat anything. If you think something else needs changing, tell me instead of doing it.

When to use itEvery edit to something that already works. Especially when the file is shared by several screens.
Why it is worded that wayThe three forbidden verbs are not decoration: refactor, rename and reformat are the three things an agent does uninvited, and each one produces a diff too large to review, which means you stop reviewing. The last clause is what makes the rule survive — without somewhere to put its suggestion, an agent that spots a genuine problem will either act on it or stay quiet. You want the third option: told, not done.

Why the escape hatch matters more than the ban

A rule that only forbids turns a useful observation into silence. "Tell me instead of doing it" keeps the agent's judgement available to you while removing its permission to act. In practice this is where you find out about the actual problem — the one it noticed on the way to the thing you asked for.

The companion prompt, for anything shared

Before touching navigation, layout, login or data, ask first: "Before you change anything, tell me what else in the app depends on this and might break." One extra message turns a blind edit into an informed one.

Where this belongs

In your project rules, not in every message. An agent that inherits "change only what I name" at the start of every session costs you nothing per prompt. Typing it each time costs you a line of attention you could spend on the actual work.

How you know it worked

The diff is small enough to read in full. That is the whole test. If you find yourself scrolling a diff for a one-line change, the rule did not land and the next prompt is: "Undo the last change completely. Return to exactly how it was before, and confirm what you reverted."

The Operator Prompt Pack

This is one of 60 prompts, from the phase "Build without it running off". The pack has the rest, each with the same reasoning underneath, plus the research they are built on and a house-rules file you paste in once.

Get the pack — €9

Tools this applies to

ToolWhat it doesPrice
Claude CodeAn AI agent in your terminal that reads your files, edits them, runs commands and deploys.~€17–20/mo
CursorA code editor with AI. The step between browser builder and terminal.~$20/mo
GitHubVersion control. Your restore point when an hour of building goes wrong.Free

Every tool has its own page with what it costs and who should skip it. Some links are affiliate links.

More prompts like this

Debugging

The prompt that stops an AI agent going in circles

What do you do when an AI coding agent keeps trying fixes that do not work?

Verifying

The prompt that makes an AI agent prove its code works

How do you verify that code written by an AI agent actually works?

The whole library

All prompts →The packs →