That single line of prompt that prevented my AI from deleting functional code

I've been working on my habit tracker project, Streakpad, using Cursor for about six weeks. The most expensive mistake I made did not come from a bug. It came from asking the model to "clean up" a file and then watching it silently delete a date parsing function that three screens relied on.

Since then, I've been adding one line to each prompt: list what you will change and what you will not change, and then wait. It takes maybe ten seconds. It has saved me at least four rollbacks, and I now read the "will not change" list more carefully than the code itself.

The other thing I started doing was committing before each AI request, no matter how small. My git log looks ridiculous, but rolling back is one command.

Anyone else uses such a guard line? I would like to compare wording because mine keeps getting ignored with long files.

13 views

Add a comment

Replies

Best

My approach is to split files into smaller chunks before prompting. When dealing with blocks of code the context window often ignores specific instructions. By creating files the tool is forced to follow boundary constraints more effectively. This way it pays attention to the instructions. Works, within defined limits.