Multi-Root Setup
workspace/├── frontend/├── backend/├── shared/└── infrastructure/
Ta treść nie jest jeszcze dostępna w Twoim języku.
Working with codebases containing hundreds of thousands or millions of lines requires specialized strategies. These 15 tips will help you maintain productivity and accuracy when dealing with enterprise-scale projects.
Configure Cursor for optimal large codebase understanding:
{ "cursor.indexing.strategy": "smart", "cursor.indexing.includeProjectStructure": true, "cursor.indexing.priorityPatterns": [ "**/src/core/**", "**/src/api/**", "**/src/services/**" ], "cursor.indexing.merkleTree": { "enabled": true, "updateInterval": "3m", "maxDepth": 10 }}
Master the @codebase
symbol for intelligent searches:
// Find by functionality, not text"@codebase how is user authentication implemented""@codebase payment processing flow""@codebase error handling patterns"
// Understand system design"@codebase database connection pooling""@codebase caching strategies""@codebase API rate limiting implementation"
// Trace dependencies"@codebase what depends on UserService""@codebase Redis usage across the codebase""@codebase third-party API integrations"
Use chat to build mental models:
// Architecture overview"Create a high-level architecture diagram of our system based on@src analyzing the main components and their interactions"
// Dependency graph"Map out the dependency relationships between our core servicesin @src/services"
// Data flow analysis"Trace the data flow for a user registration request throughour entire system"
Optimize indexing with intelligent exclusions:
{ "cursor.indexing.exclude": { "patterns": [ "**/node_modules/**", "**/dist/**", "**/build/**", "**/.next/**", "**/coverage/**", "**/*.min.js", "**/*.bundle.js" ], "sizeThreshold": "10MB", "generatedFilePatterns": [ "**/*.generated.ts", "**/schema.graphql", "**/migrations/*.sql" ] }}
Guide AI focus with priority configurations:
{ "cursor.codebase.priorityFiles": [ { "pattern": "**/index.{ts,js}", "weight": 1.5, "reason": "Entry points" }, { "pattern": "**/routes/**", "weight": 1.3, "reason": "API definitions" }, { "pattern": "**/*.service.{ts,js}", "weight": 1.4, "reason": "Business logic" } ]}
Maintain performance with smart indexing:
Commands for index management:
Ctrl+Shift+P → "Cursor: Rebuild Index"Ctrl+Shift+P → "Cursor: Clear Index Cache"Ctrl+Shift+P → "Cursor: Show Indexing Status"
Work efficiently across multiple related repositories:
Multi-Root Setup
workspace/├── frontend/├── backend/├── shared/└── infrastructure/
Shared Context
Reference across repos:
@frontend/src/api/client.ts@backend/src/routes/user.ts
Navigate complex dependency chains:
// Trace usage"Show me all the places where UserRepository.findById is called,including indirect usage through other services"
// Impact analysis"If I change the signature of AuthService.validateToken,what files would be affected?"
// Circular dependency detection"Check for circular dependencies in @src/services"
Set up efficient navigation patterns:
{ "cursor.navigation.bookmarks": [ { "name": "API Routes", "pattern": "**/routes/**/*.ts" }, { "name": "Database Models", "pattern": "**/models/**/*.ts" }, { "name": "Test Files", "pattern": "**/*.{test,spec}.{ts,js}" } ]}
Layer different search approaches for comprehensive results:
// 1. Semantic search for concept"@codebase authentication middleware"
// 2. Grep for specific patterns"Search for: req.user across all routes"
// 3. Symbol search"@definitions AuthMiddleware"
// 1. Find all services"@codebase list all service classes"
// 2. Trace interactions"Show service-to-service communication"
// 3. Identify patterns"Common patterns in service implementations"
Limit search scope intelligently:
// Scope by directory"@folder:src/api search for rate limiting"
// Scope by file type"In all TypeScript files: find async functions without try-catch"
// Scope by recent changes"@recent-changes review error handling in modified files"
// Combine scopes"@folder:src/services @git:last-week find new database queries"
Use Agent for codebase-wide quality checks:
// Security scan"Scan the codebase for potential security vulnerabilities:- SQL injection risks- XSS vulnerabilities- Exposed secrets or API keys- Missing authentication checks"
// Performance audit"Identify performance bottlenecks:- N+1 query problems- Missing database indexes references- Synchronous operations that should be async- Large bundle imports"
// Technical debt assessment"Find areas of technical debt:- TODO/FIXME comments- Deprecated API usage- Code duplication- Complex functions (cyclomatic complexity > 10)"
Use AI to enforce architectural patterns:
Layer Validation
Ensure proper separation:
"Verify that controllers only call services,never repositories directly"
Pattern Enforcement
Check implementation patterns:
"Ensure all services follow ourstandard error handling pattern"
Dependency Rules
Validate dependencies:
"Check that domain layer doesn'tdepend on infrastructure layer"
Keep documentation synchronized with code:
// Component documentation"Generate a README for @src/services explaining:- Purpose of each service- Key methods and their usage- Dependencies and interactions- Configuration requirements"
// API documentation"Create OpenAPI documentation for all routes in @src/apibased on the actual implementation"
// Dependency visualization"Create a Mermaid diagram showing the relationshipsbetween all major components in our system"
Example output:
Refactor large codebases systematically:
Configure Cursor for large projects:
{ "cursor.performance.largeFiles": { "threshold": "1MB", "strategy": "stream", "maxInMemory": 50 }, "cursor.performance.maxOpenTabs": 20, "cursor.performance.gcInterval": "5m"}
Important Large codebases can quickly exceed context limits
Strategies:
Setup shared index:
# Generate shareable indexcursor index --export ./shared-index
# Import on team member's machinecursor index --import ./shared-index
Solutions:
Solutions:
Solutions:
With large codebase strategies mastered, explore Advanced Techniques to leverage expert-level features like custom MCP servers, advanced rules, and automation workflows.