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