Working with Large Codebases
Strategies for using Cursor effectively with enterprise-scale repositories.
Overview
Large codebases present unique challenges:
- Indexing takes longer
- Context windows fill quickly
- Finding relevant code is harder
- Performance can suffer
This guide covers techniques to work efficiently at scale.
Indexing Strategy
Configure .cursorignore
Exclude non-essential directories:
# Dependencies
node_modules/
vendor/
.venv/
packages/*/node_modules/
# Build outputs
dist/
build/
out/
target/
*.bundle.js
# Generated files
generated/
.next/
coverage/
# Large assets
*.zip
*.tar.gz
*.mp4
media/Use .cursorindexingignore
Keep files accessible but not indexed:
# Don't index but allow access
docs/
examples/
scripts/Monitor Indexing Status
- Open Cursor Settings
- Go to Features > Codebase Indexing
- Check indexing progress
- Reindex if needed
Context Management
Be Selective with @ Mentions
Instead of @Codebase, use specific references:
# Good - specific
@src/auth/AuthService.ts how does login work?
# Less efficient - broad
@Codebase how does authentication work?Use Folder References
Reference directories for scoped context:
@src/components/ What button variants do we have?Leverage @Recent Changes
Focus on active work:
@Recent Changes summarize what's been changed todayProject Organization
Create Focused Rules
Split rules by domain:
.cursor/rules/
auth/RULE.md # Authentication patterns
database/RULE.md # Database conventions
api/RULE.md # API design patterns
frontend/RULE.md # UI component rulesUse Rule Globs
Apply rules to specific file types:
---
description: Database access patterns
globs: ["**/repositories/**", "**/models/**"]
---
- Use the Repository pattern
- Never raw SQL in controllers
- Always use transactions for writesPerformance Optimization
Split Large Files
Break up files over 500 lines:
- Extract components
- Separate utilities
- Use module pattern
Use Workspaces
For monorepos, open specific packages:
# Instead of opening root
cursor packages/web-app
# Or use workspace file
cursor workspace.code-workspaceClose Unused Tabs
Each open file consumes memory:
- Close files not actively editing
- Use Cmd+W to close
- Use Cmd+K Cmd+W to close all
Search Strategies
Use Semantic Search
For conceptual questions:
@Codebase how do we handle rate limiting?Use Exact Search
For specific code:
Find all usages of AuthService.login()Combine Approaches
@Codebase @src/auth/ explain the authentication flow
and show where tokens are validatedMonorepo Tips
Package-Specific Rules
Create rules per package:
packages/
web/
.cursor/rules/RULE.md # Web-specific
api/
.cursor/rules/RULE.md # API-specific
shared/
.cursor/rules/RULE.md # Shared lib rulesCross-Package References
Reference related packages:
Using patterns from @packages/shared, create a new
utility in @packages/apiDependency Awareness
Include package.json for context:
@package.json @packages/web/package.json
What versions of React are we using?Team Collaboration
Share Ignore Patterns
Commit .cursorignore to version control:
git add .cursorignore
git commit -m "Add Cursor ignore patterns"Standardize Rules
Use Team Rules for organization-wide patterns:
- Dashboard > Team Content > Rules
- Enforce critical standards
- Make optional ones opt-in
Document Conventions
Create an AGENTS.md in root:
# Project Guidelines
## Code Style
- TypeScript for all new code
- Functional components in React
## Architecture
- Follow repository pattern
- Services in /services directoryDebugging at Scale
Narrow the Scope
Debug the payment processing error in
@src/payments/ - focus on webhook handlingUse Git Context
@Git what changed in the auth module recently?Reference Logs
Here's the error log:
[paste log]
Find the source in @src/Recommended Settings
For Large Projects
| Setting | Recommendation |
|---|---|
| Indexing | Enable, use ignore files |
| Model | Claude Sonnet for balance |
| Context | Use specific @ mentions |
| Rules | Split by domain |
Codebase Indexing Settings
- Cursor Settings > Features > Codebase Indexing
- Enable smart indexing
- Set appropriate file limits
- Monitor memory usage
Common Issues
| Problem | Solution |
|---|---|
| Slow indexing | Add more to .cursorignore |
| Context too large | Use specific @ mentions |
| Memory issues | Close tabs, restart Cursor |
| Stale results | Reindex codebase |
| Wrong suggestions | Add domain-specific rules |