Cursor Pro Tips — The Complete Guide with Examples
A comprehensive guide to Cursor IDE pro tips—Agent mode, Composer, @ mentions, rules, and workflow best practices with real examples.
Cursor Pro Tips — The Complete Guide with Examples
Cursor is one of the most powerful AI-powered code editors available. Whether you're refactoring across many files, writing tests, or exploring a new codebase, these pro tips will help you get more out of Cursor with less friction. Each section includes concrete examples you can use today.
1. Bring Context In with @ Mentions
What it is: Typing @ in Chat or Composer lets you attach files, folders, docs, or the whole codebase so the AI uses real context instead of guessing.
What you can @ mention:
| Mention | Use case |
|---|---|
@filename.ts | Single file |
@src/components/ | Whole directory |
@codebase | Semantic search over the project |
@docs | Attached documentation (e.g. API docs) |
@web | Live web search |
Example: Instead of "add error handling to the login form," say:
Add error handling to the login form: show a toast on failure and disable submit while loading.
@components/LoginForm.tsx @hooks/useAuth.ts
2. Set Global AI Rules (System Prompts)
What it is: Settings → Cursor Settings → Rules (or General → Rules for AI) lets you set global instructions that apply to every conversation—no need to repeat them.
Example rules:
Prefer functional code over imperative where possible.
In TypeScript/JavaScript, omit semicolons at the end of lines.
Use Tailwind CSS for styling.
Use fetch for network requests, not axios.
Use British-English spelling (e.g. "colour", "behaviour").
Use date-fns for any date manipulation.
Write sentence case for UI copy, not Title Case.
You can mix and match from cursor.directory or awesome-cursorrules. Global rules are per-developer, so use project rules (below) for team consistency.
3. Add a .cursorrules File to Every Project
What it is: A .cursorrules file in the project root gives the AI project-specific context: stack, conventions, and business rules. A few minutes upfront pays off in every conversation.
Example .cursorrules:
This is a Next.js 14 app with the App Router. We use:
- TypeScript strict mode
- Tailwind CSS and shadcn/ui
- Supabase for auth and database
- Server Components by default; use "use client" only when needed
Conventions:
- Put API route handlers under app/api/
- Colocate component tests next to the component (Component.tsx + Component.test.tsx)
- Use the shared Button, Input, and Card from @/components/ui
- Never commit console.log in production code
For a more complex product you can add domain rules:
- The properties table is self-referential (parent_id). "Leaf" properties have no children and can have leaseholders; buildings/floors cannot.
- Always consider this hierarchy when writing queries or UI that shows properties.
4. Prime Tab Autocomplete for Boilerplate
What it is: Cursor's inline Tab autocomplete is great for repetitive, predictable code: API calls, test stubs, config blocks, and simple components.
How to use: Write a short comment or a line that indicates what you want, then accept the suggestion.
Example: Type:
// GET /api/users - returns list of users with pagination
Then Tab through to get a full fetch + types + error handling block. Use it for patterns you repeat; leave architecture and multi-file design to Agent/Composer.
5. Prefer Smaller, Focused Files
What it is: Smaller, single-purpose files make it easier to give precise context (e.g. @utils/formatDate.ts) and reduce the chance of the AI drifting in the middle of a large file. When something goes wrong, the blast radius is smaller.
Pro tip: Create empty placeholder files and add them with @ to steer the AI: "Implement the logic in @services/auth.ts; the interface is already in @types/auth.ts."
6. Keep Conversations Short and Focused
What it is: Long threads dilute context and can lead to loops or inconsistent behaviour. Start a new chat when you’re changing task or the current one isn’t making progress.
Practice: When you’re stuck in a loop, start a new conversation with a refined prompt and any corrections you’ve learned (e.g. "Use the User type from @types/user, not the API response shape").
7. Use Images When It Helps
What it is: You can paste screenshots (e.g. UI bugs, designs from v0 or Figma) into Chat or Composer. The model can use them to match layout or fix visual issues.
How: Cmd+V / Ctrl+V to paste an image into the input.
Example: "The modal should look like this [screenshot]. Right now the padding and button order are wrong. Update @components/Modal.tsx to match."
8. Commit Early and Often
What it is: Cursor creates checkpoints, but conversations can be non-linear (edits, reverts, partial accepts). Committing at meaningful milestones gives you a clear revert point.
Practice: After a coherent set of changes (e.g. "Add dark mode toggle"), commit with a clear message. If the next step goes wrong, you can revert to that commit instead of untangling the session.
9. Let the AI Write Tests
What it is: Ask the AI to add unit or integration tests for the code you’re writing. With small files and clear instructions, it’s surprisingly effective.
Example:
Add unit tests for formatCurrency in @utils/currency.ts. Cover zero, negative, and large numbers, and the correct locale and symbol. Use Vitest and the existing test setup in this repo.
Combine with "write tests first" when you want TDD-style flow: describe behaviour, get tests, then implement.
10. Add Docs to Cursor for Easy @ Reference
What it is: In Settings, you can attach documentation (e.g. your API docs or a framework guide). Then in any chat you can @Docs or reference that doc so the AI follows your real APIs and conventions.
11. Request Comments for Learning
What it is: When you’re learning a codebase or a pattern, ask the AI to add short comments so you can follow the logic.
Example:
Add brief comments to this function explaining each step, so I can understand the validation flow. @utils/validateCheckout.ts
12. Use Custom Commands in .cursor/commands/
What it is: You can save reusable AI prompts as slash commands by adding Markdown files under .cursor/commands/ in your project root (or ~/.cursor/commands/ for global commands). Type / in Chat to see and run them.
How to set it up:
- Create the folder:
.cursor/commands/ - Add one
.mdfile per command, e.g.code-review.md,add-tests.md, orrefactor.md - Put the prompt instructions in the file—whatever you want the AI to do when the command runs
- In Cursor, type / in the chat input to list and select your commands
Example: .cursor/commands/code-review.md
Review the selected code (or @file) for:
- Correctness and edge cases
- Readability and naming
- Security and performance issues
Suggest concrete improvements; keep feedback concise and actionable.
Example: .cursor/commands/add-tests.md
Add unit tests for the code in the current file. Use the project's existing test framework and patterns. Cover happy path and at least two edge or error cases.
Project commands in .cursor/commands/ can be committed to git so your whole team gets the same workflows (e.g. standard code review or “fix lint” prompts). Global commands in ~/.cursor/commands/ are for your own reuse across projects.
Quick Reference
| Goal | Use |
|---|---|
| Multi-file feature or refactor | Composer or Agent + @codebase / @files |
| Single-file quick edit | Agent or Cmd+K with @file |
| Repetitive boilerplate | Tab autocomplete + short comment |
| "Where is X?" or "How does Y work?" | Chat + @codebase |
| Match a design or fix UI | Paste image + @component |
| Team consistency | .cursorrules + shared Rules |
| Personal style & stack | Global Rules in Cursor Settings |
| Reusable prompts / team workflows | Custom commands in .cursor/commands/*.md |
Cursor improves quickly with a bit of structure: clear prompts, the right mode (Agent vs Composer vs Chat), and consistent use of @ and rules. Start with global rules and a .cursorrules file, then lean on @codebase and small, focused conversations. You’ll get more accurate edits and fewer surprises.
If you have a favourite Cursor tip that isn’t here, share it—and try one of these in your next session.