The two moves that make Cursor prompts land: point at context explicitly with @-symbols instead of hoping the model finds the right files, and set acceptance criteria so Agent knows when it's done. Everything else on this page — modes, shortcuts, rules, modifiers — is in service of those two.
Keep this open while you work. New to the pattern? Read how to prompt Cursor for coding for the full method, browse the best Cursor prompts, and grab reusable skeletons from the Cursor prompt templates.
The prompt formula
Every good Cursor prompt follows the same four beats. Say them in order and Agent has everything it needs to plan, edit, and self-check:
- Context — point at the files with
@Files,@Folders, or@Codebase. - Mode — Ask to plan, Agent to build; switch in the chat pane.
- Task — one clear goal, with exact paths.
- Constraints / Acceptance — scope limits plus how you'll know it's done.
[Agent mode] Using @Files src/auth/login.ts and @Files src/auth/session.ts,
add a "remember me" option to the login flow.
Constraints:
- Follow the patterns already in these files. Don't touch unrelated files.
- Add tests and run them; fix failures before you finish.
Acceptance: login persists across a browser restart when the box is checked,
and existing tests still pass.@-symbols reference
Type @ in the chat to pull context in. These are the primitives that make Cursor accurate — the more precisely you point, the less it guesses.
| Symbol | What it pulls in | Use it when |
|---|---|---|
@Files | Specific files you name | You know exactly which files the change touches |
@Folders | A whole directory of files | A change spans a module or feature folder |
@Code | A selected snippet or symbol | You want to reference one function or block |
@Definitions | The definition of a symbol | You need where a function or type is declared |
@Codebase | Semantic search over the whole repo | You don't know which files matter yet |
@Docs | Indexed docs for a library | You want current API details for a dependency |
@Web | Live web search results | You need info newer than the model's training |
@Git | Diffs and commit context | You want the model to reason about recent commits |
@Recent Changes | Your uncommitted edits | Reviewing or continuing work in progress |
@Past Chats | Earlier conversations | You want to pick up where a prior chat left off |
@Lint Errors | Current linter/type errors | You want the model to fix what's flagged |
@Terminal | Recent terminal output | A command failed and you want it diagnosed |
# | Adds a file to context (shortcut) | Quick file attach while typing |
/ | Runs a command (e.g. /Reset Context) | You want a built-in action, not a message |
Modes
Pick the mode in the chat pane. Use Ask to think and plan; switch to Agent to actually build and verify.
| Mode | What it does | Best for |
|---|---|---|
| Ask | Read-only Q&A and planning; won't edit files | Understanding code, exploring, drafting a plan |
| Agent | Plans, edits across files, runs commands and tests, iterates until done | Building a feature or fixing a bug end to end |
| Plan | Agent proposes a plan before it executes | Reviewing the approach before code changes |
| Background Agent | Runs a task asynchronously while you work | Long or parallel tasks you don't want to babysit |
| Inline (Cmd/Ctrl+K) | Edits the selected code in place | A quick, localized change to a selection |
| Auto-run / YOLO | Lets Agent run commands without confirming each one | Trusted, sandboxed work where you want speed |
Keyboard shortcuts
Cursor keeps VS Code's keybindings and adds a few AI-first ones. These are the ones worth muscle memory.
| Shortcut | Action |
|---|---|
Cmd/Ctrl+K | Inline edit — edit the selected code in place |
Cmd/Ctrl+L | Open the chat pane |
Cmd/Ctrl+I | Open the Composer / Agent pane |
Tab | Accept the autocomplete / next-edit suggestion |
Esc | Reject a suggestion or stop a generation |
@ | Add context (files, docs, web, git, and more) |
# | Add a file to context |
/ | Run a command in the chat |
Rules (.cursor/rules)
Rules are persistent project instructions Cursor injects into every Ask, Agent, and inline run. In 2026 the modern form is a .cursor/rules/ directory of .mdc files, each scoped by glob and metadata. The legacy single .cursorrules file at the repo root still works.
| Rule type | When it applies |
|---|---|
| Always | Injected into every request, no matter what |
| Auto Attached | When a file matching its glob is in context |
| Agent Requested | When the Agent decides the rule is relevant |
| Manual | Only when you reference it explicitly |
| .cursorrules (legacy) | Single root file, applied project-wide |
A minimal .cursor/rules/typescript.mdc that auto-attaches to TypeScript files:
---
description: TypeScript conventions for this repo
globs: ["**/*.ts", "**/*.tsx"]
alwaysApply: false
---
- Use strict types; never use `any` unless there's no alternative, and comment why.
- Prefer named exports. No default exports.
- Handle errors explicitly; don't swallow them.
- Match the patterns in the file you're editing before inventing new ones.
- When you add a function, add or update its test in the sibling *.test.ts file.Tip: run /Generate Cursor Rules in a chat to draft a rule from a conversation you liked.
Prompt modifiers that work
Drop these phrases into any Cursor prompt to control scope, process, and output. They're the difference between a focused change and a sprawling rewrite.
| Modifier | What it does |
|---|---|
| "plan before editing" | Agent outlines its approach first so you can course-correct |
| "don't touch unrelated files" | Keeps the change scoped to what you asked for |
| "run the tests and fix failures" | Makes Agent verify its own work before finishing |
| "return only a diff" | Focuses the response on the changed lines |
| "match the patterns in @[file]" | Aligns new code with your existing conventions |
| "acceptance: [criteria]" | Defines "done" so Agent can self-check against it |
| "ask before anything destructive" | Gates deletes, migrations, and force-pushes behind approval |
Copy-paste examples
Five ready-to-paste prompts covering the common tasks. Swap the [bracketed placeholders] and point the @-symbols at your files.
Feature
[Agent] Add [feature] using @Folders [dir] for context.
Plan before editing, then implement following the existing patterns.
Add tests and run them. Don't touch unrelated files.
Acceptance: [what's true when it works] and all tests pass.Bugfix
[Agent] Fix this bug. @Terminal @Lint Errors @Files [suspect file]
Symptom: [what's wrong]. Expected vs actual: [both].
Reproduce it first (write a failing test), trace the root cause,
make the smallest safe fix, then re-run to prove it's resolved.Refactor
[Agent] Refactor @Files [file] for readability without changing behavior.
Improve naming, structure, and duplication. Keep inputs and outputs identical.
Run the existing tests to confirm nothing broke, then summarize what changed.
Don't touch unrelated files.Test
[Agent] Write [Jest / pytest] tests for @Files [file].
Cover the happy path, edge cases, and error paths, including the boundaries
I'd forget (empty, null, max, negative). Name each test after the behavior.
Run the suite and fix any failures before you finish.Review
[Ask] Review @Recent Changes as a staff engineer.
Intent of this change: [intent].
List issues most severe first: correctness, security, edge cases, then style.
Give the location and a concrete fix for each. Don't rewrite whole files —
point to specific lines.Want the reasoning behind these patterns? Read how to prompt Cursor for coding, and pull full skeletons from the Cursor prompt templates.
Frequently Asked Questions
What are @-symbols in Cursor?
@-symbols are Cursor's context primitives — you type @ in the chat pane to point the model at specific context instead of hoping it finds it. @Files and @Folders pull in files and directories, @Code and @Definitions grab a symbol, @Codebase runs a semantic search over the whole repo, @Docs and @Web pull in indexed docs and live web results, and @Git, @Recent Changes, @Lint Errors, and @Terminal add diffs, changes, errors, and terminal output. The # shortcut adds a file and / runs commands.
What is the difference between Cursor's modes?
Ask is read-only — it answers questions and plans but won't edit files. Agent is autonomous: it plans, edits across multiple files, runs terminal commands and tests, reads the output, and iterates until the task is done. Plan is the step where Agent proposes a plan before executing it. Background Agent runs a task asynchronously. Inline edit (Cmd/Ctrl+K) edits the selected code in place. Auto-run (sometimes called YOLO) lets Agent run commands without confirming each one.
What goes in .cursor/rules vs .cursorrules?
The modern approach (2026) is a .cursor/rules/ directory of .mdc files, each scoped by glob and metadata, with four types: Always, Auto Attached, Agent Requested, and Manual. This lets you apply different rules to different parts of the repo. The legacy .cursorrules is a single file at the repo root that applies project-wide; it still works but the directory of scoped .mdc files is more flexible.
What are the best keyboard shortcuts in Cursor?
The core four are Cmd/Ctrl+K for inline edit on selected code, Cmd/Ctrl+L to open the chat pane, Cmd/Ctrl+I to open the Composer/Agent pane, and Tab to accept an autocomplete or next-edit suggestion. Inside the chat, @ adds context, # adds a file, and / runs commands. Esc rejects a suggestion or stops a generation.
How do I switch models in Cursor?
Pick the model per chat from the model selector in the chat pane — you can choose Claude Opus 4.8 or Sonnet, GPT-5.x, Gemini, or Auto, which lets Cursor route the request. You set it before or during a conversation, so you can start planning in one model and switch to another to implement. Prompting technique usually matters more than the model choice.
How do I add a whole folder to context?
Type @Folders in the chat and pick the directory — Cursor pulls the folder's files into context. For a repo-wide question where you don't know which files matter, use @Codebase instead, which runs a semantic search across the whole project. Adding a large folder uses a lot of context, so prefer @Files for the specific files you already know are involved.