If you use Cursor's agent on a real codebase, you've probably seen it: you ask for a one-line fix and get back a diff that reformats imports, renames variables, and "improves" three functions you didn't touch.
The fix that's worked best for me isn't a better prompt — it's a project rule that's always applied.
The rule
Create .cursor/rules/small-diffs.mdc:
---
description: "Keep changes minimal and scoped"
alwaysApply: true
---
- Change only the lines required for the task. Do not reformat, reorder imports, or rename unrelated code.
- Before editing, state in one sentence which files and functions you will touch.
- If a fix needs changes outside that scope, stop and ask first.
- Match the existing style of the file, even if you'd write it differently.
- Never delete comments or tests unless asked.
- Prefer editing existing functions over adding new abstractions.
- After editing, list every file changed and why.
Why it works
- "State the scope first" makes the agent commit to a plan you can reject before any edit happens.
- "Stop and ask" turns silent scope creep into a question.
- "Match existing style" kills the reformat-everything diffs that make review painful.
- "List every file changed" gives you a free checklist for review.
Tips
- Keep always-on rules short. Long rules get diluted; put specialised guidance in rules scoped with
globs(e.g.**/*.test.ts) instead. - One concern per rule file. Easier to toggle when debugging odd behaviour.
- Commit
.cursor/rules/so your whole team gets the same behaviour. - When the agent misbehaves, add one line to a rule rather than repeating yourself in chat.
Try it
Drop the file in, ask for a small fix, and compare the diff to what you got before. I'd be curious whether it helps on your codebase — tell me in the comments what rule you'd add.
Disclosure: I'm the author of ShipStack's Cursor Rules + Skills Pack, a paid collection of rules like this one (testing, refactors, PR review, etc.). If this one helped, the rest are here: https://shipstack.sognia.workers.dev/cursor-pack — but the rule above is free to use however you like.
Top comments (0)