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 asking Claude to scaffold a new feature, point it at your existing code first — it will match your naming, structure, error handling, and test patterns exactly rather than defaulting to framework boilerplate.
Give Claude the full picture upfront before it writes any code, so it builds the right thing the first time with fewer correction rounds.
Complex prompts are unreadable as escaped single-liners. Use shell HEREDOCs to write clean, structured prompts directly in your scripts.