Module 3: Working with ProjectsLesson 3 of 6
0%
Lesson 3ยท4 min

Adding Context to Your Project

Help Claude understand your existing code

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

Terminal
> 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:

Terminal
> @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:

markdown
# 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

Terminal
> 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.

Terminal
> /cost
Context used: 42,000 tokens (of 200,000)
โ–Œ

Warning

If you hit context limits, use /compact to summarize and continue.

Best Practices

  1. Start with CLAUDE.md - Always set up this file first
  2. Reference specific files - Don't say "look at my code", say "look at src/App.tsx"
  3. Share relevant docs - Include API docs, style guides, etc.
  4. Use clear names - Good file names = good context
  5. 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