Adding Context to Your Project
Claude works best when it understands your codebase. Here's how to give it context.
Automatic Context
Claude automatically reads:
- CLAUDE.md - Your project rules
- package.json - Dependencies and scripts
- File structure - Your folder organization
- Files you mention - When you reference specific files
Referencing Files
> Look at src/components/Header.tsx and update the navigation
Claude: I'll read Header.tsx...
[Reads the file]
I see the current navigation has Home, About, Contact.
What would you like me to add?
โ
โTip
Be specific about which files you want Claude to look at. It helps focus the context.
@-mentions
Use @ to reference files directly:
> @src/utils/api.ts add error handling to all fetch calls
> @components/Button.tsx make this match @components/Input.tsx styling
โ
Including Documentation
Add docs Claude should know about:
# CLAUDE.md
## Documentation
See these files for reference:
- docs/API.md - API endpoint documentation
- docs/STYLE_GUIDE.md - Component styling rules
- docs/DATABASE.md - Schema and relationships
Context for Third-Party Libraries
> I'm using the fair-work-compliance skill from Aussie Agent Skills.
> Check the rules at https://agentskill.com.au/skills/fair-work-compliance
Claude: I'll incorporate the Fair Work compliance rules...
โ
๐ฆ๐บAussie Note
Our Aussie Agent Skills include things like GST calculations, Super rules, and Fair Work compliance. Claude can use these as context! ๐ฆ
The Context Window
Claude has a "context window" - how much it can remember at once.
> /cost
Context used: 42,000 tokens (of 200,000)
โ
โ Warning
If you hit context limits, use /compact to summarize and continue.
Best Practices
- Start with CLAUDE.md - Always set up this file first
- Reference specific files - Don't say "look at my code", say "look at src/App.tsx"
- Share relevant docs - Include API docs, style guides, etc.
- Use clear names - Good file names = good context
- Keep folders organized - Structure helps Claude navigate
Key Takeaways
- CLAUDE.md is always in context
- Use @filename to reference specific files
- Include relevant documentation
- Watch your context usage with /cost
- Use /compact when context gets full