Home / Knowledge work / Using AI at work
Claude Code best practices
The habits that get the most out of Claude Code today: tell it what it cannot see, give it a check to run, enforce hard rules with hooks, and steer early.
Beginner · 7 min read · Updated December 3, 2026
Claude Code is Anthropic's coding agent. It reads your project, edits files and runs commands in your terminal, your editor or the desktop app. Its defaults already handle most plain requests well: new terminal sessions start in auto mode, where a separate model reviews each action and blocks risky ones, Claude hands side work to subagents on its own, and long conversations are compacted automatically before the context fills up.
So the best practices today are not tricks for getting a model to behave. They cover the things no default can know about your project. This lesson follows Anthropic's own best-practices guide and puts it in plain steps.
Tell Claude what it can't see
Claude reads your code, so it already knows your folder layout and your frameworks. What it can't read is the knowledge in people's heads: the exact command that runs one test, the decision your team made last month, the folder that looks dead but is still live.
- Keep a short
CLAUDE.md. Write down the test, typecheck and lint commands, your team's conventions and the misleading corners of the code. Aim for under 200 lines. Leave out what Claude can see in the repo. Our CLAUDE.md guide shows how. - Scope rules that only matter in one place. Put them in
.claude/rules/with apathsfilter so they load only when Claude works on matching files. - Put long procedures in skills. A release checklist or a deploy routine fits better in a skill, which Claude reads only when the task calls for it.
- Write a specific prompt. Name the file, describe the symptom and say what "fixed" looks like. If you have the error message or a screenshot, paste it in.
Give Claude a check to run
Claude says a task is done when it believes it is done. A check that comes back pass or fail lets it find and fix its own mistakes instead of stopping when the work only looks right.
- Tell it which test, build or linter proves the change works, and ask it to run it.
- Ask for the command it ran and the end of the output as evidence, not just a summary.
- For a bigger feature, ask a subagent to review the change against your written spec before you merge.
Enforce the rules that can't have exceptions
A line in CLAUDE.md works most of the time. For "always" and "never", most of the time is not enough.
- Hooks are shell commands Claude Code runs at fixed points, such as before every tool call or when Claude finishes. A hook can format code after each edit or block a dangerous command, whatever the model decides.
- Permission rules and the sandbox limit which files Claude can read and which commands it can run.
- Permission modes set how much Claude does without asking. Press
Shift+Tabto cycle through Manual, Accept edits and Plan, plus Auto when it is available.
Steer early
Watch the first minute of a task. Press Esc the moment Claude drifts: it stops right away and keeps the work so far. Run /rewind to roll the code or the conversation back to an earlier point. After two failed corrections, run /clear and write one better prompt instead of a third correction, because a conversation full of failed attempts keeps pulling Claude back toward them.
Drop the old workarounds
Older models needed tricks that now do more harm than good:
- ALL CAPS and IMPORTANT make Claude over-apply a rule. If a line keeps getting missed, the file is too long or the rule needs a hook.
- "Think harder" is ordinary text. Effort is the real control, and
ultrathinkstill asks for deeper reasoning on a single turn. - "Keep going, don't be lazy" tends to cause extra work. A check to pass works better.
- Describing your whole architecture in
CLAUDE.mdwastes context. Claude reads the repo itself.
Practice
- Run
/initin a real project, then cut the result down to the lines Claude couldn't work out alone. - Give Claude a small bug with a "done means" line that names a test command.
- Press
Esconce mid-task and redirect it, so the habit is there when you need it. - Run
/usageat the end of the day to see how much of your plan the session used.