7 Claude Code Tips I Learned the Hard Way
After using Claude Code for months and shipping thousands of lines of code with it, I've collected some hard-won lessons. Here are the tips I wish someone had told me on day one.
1. Start with a CLAUDE.md file
This is the single most impactful thing you can do. Create a CLAUDE.md file in your project root with:
- Project overview and architecture
- Key conventions (naming, file structure)
- Common commands (build, test, deploy)
- Things to avoid
Claude reads this file at the start of every session. It's like giving a new engineer a perfect onboarding doc.
2. Use /compact when context gets bloated
Long sessions eat up your context window. When responses slow down or Claude starts forgetting earlier context, run /compact to summarize the conversation and free up space.
Pro tip: Do this proactively after completing a major task, before starting the next one.
3. Be specific about what you DON'T want
Claude is helpful to a fault. It will add error handling, tests, types, and documentation you didn't ask for. If you want a minimal change, say so:
"Fix only this bug. Don't add error handling, don't refactor
surrounding code, don't add comments."
Constraints lead to better outputs.
4. Let Claude read before writing
Never ask Claude to modify code it hasn't seen. Always:
"Read src/auth/login.ts then fix the session timeout bug"
Claude is way better at editing code it just read than guessing based on file names.
5. Use the Task tool for exploration
When you need to understand a codebase or find something, use:
"Search the codebase to find where user authentication is handled"
Claude will spawn a sub-agent to explore thoroughly, rather than doing a shallow grep.
6. Commit incrementally
Don't let Claude make 20 changes before committing. After each logical unit of work:
"Commit this change"
Small commits make it easy to revert if something goes wrong. Claude writes good commit messages.
7. Tell Claude your constraints upfront
If you have requirements, state them at the start:
"I need a solution that works with React 17 (not 18),
doesn't add new dependencies, and follows our existing
patterns in src/components."
Claude will work within your constraints rather than suggesting the "ideal" solution that doesn't fit your situation.
Want 60+ more prompts like these?
We compiled 63+ battle-tested prompts for every workflow - free.
Get All 63+ PromptsBonus: The mental model shift
The biggest tip isn't tactical - it's mental. Stop thinking of Claude Code as autocomplete on steroids. Think of it as a junior developer who:
- Knows every API and framework (but not your codebase)
- Works incredibly fast
- Needs clear direction
- Benefits from feedback
Give it context, be specific about what you want, and review its work. That's the workflow that actually ships.