Step 1: Install and Configure Cursor (3 Minutes)
Cursor is a VS Code fork with built-in AI capabilities. Download from cursor.com. Installation: run the installer (macOS, Windows, or Linux). On first launch: Cursor offers to import VS Code settings, extensions, and keybindings. Accept this to keep your familiar environment. Cursor uses the same extension marketplace as VS Code — your existing extensions work immediately.
Model selection: Cursor supports multiple AI models. In Settings → AI → Model: select your preferred model. For rule-following accuracy: Claude models (claude-sonnet-4-20250514 or claude-opus-4-20250514) tend to follow .cursorrules most consistently. GPT-4o and Gemini are also available. You can switch models per-conversation. AI rule: 'For projects with detailed .cursorrules: Claude models follow custom rules most reliably. Test with your actual rules to verify which model produces the best output for your project.'
Codebase indexing: Cursor indexes your project for context-aware suggestions. In Settings → Features → Codebase Indexing: enable it. The first index takes 1-5 minutes depending on project size. After indexing: Cursor can reference any file in the project when generating code — it understands imports, types, and function signatures across the codebase. AI rule: 'Wait for indexing to complete before starting AI-assisted work. Without indexing: Cursor cannot reference other files, leading to hallucinated imports and missing type context.'
Step 2: Create Your .cursorrules File (5 Minutes)
Create a file named .cursorrules in the root of your project (next to package.json). This file tells Cursor's AI about your project conventions. Cursor reads it automatically — no configuration needed. The format: plain text or Markdown. Write your conventions as clear statements that the AI can follow.
The .cursorrules file supports the same content as CLAUDE.md: project context (tech stack, architecture), coding conventions (naming, patterns, error handling), testing standards (framework, naming, coverage), and project-specific rules (domain terminology, API patterns). If you already have a CLAUDE.md: copy the content to .cursorrules. Both files can coexist — Claude Code reads CLAUDE.md, Cursor reads .cursorrules.
Verify: open the Cursor AI chat (Cmd+L or Ctrl+L). Prompt: 'What conventions does this project follow?' Cursor should reference your .cursorrules content. If it does not: verify the file is in the project root, is named exactly .cursorrules (with the leading dot), and is not empty. AI rule: 'The .cursorrules file must be in the project root directory — the same directory you open in Cursor. If you open a parent directory: Cursor may not find the .cursorrules in a subdirectory.'
Prompt: 'Create an order service.' The AI generates: a generic service structure. Better prompt: '@user-service.ts Create an order service following the same pattern.' The AI generates: an order service that mirrors the user service's exact structure — same naming convention, same error handling, same test pattern. The @filename reference is more effective than describing the pattern in words because it gives the AI a concrete example to follow.
Step 3: Key Cursor Features for Rule-Based Coding (5 Minutes)
Tab completion (Cursor Tab): as you type, Cursor suggests completions that follow your .cursorrules. Accept with Tab. The suggestions are context-aware: they consider the current file, imported types, and your conventions. AI rule: 'Cursor Tab suggestions are faster than chat-based generation for small additions (completing a function, adding an import, writing a variable declaration). Use Tab for small additions, chat (Cmd+L) for larger generations.'
Inline editing (Cmd+K): select code and press Cmd+K (or Ctrl+K) to edit it with AI. Describe the change: 'Refactor this to use async/await instead of .then()' or 'Add error handling following our Result pattern.' Cursor applies the change in-place, following your .cursorrules. AI rule: 'Cmd+K is the most efficient way to refactor existing code. Select the code, describe the desired change, and Cursor transforms it in-place. No copy-paste, no separate chat window.'
Chat with codebase context (Cmd+L): open the AI chat panel. Reference files with @filename. Cursor includes the referenced file's content in the AI's context. Prompt: '@user-service.ts Create a similar service for orders following the same pattern.' Cursor generates an order service that mirrors the user service's structure, following your .cursorrules. AI rule: 'Always reference existing files as examples when generating new code. @filename gives the AI a concrete pattern to follow — more effective than describing the pattern in words.'
Cursor indexes your project to understand file relationships, types, and imports. Before indexing completes: the AI cannot reference files you have not explicitly opened. It hallucates imports because it does not know what is available. After indexing: the AI knows every file, every exported type, and every function signature. The 1-5 minutes of indexing time: prevents hours of fixing hallucinated imports. Check the indexing status in the bottom-right status bar.
Step 4: Cursor Workflow Tips
Composer (multi-file generation): Cursor's Composer mode generates or edits multiple files in one operation. Open with Cmd+Shift+I (or Ctrl+Shift+I). Describe the feature: 'Create a new authentication module with: a NextAuth configuration file, a session provider component, a login page, and a middleware that protects /dashboard routes.' Composer generates all 4 files following your .cursorrules. Review each file before accepting.
Rules in .cursor/rules directory: for complex projects, Cursor supports a .cursor/rules/ directory with multiple rule files. Each file can target specific file types or directories. Example: .cursor/rules/frontend.md (React conventions), .cursor/rules/backend.md (API conventions), .cursor/rules/testing.md (test patterns). Cursor applies the relevant rules based on the context. AI rule: 'For projects with distinct frontend and backend conventions: use the rules directory to separate concerns. Cursor applies the right rules to the right files automatically.'
Cursor + Claude Code together: some teams use both tools. Claude Code (CLI): for terminal-based workflows, git operations, and project scaffolding. Cursor: for in-editor coding, inline editing, and autocomplete. Both read their respective rule files (.cursorrules for Cursor, CLAUDE.md for Claude Code). Keep both files in sync by maintaining one source of truth and copying to both locations. AI rule: 'If using both tools: maintain one canonical rule file and generate the tool-specific files from it. Drift between .cursorrules and CLAUDE.md: causes inconsistent AI behavior depending on which tool the developer uses.'
Copy code to the chat, describe the change, copy the result back: 4 steps. Select code, press Cmd+K, type 'use async/await instead of .then()', accept: 2 steps. Cmd+K applies the change in-place. No copy-paste. No chat window. The diff appears inline and you accept or reject. For refactoring existing code: Cmd+K is 3x faster than chat-based refactoring. Use chat for new code generation. Use Cmd+K for editing existing code.
Cursor Setup Summary
Complete Cursor AI setup checklist.
- Install: download from cursor.com. Import VS Code settings on first launch
- Model: Claude models for best rule-following. Switch per-conversation as needed
- Indexing: enable codebase indexing. Wait for completion before AI-assisted work
- .cursorrules: create in project root. Same content as CLAUDE.md. Verify with convention prompt
- Tab completion: for small additions. Context-aware, follows .cursorrules
- Cmd+K (inline edit): select code, describe change. Best for refactoring in-place
- Cmd+L (chat): reference files with @filename. Best for generating new code from existing patterns
- Composer: multi-file generation. Describe the feature, get all files at once