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
| Feature | Shortcut / access | Best for |
|---|---|---|
| Chat | Cmd+L | Explain code, small edits, debugging questions |
| Inline Edit | Cmd+K on selection | Rename, refactor one function, fix lint in place |
| Agent / Composer | Cmd+I | Multi-file features, tests + implementation |
| @ mentions | Type @ in chat | Pin files, folders, docs, web to context |
| Rules | .cursor/rules/*.md | Persistent project conventions |
| Terminal | Agent proposes commands | Run 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
| Pitfall | Why it hurts | Fix |
|---|---|---|
| Vague giant prompts | Wrong files changed, broken build | Scope one task; attach @files explicitly |
| No rules file | Inconsistent style every session | Commit .cursor/rules to repo |
| Blind accept all diffs | Subtle bugs, deleted logic | Review every hunk; run tests |
| Missing @ context | Hallucinated APIs not in codebase | Pin relevant files and types |
| Secrets in chat | Keys in model context/logs | Use env vars; never paste credentials |
| Agent without test command | Regressions ship | Always 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
| Question | Answer |
|---|---|
| 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)
⑧ 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