Reference Multiple Files at Once with @ Mentions
Why describe files when you can just point at them? The @ syntax lets you reference multiple specific files in a single prompt, giving Claude exactly the context it needs — no guessing, no searching.
@src/auth/middleware.ts @src/auth/guards.ts "These two files are out of sync —
make them consistent and update the shared types"
Claude loads the full contents of each referenced file before responding, so it can reason across all of them simultaneously.
A few patterns that work well:
# Cross-file consistency
@routes/api.php @controllers/UserController.php
"Add input validation to all the user endpoints"
# Debugging across layers
@models/Order.php @services/OrderService.php @tests/OrderTest.php
"The test is failing — find the mismatch between the model and the service"
# API contract review
@openapi.yaml @src/handlers/payments.ts
"Check whether the implementation matches the OpenAPI spec"
You can use tab completion to fill in file paths quickly, so building a multi-file prompt doesn't mean typing out long paths from memory.
This is much more reliable than describing files by name in natural language and hoping Claude picks the right one — especially in larger codebases with similar file names.
Use @ references to give Claude a precise, narrow window into exactly the files that matter.
Log in to leave a comment.
Before jumping to implementation, describe the problem conversationally and let Claude be your thinking partner. It asks clarifying questions, surfaces tradeoffs you haven't considered, suggests approaches, and pokes holes in your plan — so by the time you say "ok, build it," both of you know exactly what to build and why.
Paste error messages with "why did this fail?" instead of "fix this" to get Claude to diagnose the root cause before applying a fix.
When you need Claude to make changes in one area without affecting another, add negative constraints — "fix the bug but don't change the public API", "refactor the internals but don't create new files", or "update the logic but don't modify any tests." Explicit exclusions prevent Claude from making well-intentioned changes you'll have to undo.