Large Project: A codebase with hundreds or thousands of files, multiple modules, team contributors, and complexity that exceeds what fits in a single context window.
Claude Code’s context window is large but not infinite. A 100K+ line codebase doesn’t fit. You need strategies to work effectively.
Phase 1: Project Onboarding
When you first encounter a large codebase:
Initial Exploration
1
2
3
4
5
6
7
8
Explore this codebase and provide:
1. High-level architecture (main modules and their purposes)
2. Tech stack (languages, frameworks, major dependencies)
3. Entry points (main files, server startup, CLI commands)
4. Database/data layer structure
5. Authentication and authorization patterns
6. Key configuration files
# Project: Enterprise SaaS Platform
## Architecture
- Monorepo with apps/ and packages/
- apps/web - Next.js frontend
- apps/api - Express backend
- packages/db - Prisma schema and client
- packages/auth - Shared auth utilities
## Key Files
- apps/web/app/layout.tsx - Root layout
- apps/api/src/index.ts - API entry
- packages/db/schema.prisma - Database schema
- .env.example - Environment variables
## Patterns
- API routes use middleware from packages/auth
- All DB access through packages/db
- Feature flags in packages/config
## Current Focus Areas
- User management module (apps/api/src/users/)
- Dashboard components (apps/web/components/dashboard/)
Reference this in sessions:
1
Read .claude/context.md for project context.
Phase 2: Focused Work Sessions
Define Scope Before Starting
Don’t let Claude wander the whole codebase:
1
2
3
4
5
6
Focus on the billing module:
- apps/api/src/billing/
- apps/web/app/(dashboard)/billing/
- packages/db/schema.prisma (Subscription and Invoice models)
Ignore other areas for this session.
Layer-by-Layer Exploration
For unfamiliar modules:
1
2
3
4
Step 1: Read the database models for billing
Step 2: Read the API routes for billing
Step 3: Read the frontend components for billing
Step 4: Explain the complete data flow from UI to database
Surgical Changes
Be specific about what to change:
1
2
3
4
5
6
7
In apps/api/src/billing/routes.ts:
- Add a new endpoint POST /billing/apply-coupon
- It should validate the coupon code
- Apply discount to the user's next invoice
- Return updated subscription details
Don't modify other files unless necessary.
Phase 3: Multi-File Operations
Coordinated Changes
When changes span multiple files:
1
2
3
4
5
6
7
I need to add a "subscription tier" concept:
1. First, add the database schema
2. Then, add the API endpoints
3. Finally, add the frontend components
Show me the plan before making changes.
Using Plan Mode for Large Changes
1
claude --plan
Then:
1
2
3
4
5
6
7
8
9
10
Add a notification system to the platform.
Requirements:
- In-app notifications stored in database
- Real-time updates via WebSocket
- Email digests for important notifications
- User preferences for notification types
- Integration with existing event system
Plan this thoroughly before implementation.
Review the plan, discuss alternatives, then execute.
Staged Execution
Don’t do everything at once:
1
Execute only stage 1 of the plan: database schema changes.
Test. Then:
1
Stage 1 is working. Execute stage 2: API endpoints.
Phase 4: Maintenance Workflows
Bug Investigation
1
2
3
4
5
6
7
8
Bug: Users are being charged twice for subscriptions.
Relevant areas:
- apps/api/src/billing/webhooks.ts
- packages/db queries related to subscriptions
- Stripe webhook handling
Investigate the root cause. Don't fix yet—explain what's happening.
Code Review
1
2
3
4
5
6
7
8
Review the changes in these files for issues:
- apps/api/src/billing/routes.ts
- apps/api/src/billing/services.ts
Focus on:
- Security vulnerabilities
- Error handling gaps
- Edge cases not covered
# Start narrow
Read apps/api/src/billing/routes.ts
# Expand based on what you see
What services does this use? Read those.
# Continue expanding
What database models are involved? Read the schema.
# Now you have context
Add the new endpoint for applying coupons.
The Checkpoint Pattern
1
2
3
4
5
6
Checkpoint: Current billing module is working.
Now make changes...
[If something breaks]
What changed since the checkpoint? List all modifications.
The Parallel Track Pattern
For independent features, run separate Claude Code sessions:
Terminal 1:
1
2
3
4
# Session 1: Billing feature
claude
Focus on apps/api/src/billing/
Add coupon support...
Terminal 2:
1
2
3
4
# Session 2: User management feature
claude
Focus on apps/api/src/users/
Add role management...
# Large generated files
*.min.js
*.bundle.js
# Dependencies
node_modules/
vendor/
# Build outputs
dist/
.next/
out/
# Large data files
*.sql
*.csv
fixtures/
# IDE files
.idea/
.vscode/settings.json
FAQ
How do I know if I'm exceeding context limits?
Claude Code warns when approaching limits. If suggestions become less coherent or Claude asks about files it should know, you’ve likely exceeded useful context. Start a fresh session with focused scope.
Should I use plan mode for everything?
No. Small changes don’t need plans. Use plan mode for: features touching 3+ files, architectural changes, refactoring, or anything where you’d normally write a design doc.
How do I handle database migrations in large projects?
Generate migrations with Claude, but review carefully. Test on a copy of production data. Never auto-apply migrations in production.
Can multiple developers use Claude Code on the same project?
Yes. Each developer’s session is independent. Share custom commands and context documents through git. Be careful with simultaneous changes to the same files.
Conclusion
Key Takeaways
Create a context document capturing project architecture
Focus sessions on specific modules or features
Use plan mode for changes spanning multiple files
Execute staged changes with testing between stages