Direct answer
The phrase Claude Code best practices means the habits that make Anthropic's coding agent produce work you can check. Three habits do most of it. Tell Claude what it cannot see in the repository. Give it a check it can run. Enforce the few rules that allow no exception with a hook or a deny rule.

Key takeaways
Published 11 November 2026. Written and reviewed by the Better Design team against Anthropic's current Claude Code documentation. Commands and defaults change between releases, so check the linked pages before relying on one.
- Write down only what Claude cannot find by reading the code.
- A check that returns pass or fail lets Claude finish the job without being watched.
- A line in CLAUDE.md is a guideline that Claude weighs. A hook or a deny rule is applied on each turn.
- Interface work needs two extra things: a design source to build from and a look at the rendered screen.
- Several older habits, such as writing IMPORTANT in capitals, no longer help.
How the ten Claude Code best practices fit together
Anthropic sorts every instruction into two kinds. Claude, the model, reads a prompt, a CLAUDE.md file or a skill and then decides what to do. Claude Code, the program around the model, runs a hook, a deny rule or a managed setting every time, whatever the model decided.
Most of the ten practices below follow from that split. The first three give the model better information. The next three give it a way to check its work and a limit it cannot cross. The last four keep a session cheap, parallel and safe to leave alone.
Tell, check, enforce
A reliable session gives Claude the facts, a check and a hard limit.

- Tell it the facts: Name the file, the symptom and what done looks like.
- Give it a check: A test, a build or a screenshot that Claude can read.
- Enforce the rules: Use a hook or a deny rule for anything with no exception.
1. Write a prompt that names the file, the symptom and the finish
Claude starts each task by reading the code. It already knows the file layout and the conventions. A prompt earns its place when it adds what the code does not hold. Name the file, describe the symptom, and say what fixed looks like.
Hand over the thing itself when it exists. Type @ and a path to include a file. Paste a screenshot of the design or the error. Pipe command output in from the shell.
users report login fails after the session times out.
look at token refresh in src/auth/, write a failing test
that reproduces it, then fix it2. Keep CLAUDE.md short
Claude Code loads CLAUDE.md into every session, so each line takes a little attention on every task. Keep the lines that the code cannot supply. Those are the exact test, typecheck and lint commands, and the places where the code misleads. Decisions a team made outside the repository belong there too.
Run /init to generate a first version, then delete lines. Anthropic's memory guide recommends staying under 200 lines. A rule that matters in one folder belongs in .claude/rules/ with a paths filter, so it loads only there.
# Commands
- Install: pnpm install
- Run one test file: pnpm vitest run path/to/file.test.ts
- Typecheck: pnpm tsc --noEmit
# Gotchas
- src/legacy/ is still live, but do not copy its patterns3. Let Claude interview you before an unclear change
An unfinished idea does not need a finished brief. Ask Claude to interview you until it could write the specification, and to save that as a file. It asks about the parts still open, such as limits, failure cases and what is out of scope.
Start a fresh session to build from the file. The build then begins with a clean context and a written definition of done, and a reviewer can be pointed at the same file later.
4. Give Claude a check it can run
Claude stops when the work looks done. Without something to run, looks done is all it has, and the person becomes the test suite. A check that returns pass or fail closes that loop: Claude changes the code, runs the check, reads the output and fixes what broke.
The check can be a test file, a build's exit code, a linter, or a browser screenshot beside the mockup. Ask for evidence each time: the command and its output, or the screenshot. The sentence all tests pass says very little on its own.
- In the prompt: run the auth tests after, and keep going until they pass.
- With /code-review: a fresh subagent reviews the diff without having seen the conversation.
- With /verify: Claude builds and runs the app and looks at the result.
5. Turn a rule with no exception into a hook
Claude follows a CLAUDE.md line nearly every time, and nearly is the point. For a rule that must hold on every turn, a hook runs a command at a fixed moment in the loop. A Stop hook that exits with code 2 sends Claude back to work until the command passes.
The set should stay small. A hook suits a rule with zero exceptions, such as a ban on editing the generated client. A preference with many exceptions, such as prefer named exports, stays in CLAUDE.md. Adding emphasis to a line that Claude keeps missing is a sign that the line belongs in a hook.
{
"hooks": {
"Stop": [
{ "hooks": [{ "type": "command", "command": "pnpm tsc --noEmit 1>&2 || exit 2" }] }
]
}
}6. Put hard limits in deny rules, and leave auto mode on
New terminal and VS Code sessions start in auto mode. Claude works without routine approvals, and a separate classifier reviews risky actions before they run. Manual approval of every command is safe but slow, and bypassPermissions only makes sense in a disposable container.
The classifier is a judgment, so it can be wrong. A deny rule is not a judgment. It holds in all permission modes, which makes it the right home for a ban on reading the environment file.
A Read deny rule stops the Read tool only. A script that Claude runs can still open the file. For that, turn on the sandbox and set allowUnsandboxedCommands to false, so Claude cannot retry a blocked command outside the sandbox.
{
"permissions": {
"ask": ["Bash(git push *)"],
"deny": ["Read(./.env)", "Read(./secrets/**)"]
},
"sandbox": {
"enabled": true,
"allowUnsandboxedCommands": false
}
}7. For interface work, give Claude a design source and look at the screen
Tests and a typecheck cannot tell whether a screen is clear. It needs a source to build from and a check on what rendered. Paste the mockup into the prompt, name the component to copy, and ask for a browser screenshot beside the mockup as evidence.
build the settings page from the mockup. be ambitious:
empty and error states, the save flow wired up, keyboard
navigation. then screenshot it next to the mockup8. Clear the session between unrelated tasks
Running out of context is now rare. Current models have a large window, and Claude Code compacts the conversation on its own. Cost is the reason to stay tidy. Every request sends the whole conversation, so three finished tasks ride along with the fourth.
Use /clear between unrelated tasks. Use /compact with a focus when the history still matters. Run /usage when a task costs more than expected, to see where the tokens went.
9. Watch the first minute, and restart after two failed corrections
Configuration does not replace watching how a task begins. Press Esc to stop Claude in the middle of an action and keep the work so far. Run /rewind to roll the code, the conversation or both back to an earlier prompt.
After two corrections of the same thing, a third mostly adds to a conversation that already holds two failures. Run /clear and write one new prompt that includes what the failures taught.
10. Give parallel and unattended work its own checkout and a cap
Separate pieces of work need separate checkouts, so their edits cannot collide. The command claude -w with a name starts a session in a new worktree. A worktree is a fresh checkout, so list the ignored files it needs in a .worktreeinclude file at the repository root.
Before a run goes unattended, answer five questions. Does it know what done looks like? Can it check its own work? What may it touch? What stops it? Who approves the result? For a scripted run, claude -p takes --max-turns and --max-budget-usd as the cap.
Old advice you can drop
Anthropic lists habits that were workarounds for older models. Three of them still appear in most lists of tips.
| Old habit | Why it no longer helps | Do this now |
|---|---|---|
Writing IMPORTANT or capitals in CLAUDE.md | Why it no longer helps Current models follow a plain line, and emphasis makes Claude over-apply the rule | Do this now Shorten the file, or move the rule into a hook |
Adding think hard to the prompt | Why it no longer helps Effort level is the control for how long Claude thinks | Do this now Use /effort, or ultrathink for one message |
Describing the architecture in CLAUDE.md | Why it no longer helps Claude reads the repository itself | Do this now Write down only what is not in the code |
A checklist of Claude Code best practices
Copy this list into the notes for a project and tick each line before a long task.
- The prompt names the file, the symptom and what done looks like.
- CLAUDE.md holds the test, typecheck and lint commands, and stays under 200 lines.
- Claude has one check to run, and it reports the command and the output.
- Each rule with no exception is a hook or a deny rule.
- Secrets are covered by a deny rule.
- Interface work has a mockup or a design system, and a screenshot as evidence.
- Unrelated tasks start after /clear.
- Parallel work runs in its own worktree.
- An unattended run has a cap on turns or spend, and a person approves the merge.
Steal this workflow
Run this guide in your own assistant. The prompt carries the guide link and the workflow summary, so the assistant can adapt it to your project.
Read the guide "Claude Code best practices: 10 habits that hold up" at https://better-design.com/blog/claude-code-best-practices and help me apply it to my project.
The phrase Claude Code best practices means the habits that make Anthropic's coding agent produce work you can check. Three habits do most of it. Tell Claude what it cannot see in the repository. Give it a check it can run. Enforce the few rules that allow no exception with a hook or a deny rule.
Start by asking what I am building and which tools I use. Then walk me through the workflow step by step, adapted to my answers.Claude and ChatGPT open with the prompt filled in. Gemini copies the prompt to your clipboard first, so paste it when the app opens.
Questions
What is the most important Claude Code best practice?
Give Claude a check it can run. With a test, a build or a screenshot that returns pass or fail, Claude can find and fix its own mistakes before it reports back.
How long should CLAUDE.md be?
Short. Anthropic's memory guide recommends staying under 200 lines. Keep the commands, the misleading places in the code and the decisions that are not in the repository.
Should a rule go in CLAUDE.md or in a hook?
A guideline with exceptions goes in CLAUDE.md, where Claude can judge whether it applies. A rule with no exception goes in a hook or a deny rule, which Claude Code applies every time.
Does writing think hard in a prompt still help?
Not much. Effort level controls how long Claude thinks, and /effort changes it. The word ultrathink still asks for deeper reasoning on a single message.
How do these practices change for interface work?
Add a design source and a visual check. Hand Claude a mockup or a design system to build from. Ask for a screenshot of the rendered screen, because tests cannot judge whether a screen is clear.
Sources
Anthropic's own documentation for Claude Code, read on 11 November 2026.
Related
Give Claude a design source for interface work
Better Design covers step 7. Its MCP server gives Claude Code a design system, interface principles, review rules and a comprehension check on the words of a screen. Claude calls them while it builds and fixes what they find before it reports back.