AI

How to Use Cursor

AI-native IDE: chat, inline edit, Composer, rules, and repo-aware coding.

Interview tip Power moves: @file context, .cursorrules, Composer for multi-file features, terminal commands with approval.

① What you must know (30 sec)

Cursor is an AI-native IDE (VS Code fork) with Chat for Q&A, Inline Edit (Cmd+K) for selection changes, and Agent/Composer for multi-file features. Use @ mentions to pin files and docs into context, and .cursor/rules to enforce project conventions across sessions.
Analogy: Cursor is pair programming with someone who has read your whole repo — but you still review every line before merge.

② How it works

FeatureShortcut / accessBest for
ChatCmd+LExplain code, small edits, debugging questions
Inline EditCmd+K on selectionRename, refactor one function, fix lint in place
Agent / ComposerCmd+IMulti-file features, tests + implementation
@ mentionsType @ in chatPin files, folders, docs, web to context
Rules.cursor/rules/*.mdPersistent project conventions
TerminalAgent proposes commandsRun tests, installs — always review first
Smaller scoped tasks get better results: "add unit tests for UserService" then "implement caching" beats one giant vague prompt.

③ Step-by-step (hands-on)

Step 1 — Open project and index

Open repo root so Cursor indexes the codebase. Wait for indexing on large monorepos before heavy Agent tasks.

Step 2 — Set up rules

Create .cursor/rules with stack, test commands, naming conventions, and "never commit secrets."

Step 3 — Chat for orientation

Ask "how does auth work?" with @src/auth/ attached. Read answer before changing code.

Step 4 — Inline for local edits

Select function → Cmd+K → "add error handling for null user". Review diff hunk by hunk.

Step 5 — Agent for features

Write spec: goal, files likely touched, test plan. Agent edits multiple files; run tests after.

Step 6 — Review and iterate

Never accept all blindly. Run linter and tests. Follow up chat: "fix failing test X".

④ Code / config patterns

Effective prompt template: Goal → Constraints → @files → Test command → "Do not modify unrelated files." Example: "Add rate limiting to POST /api/chat. Use existing Redis client. @src/api/chat.ts @src/lib/redis.ts. Run npm test. Minimal diff only."
# .cursor/rules/project.md
- Stack: Next.js 14, TypeScript, Tailwind
- Run tests: npm test
- Never commit .env or API keys
- Match existing error handling in src/lib/errors.ts
- Prefer small PRs; one feature per Agent session

⑤ Production & pitfalls

PitfallWhy it hurtsFix
Vague giant promptsWrong files changed, broken buildScope one task; attach @files explicitly
No rules fileInconsistent style every sessionCommit .cursor/rules to repo
Blind accept all diffsSubtle bugs, deleted logicReview every hunk; run tests
Missing @ contextHallucinated APIs not in codebasePin relevant files and types
Secrets in chatKeys in model context/logsUse env vars; never paste credentials
Agent without test commandRegressions shipAlways specify how to verify in prompt
Production tips:
  • Enable privacy mode if code cannot leave your machine
  • Use team rules for shared conventions across developers
  • Treat Agent output like a junior PR — full review required
  • Document which models your org allows for compliance

⑥ Interview / on-the-job Q&A

QuestionAnswer
Chat vs Composer?Chat for Q&A and small edits; Composer/Agent for multi-file implementation.
What are @ mentions?Attach files, folders, documentation, or web pages to the model context.
What are Cursor rules?Persistent instructions in .cursor/rules applied to every session in the project.
Is code sent to the cloud?Depends on privacy settings and plan — check Cursor privacy docs for your tier.
Best workflow?Spec → attach context → small scope → review diff → run tests → commit.
When use Inline vs Agent?Inline for one function; Agent when touching 3+ files or adding a feature end-to-end.

⑦ Tools & ecosystem

  • Modes: Chat, Inline Edit, Agent/Composer
  • Context: @file, @folder, @codebase, @docs, @web
  • Config: .cursor/rules, .cursorignore
  • Models: GPT-4o, Claude Sonnet, Composer models (settings)
cursoridecomposerrulesproductivity

⑧ Revision checklist

  • .cursor/rules committed with stack and test commands
  • Understand Chat vs Inline vs Agent use cases
  • @ mentions used for relevant files on every task
  • Prompts scoped to one feature or fix
  • Every diff reviewed before accept
  • Tests run after Agent sessions
  • No secrets pasted into chat
  • Privacy settings checked for work repos
  • .cursorignore excludes node_modules and secrets