File References
Reference files and directories in your conversation to give Claude specific context about what you're working with.
What You Can Do
- Reference specific files for Claude to read and understand
- Include entire directories to provide project context
- Share multiple files in a single message
- Update context as you move between different parts of your codebase
How to Reference Files
Single File
bash
@src/auth.js
"Can you explain what this authentication module does?"Multiple Files
bash
@src/auth.js @src/middleware/auth.js @tests/auth.test.js
"Review these authentication files for security issues"Directories
bash
@src/components/
"Refactor these React components to use hooks"With Wildcards
bash
@src/**/*.test.js
"Run all test files and fix any failures"Common Patterns
Code Review
bash
@src/payment.js
"Review this payment processing code for best practices"Debugging
bash
@logs/error.log @src/api/endpoint.js
"This error appears in the logs. Can you find the issue?"Refactoring
bash
@src/utils/
"Refactor these utility functions to be more modular"Documentation
bash
@src/api/ @README.md
"Update the README with the new API endpoints"File Reference Tips
Be Specific
Instead of referencing entire directories when you only need one file, reference the specific file for faster context loading.
Use Tab Completion
Type @ and start typing a filename, then use Tab to autocomplete paths.
Combine with Commands
bash
@package.json
/compact focus on dependencies
"Which packages can we update safely?"Context Management
When working with large files or many files, Claude will automatically manage context. You can help by:
- Starting with the most relevant files
- Adding more context as needed
- Using
/clearif context gets cluttered
Related
- Slash Commands - Control your session with commands
- Scratchpads - Preserve context across sessions
- Context Management - Optimize your conversation efficiency