How to Stop Cursor from Editing Unintended Code

Hi everyone,
I’ve been using the AI coding tool Cursor recently, but I ran into an issue. When I ask Cursor to modify my mobile code, it sometimes messes up and also changes my PC code by mistake. Is there a way—maybe a certain mindset or using an MCP server(better)—to help Cursor reduce these kinds of wrong edits? How can I prevent this from happening?

Thanks!

Hi, its not really clear what is going on in your case.

The behavior of an AI model depends mostly on:

  • your prompt, thats how you guide the AI what to do.
  • your project structure, good structure prevents such issues easier
  • size of files, longer files are more likely to confuse AI
  • how tasks are prepared and assigned, a good preparation prevents a lot of issues.

Can you share a bit more about what you are doing?

There are also other forum members who can add their experiences, it helps if they have more details to see what is the issue.

As a total. Noob, i ran into this kind of thing for awhile with claude Sonnet 3.5, where it would jump into files I didn’t want it to mess with. I solved it by telling the AI exactly what I wanted it to do and what I wanted wanted it to avoid, and questioning whether it understood, agreed, and having it repeat the instructions as it understood them. Problem solved.

1 Like

Great suggestion, we all had a start with one or other AI model :slight_smile:

Its helpful to ask the AI model how you can improve your request/instructions (prompt) to avoid certain issues.

No, it isn’t. This is completely factually incorrect and actually many advanced users advise against this because it does not tangibly have any benefit. You are asking a calculator to calculate what you might ask it to calculate better something it does not see. Do not do this for the love of God.

We can disagree on that :wink: but blanket negative statements without details are not helping other forum members.

I wrote several systems where prompts are getting improved by AI and customers are using those to improve their prompts with success.