Back to Library
Project ContextIntermediate
Provide a Repo Map for Large Codebases
When your codebase is too large to paste, generate a file tree and include it as context so Claude understands your project structure.
repo-mapfile-treearchitecture
The Strategy
Without structural context, Claude defaults to generic patterns. A repo map grounds its suggestions in your actual conventions, making recommendations actionable and idiomatic.
prompt.txt
<context>
<repo_map>
src/
├── app/ # Next.js App Router pages
│ ├── api/ # Route handlers
│ ├── (auth)/ # Auth-related pages (grouped route)
│ └── dashboard/ # Dashboard feature
├── components/
│ ├── ui/ # Generic UI primitives
│ └── features/ # Feature-specific components
├── lib/
│ ├── db.ts # Prisma client singleton
│ └── auth.ts # NextAuth configuration
└── types/
└── index.ts # Shared TypeScript types
</repo_map>
</context>
<task>
Given this structure, where should I put a new
"NotificationService" class that sends emails?
</task>You might also need
Project ContextIntermediate
Feed Context Incrementally
For very large codebases, add files one by one per round-trip rather than dumping everything at once—this reduces noise and token waste.
context-managementincrementaltoken-efficiency
View snippet
Project ContextIntermediate
Reference Multiple Files in Context
Use named `<file>` tags to pass multiple files at once, making cross-file relationships explicit for Claude.
multi-filecontexttype-consistency
View snippet