Skip to content

Claude Code best practices: 9 habits that make it reliable

Claude Code best practices that make the biggest difference: a short CLAUDE.md, plan first, one task per session, checks it can run, tight permissions.

Short answer

The Claude Code best practices that matter most are about the setup, not the prompt: keep a short CLAUDE.md with what is always true, have Claude plan before it changes anything, run one task per session and clear in between, give it a way to check its own work, and set permissions so the risky actions need your approval. Then turn every repeated prompt into a skill or command, and every hard rule into a hook.

Key takeaways

  1. Most bad Claude Code output comes from missing context or a cluttered session, not from a weak model.
  2. Ask for a plan first on anything bigger than a small edit. Correcting a plan is cheaper than correcting finished work.
  3. One task per session. Use /clear when you switch, and keep what must survive in CLAUDE.md.
  4. Give Claude something to check its work against: a test, a build, a sample output or a screenshot.
  5. Write rules that must never be broken as hooks or permission rules, not as polite requests in CLAUDE.md.

Two people can use the same Claude Code, on the same model, and get completely different results. One gets clean work that holds up. The other gets confident answers that break on the first real input.

The difference is almost never the prompt. It is the setup around the session: what Claude knows when it starts, how big the task is, whether it can check itself, and what it is allowed to touch.

These are the nine habits I would teach anyone starting with Claude Code, whether you write software or run a business with it.

What are the most important Claude Code best practices?

The most important Claude Code best practices are a short CLAUDE.md, planning before changes, one task per session, a way for Claude to verify its work, and permissions that match the risk. Everything else builds on those five.

# Habit What it prevents
1 Keep CLAUDE.md short and true Claude guessing your conventions
2 Plan before it edits Big rewrites in the wrong direction
3 One task per session Old context leaking into new work
4 Give it a check it can run "Done" that is not actually done
5 Point at files, don't describe them Claude searching and guessing
6 Set permissions by risk Constant prompts, or none at all
7 Turn repeats into skills and commands Inconsistent output, retyped prompts
8 Enforce hard rules with hooks Rules lost midway through long tasks
9 Review the diff, not the summary Trusting a description of the work

Anthropic's own guide to Claude Code recommends a similar rhythm: explore, plan, code, commit. The habits below are how I put that into practice.

How should you set up CLAUDE.md?

Set up CLAUDE.md as a short list of facts that are always true for the project, and leave out anything Claude can read from the files itself. Run /init in a new folder to get a first version, then cut it down.

What belongs in it:

  • What the project is and who it is for, in two or three lines.
  • How to build, test and run it, as exact commands.
  • Conventions that differ from what Claude would assume.
  • What it must never do, like editing a generated folder.

What does not belong in it: long explanations, things that change weekly, and anything already obvious from the code. Every line loads into every session, so a bloated file costs context and buries the rules that count. When Claude makes the same mistake twice, add one line. When a line stops mattering, delete it. How the different memory files fit together is covered in this guide to CLAUDE.md and auto memory.

Why should Claude plan before it writes anything?

Claude should plan first because a wrong plan takes seconds to fix and a wrong implementation can take an hour to unpick. For anything that touches more than a couple of files, ask for a plan before a single edit.

  1. Ask Claude to read first. "Read the invoice module and the tests. Don't change anything yet."
  2. Ask for a plan. Press Shift+Tab to cycle into plan mode, or just say "propose a plan, no edits".
  3. Correct the plan. This is where your judgment adds the most. Cut scope, fix wrong assumptions.
  4. Let it execute, step by step, running the checks as it goes.
  5. Commit once the checks pass and you have read the diff.

For hard problems, asking Claude to think harder before it plans helps. For a typo fix, skip all of this. The skill is knowing which tasks are big enough to deserve a plan.

How do you keep a Claude Code session from going off track?

You keep a session on track by giving it one task and clearing it when that task is done. Context is Claude's working memory, and when it fills with three unrelated jobs, all three get worse.

My routine is simple. One task, one session. /clear when I switch. /compact with a short instruction when a long task is getting heavy. /context when Claude starts to feel slow or vague, to see what is taking up the room.

For work that needs a lot of reading, like searching a big codebase or a folder of documents, hand it to a subagent. It reads in its own context and sends back only the answer, so your main session stays clean. How and when to set one up is in my subagents walkthrough.

How can Claude check its own work?

Claude can check its own work when you give it something concrete to check against, and ask it to run that check before it reports back. Without a check, "done" just means Claude stopped typing.

Good checks, from strongest to weakest:

  • A test suite or a single test for the thing you are changing.
  • A build or type check that fails loudly.
  • A sample input with the expected output, for scripts and data work.
  • A screenshot or mockup, for anything visual.
  • A checklist in the prompt, for writing and documents.

This matters because AI output that looks right is the most expensive kind of wrong. In the Stack Overflow 2025 Developer Survey, 66% of developers named "AI solutions that are almost right, but not quite" as their biggest frustration, and more developers said they distrust the accuracy of AI tools (46%) than trust it (33%). A check Claude can run itself catches most of the "almost right" before you ever see it.

Which permissions should you give Claude Code?

Give Claude Code free access to what is safe and reversible, and keep approval on anything that deletes, sends, pays or deploys. Permissions are a dial, not a switch.

Allow without asking Ask every time Deny
Reading files, searching Editing config or settings Reading .env and key files
Running tests and builds Installing packages Force-pushing to main
git status, git diff Sending email or messages Deleting outside the project
Read-only MCP tools Write actions in business tools Production database writes

Use /permissions to see and edit the rules. Skipping permissions entirely only makes sense in a throwaway container with no credentials in it. On a machine that is connected to your inbox, your CRM or your bank, the prompts are the point. This is the same lesson as the "access far too wide" pattern I wrote about in five production failure patterns.

When should you use skills, commands and hooks?

Use a command or skill for any prompt you repeat, and a hook for any rule that must hold every single time. The rule of thumb I use: if I have typed it three times, it becomes a file.

  • Command: a saved prompt you start yourself, like a weekly report.
  • Skill: instructions Claude loads when a task matches, with templates or scripts attached.
  • Hook: a script that runs at a fixed moment, like formatting after every edit or blocking a dangerous command.

Hooks matter more than people expect. An instruction in CLAUDE.md is a request. A hook is enforced. Partway through a long task, Claude can lose track of a request, but a hook still runs. The hooks guide shows how to set one up in a few lines.

Do these habits apply if you don't write code?

Yes. Every habit here works the same when Claude Code runs business tasks instead of software. The check changes form, but the principle does not.

Say you use Claude Code to draft client proposals. CLAUDE.md holds your services and tone. You ask for an outline before the full draft. One proposal per session. The check is a short checklist: price matches the rate card, the client's name is spelled right, nothing promised that you don't offer. Sending stays behind your approval.

That is how I use it too. Claude Code handles a large part of my daily operations, from my task board to email drafts, and I review what goes out. The five jobs it handles for me are written up here.

Where should you start?

Start with the two habits that pay off on day one: a short CLAUDE.md and /clear between tasks. Add planning the first time Claude goes off in the wrong direction, and a check the first time "done" turns out not to be.

Then let the setup grow from real friction. A repeated prompt becomes a command. A rule Claude forgot becomes a hook. A permission prompt you clicked twenty times becomes an allow rule. After a few weeks you have a setup that does the routine work the same way every time, and you spend your attention on the decisions.

Frequently asked questions

What are the best practices for using Claude Code?

Keep a short CLAUDE.md with your project context, ask for a plan before any larger change, work on one task per session and use /clear in between, give Claude a test or check it can run itself, and limit permissions so risky actions need approval. Turn prompts you repeat into skills or commands, and enforce hard rules with hooks.

How long should a CLAUDE.md file be?

As short as you can make it while still covering what is always true: what the project is, how to build and test it, conventions that differ from the defaults, and what never to do. A few dozen lines is plenty for most projects. Everything in it is loaded into every session, so long files cost context and dilute the rules that matter.

Should I use plan mode in Claude Code?

Yes, for anything that touches more than one or two files or where you are not sure of the approach. Press Shift+Tab to cycle into plan mode, or simply ask Claude to read the relevant files and propose a plan without editing anything. Review the plan, correct it, then let Claude execute.

How do I stop Claude Code from making mistakes?

You will not stop all of them, so make them cheap to catch. Give Claude a command that tests its work, ask it to run that command before it says it is done, review diffs before you commit, and block dangerous actions with permission rules or a PreToolUse hook. Small tasks with clear checks fail less than large vague ones.

Is it safe to run Claude Code with all permissions skipped?

Only in a sandbox you can throw away, like a container without your credentials or production access. On your own machine or with access to real business tools, keep permission prompts on for anything that deletes, sends, pays or deploys, and allow the safe read and test commands so you are not clicking approve all day.

Robin van Veen

Robin van Veen is the founder of Arcgent. He helps companies become AI-native, process by process, and shares what he builds with AI agents and Claude Code in public.