The four Claude Code best practices
Anthropic's guide starts from the defaults: a plain prompt in a fresh session usually does the right thing. Setup pays off where your project has knowledge, rules or constraints Claude can't see from the code. When a session goes wrong, it is almost always one of these four:
| What went wrong | The practice | Where to start |
|---|---|---|
| Claude built something else, or rediscovers the same fact every session | Tell Claude what it can't see | Name the file, the symptom and what fixed looks like. Keep CLAUDE.md to what the code can't show, under 200 lines |
| Claude said it was done and it wasn't | Give Claude a check to run | Anything that comes back pass or fail: a test file, a build's exit code, a linter. Put the command in CLAUDE.md |
| It did what must never happen, or skipped a step that must always happen | Enforce the rules that can't have exceptions | Move the rule out of CLAUDE.md into a hook, a deny rule or a managed setting |
| It got it right, but cost too much time, too many tokens or too many prompts | Change a default | Run /usage to see where it went, set the level with /effort, and /clear between unrelated tasks |
