Back to Library
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
The Strategy
Named file tags let Claude track the origin of each piece of code, making cross-file analysis accurate. Without names, Claude loses track of which code came from where.
prompt.txt
<context>
<file name="types/User.ts">
export interface User {
id: string;
email: string;
role: "admin" | "user";
}
</file>
<file name="services/UserService.ts">
[File contents here]
</file>
<file name="routes/users.ts">
[File contents here]
</file>
</context>
<task>
Identify all places where the User type is used inconsistently
and suggest fixes.
</task>You might also need
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
View snippet
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