Context Design
What this lesson teaches
The quality of Claude's output depends heavily on the context you provide. This lesson covers what to include, what to skip, and how to use CLAUDE.md effectively.
What Is Context?
Context is everything Claude knows during a conversation:
- Files it has read
- Your previous messages
- Project configuration (CLAUDE.md)
- Tool outputs and command results
More context isn't always better. Too much can confuse Claude and waste tokens.
CLAUDE.md: Your Project Config
Create a CLAUDE.md file in your project root. Claude reads this automatically at the start of every session.
What to include:
- Project structure overview
- Tech stack and conventions
- Common commands (build, test, deploy)
- Important patterns or rules
Example:
# My Project
## Stack
- Next.js 14 with App Router
- TypeScript strict mode
- Prisma + PostgreSQL
## Commands
- `npm run dev` - Start development
- `npm test` - Run tests
- `npm run lint` - Check code style
## Conventions
- Use server components by default
- API routes in /app/api/
- Keep components under 100 lines
Keep it short: CLAUDE.md is loaded every session. Long files waste tokens on every request.
Effective Context Strategies
Be specific about what you need
Instead of "help with auth", say "add JWT validation to the /api/users endpoint".
Point to relevant files
Instead of letting Claude search, tell it: "The user model is in src/models/user.ts".
State constraints upfront
"Use only existing dependencies" or "Keep the current API structure".
Clear conversation when switching tasks
Old context from a different task can mislead Claude. Use /clear when starting fresh.
Common mistake: Dumping entire files when only a function matters. More context = more noise = worse results.
Key Takeaways
- Context quality matters more than quantity
- CLAUDE.md gives Claude project knowledge automatically
- Be specific about files, constraints, and goals
- Clear old context when switching tasks