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.

Advertisement

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:

  1. Context — point at the files with @Files, @Folders, or @Codebase.
  2. Mode — Ask to plan, Agent to build; switch in the chat pane.
  3. Task — one clear goal, with exact paths.
  4. 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.

SymbolWhat it pulls inUse it when
@FilesSpecific files you nameYou know exactly which files the change touches
@FoldersA whole directory of filesA change spans a module or feature folder
@CodeA selected snippet or symbolYou want to reference one function or block
@DefinitionsThe definition of a symbolYou need where a function or type is declared
@CodebaseSemantic search over the whole repoYou don't know which files matter yet
@DocsIndexed docs for a libraryYou want current API details for a dependency
@WebLive web search resultsYou need info newer than the model's training
@GitDiffs and commit contextYou want the model to reason about recent commits
@Recent ChangesYour uncommitted editsReviewing or continuing work in progress
@Past ChatsEarlier conversationsYou want to pick up where a prior chat left off
@Lint ErrorsCurrent linter/type errorsYou want the model to fix what's flagged
@TerminalRecent terminal outputA 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
Advertisement

Modes

Pick the mode in the chat pane. Use Ask to think and plan; switch to Agent to actually build and verify.

ModeWhat it doesBest for
AskRead-only Q&A and planning; won't edit filesUnderstanding code, exploring, drafting a plan
AgentPlans, edits across files, runs commands and tests, iterates until doneBuilding a feature or fixing a bug end to end
PlanAgent proposes a plan before it executesReviewing the approach before code changes
Background AgentRuns a task asynchronously while you workLong or parallel tasks you don't want to babysit
Inline (Cmd/Ctrl+K)Edits the selected code in placeA quick, localized change to a selection
Auto-run / YOLOLets Agent run commands without confirming each oneTrusted, 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.

ShortcutAction
Cmd/Ctrl+KInline edit — edit the selected code in place
Cmd/Ctrl+LOpen the chat pane
Cmd/Ctrl+IOpen the Composer / Agent pane
TabAccept the autocomplete / next-edit suggestion
EscReject 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
Advertisement

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 typeWhen it applies
AlwaysInjected into every request, no matter what
Auto AttachedWhen a file matching its glob is in context
Agent RequestedWhen the Agent decides the rule is relevant
ManualOnly 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.

ModifierWhat 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.

Advertisement