Agents & Workflows
How to Write Good Prompts in Cursor
Good Cursor prompts state the goal and the constraint. Point the agent at the exact files with @-mentions, run anything non-trivial through Plan mode (⇧⇥) so you approve a plan before edits, and tell it how to verify success with a test or command. Vague one-liners produce vague results; specific, scoped prompts produce reliable ones.
On this page
What does a good Cursor prompt look like?
A reliable prompt carries four things: the goal with its constraint, the exact files as context, a request to plan before editing, and a way to check the result. You don't need all four on a one-line fix, but on anything non-trivial the agent does better work when you supply them.
The prompt is the review
0:38 · narratedRead this demo as text
- Okay, compose the request. The tight prompt names the change, scopes it to the file components/search, and fences the filter logic. The build can only be as big as that allows.
- Hit send. Planned as prose, built, done. No dangling question. And the files card stops at three.
- Three files, all inside the file components/search. And the file searchFilter.ts? Not one of them. The boundary you wrote is the boundary that shipped.
Practice next: Practice this yourself in the hands-on module.
Simulated Cursor 3.12 (macOS, light) — beta educational reconstruction, not the real product.
- Goal + constraint
- "Add pagination to the users list without changing the public API."
- Context
- @-mention the exact files instead of making it search.
- Plan
- Flip into Plan modeA mode that makes no edits: it researches the codebase and produces an editable plan you review before any code changes. Press Enter for the full definition. (⇧⇥) so the agent drafts a plan you approve before it edits.
- Verification
- "Run the tests in users.test.ts to confirm."
The order in that list is not decorative. Goal and constraint come first because the other three are scoped by them: which files count as context, what the plan is a plan for, and what a passing check would even prove. Verification sits last and it is the one that gets dropped, probably because by the time the first three are written the prompt already looks finished.
The constraint is the half of that first line most people leave off. "Add pagination to the users list" and "add pagination to the users list without changing the public API" produce different diffs, and only the second one is quick to review. Write the constraint even when it feels obvious, since the agent has no way to know which parts of a file are load-bearing for somebody else.
You no longer have to prompt for a plan by hand. Press ⇧⇥ (or use the mode picker) to switch the agent into Plan modeA mode that makes no edits: it researches the codebase and produces an editable plan you review before any code changes. Press Enter for the full definition.: it researches the codebase, asks clarifying questions and writes a plan you can edit before anything is built. Approve it and the agent implements.
This is covered hands-on in Agent Mode Foundations — 6 short modules, free to read.
What habits make prompts work better?
Most of the gain comes from a few habits you repeat. Be specific about files and behavior, keep one task per chat so the context stays clean, show an example of the pattern you want, and push your durable conventions into rules instead of retyping them. When a tangent comes up mid-task, spin it into a side chat instead of derailing the main thread.
- Be specific - name files, functions and the exact behavior you want.
- One task per chat - start fresh per task to keep context clean.
- Show an example of the pattern you want followed.
- Put durable conventions in rules, not in every prompt.
Of those four, one task per chat is the one with a real cost behind it rather than a preference. A long thread compresses its own history every turn, so the context you care about ends up competing with everything the thread has already said. Start a new chat when the task changes rather than when the thread starts to feel long.
Can you show a vague prompt rewritten into a good one?
Here's the same intent written two ways. The vague version makes the agent guess what you meant and search the repo to orient itself. The scoped version names the file, the change and what not to touch, so the agent starts on the right code.
"Make the app better."
No surface, no change, no constraint. The agent has to guess what "better" means, search the whole repo to orient itself, and will likely touch files you didn't want touched.
"In @components/CheckoutForm.tsx, add inline validation for the email and card fields. Show errors on blur, don't change the submit handler or the styling. Verify with @CheckoutForm.test.tsx."
Names the surface, the change and the constraint - and points the agent at the exact file instead of making it hunt.
Interactive widget. Tab through its controls; the result updates in the panel below as you change them.
Fill in the surface, the change and the constraint, then copy the prompt into Cursor.
Fill in the slots and the composer assembles them into a single prompt you copy straight into the Cursor agent. The @-mention stays a live reference, so the agent opens the file you named instead of grepping for it.
Every file you tag with @ is one fewer file the agent has to go searching for. Tagging @components/CheckoutForm.tsx lands the agent on the right code immediately; "the checkout form" makes it grep, read candidates and burn turns guessing.
That advice has an edge Cursor states plainly and this page has been glossing over. Naming the file is right when you already know which file matters. When you do not, the documented guidance is to skip the mention and let the agent search, because a guessed-at list of five files is noise dressed up as direction. The scoped example above works because whoever wrote it knew the checkout form lived in one component. On a codebase you have not learned yet, describe the behaviour precisely and leave the file list empty.
A vague prompt on an expensive model is the worst of both worlds: the agent spends tokens exploring and re-reading to compensate for the missing scope, so you pay more and get lower-quality output. Scope the prompt and you cut both the cost and the error rate.
What do I do when a good prompt still produces the wrong thing?
Go back to the plan instead of sending another prompt. Cursor's recommendation for a result that misses is to revert the changes, make the plan more specific and run it again, which tends to be faster than steering an agent that is already halfway into the wrong approach.
Follow-ups feel cheaper, and that is the trap in them. Each one lands in a thread that already holds the reasoning behind the wrong answer, so you are asking the model to argue with itself while the bad context stays in the window. A revert costs you the diff and leaves the plan, and the plan is where you can change one line and try again.
When a fresh, well-scoped prompt keeps producing the same wrong thing, the cause is probably upstream of the prompt. A convention you find yourself restating every time belongs in a rules file. A thread you have been extending all afternoon is carrying context that no amount of rewording will outrun, so start a new chat for the next task.
What can I feed the agent besides text and files?
Text isn't the only context the agent takes. Some of the strongest prompts hand it a website, an image, or a spoken brain-dump - whatever carries the intent fastest.
- A live site or brand-guidelines URL - Cursor has web access, so "use the HTML and CSS from the Cursor docs page" makes it navigate there, read the visual structure and typography, and apply those tokens to your prototype. A brand-guideline PDF works too: drag it in.
- Images - hand-drawn diagrams, screenshots, sketches. One team uploaded photos of their hand-drawn technical designs and Cursor turned them into Mermaid diagrams they published to FigJam.
- Voice - click the microphone icon and just talk; review the transcription before it sends. It's the lowest-friction way to dump everything in your head into the agent.
The bottleneck in good agent work is getting the tacit expertise out of your head. Voice lowers that friction - you ramble, the agent listens, and you've offloaded context you'd never have typed.
Turn on voice modeDictating context to the agent by speaking instead of typing, used to dump everything in your head into the prompt faster than your fingers can. Press Enter for the full definition., give it all the context, let it ramble, give everything that's stored in your brain to the agent. It then does a really good job.
Frequently asked questions
Why are my Cursor results inconsistent?
Usually the prompt is under-specified or the context is noisy. State the goal and constraint, @-mention only the relevant files and give the agent a way to verify success.
Should I ask Cursor to plan before coding?
Yes, and it's built in now: Plan mode (⇧⇥ or the mode picker) has the agent research the codebase, ask clarifying questions and produce an editable plan you approve before it builds. Reviewing a plan catches a wrong approach in seconds instead of unwinding a bad multi-file edit.
Why did a vague prompt burn so many tokens?
Because the agent had to compensate for the missing scope. With no named file or constraint it searches the repo, reads candidate files and re-reads context to figure out what you meant - all of which spends tokens before it writes a line. On an expensive model that exploration is costly and the result is usually lower quality too. @-mention the exact file and state the change and constraint to cut both.
Sources & last verified
Cursor ships frequently. Last updated July 28, 2026.
Keep reading
Rather do it than read about it? Run 11 interactive Cursor walkthroughs in a simulated editor. Free, no account needed.