Set Up Cursor for Full Codebase Chat
Use Cursor's codebase index to ask questions and make changes across your entire repo.
Prerequisites
- Cursor installed (cursor.com)
- A Git repository
- OpenAI, Anthropic, or Ollama API key
Step 1: Open your project
Open your repo in Cursor. It starts indexing automatically. For large repos, let it finish (check the status bar).
Step 2: Configure your model
Go to Settings → Models. Choose GPT-4, Claude 3.5 Sonnet, or a local Ollama model. Claude 3.5 is recommended for code understanding and multi-file edits.
Step 3: Use Cmd+L for codebase chat
Open the chat with Cmd+L. Type @codebase to give the model full repo context. Ask: "How does authentication work?" or "Where is the user discount logic?" The model answers with file references.
Step 4: Use Cmd+K for inline edits
Select a function or block. Press Cmd+K. Describe the change: "Refactor this to use async/await" or "Add input validation for null and empty string." Review the diff. Accept with Tab or reject.
Step 5: Multi-file edits with Agent
For larger changes, use Cursor Agent (Ctrl+Shift+I). Describe the task: "Add rate limiting middleware to all API routes." The agent reads relevant files, proposes changes across multiple files, and shows a unified diff. Review and accept.
Step 6: Add .cursorrules
Create a .cursorrules file in your repo root. Add project-specific rules: naming conventions, preferred patterns, libraries to use or avoid. Cursor reads this file and follows the rules in all suggestions.
Discussion
Sign in to comment. Your account must be at least 1 day old.