Skip to main content
    Kriv AI

    Claude Code

    Claude Code best practices: what to set up, and what to leave alone

    A plain guide for engineering leads. Every fact about Claude Code is taken from Anthropic's own best practices page as read on 6 November 2026. Product behaviour changes, so check the cited page before you rely on a setting.

    Anthropic's best practices page (read 6 November 2026) puts three habits first, in our summary: tell Claude what it cannot see in your code, give it a check that comes back pass or fail, and enforce rules that cannot have exceptions with hooks and deny rules instead of a note in CLAUDE.md. Its defaults already work well for a first plain prompt, so add setup only where your project needs it.

    plain answer

    What are the best practices for Claude Code?

    Anthropic's best practices page (read 6 November 2026) puts three habits first, in our summary: First, tell Claude what it cannot see in your code, such as the exact test commands, a deploy process or a decision made outside the repository. Second, give it a check that comes back pass or fail, so it can fix its own mistakes instead of you finding them. Third, for rules that cannot have exceptions, use settings that Claude Code enforces, such as hooks and deny rules, rather than a note in CLAUDE.md that Claude is allowed to weigh. Anthropic also says its defaults already work well for a first plain prompt, so add setup only where your project needs it.

    how to

    How should you write a CLAUDE.md file?

    Keep it short. Anthropic says Claude Code loads CLAUDE.md into every session, so every line takes a little of Claude's attention on every task, whether it is relevant or not. The page says the file works best when it holds only what Claude could not work out from the code itself:

    • How to confirm work in this repository: the exact test, typecheck and lint commands, and how to run a single test file.
    • Places where the code is misleading, such as an old pattern that new code must not copy.
    • Decisions that are not in the repository, such as how deploys work or what needs a migration review.
    • Anything you have had to correct twice already.

    how to

    How do you write a good prompt for Claude Code?

    Name the file, describe the symptom and say what "fixed" looks like. Anthropic's page sets "fix the login bug" against a prompt that says users report login fails after the session times out, points at token refresh in src/auth/, asks for a failing test first, then the fix. It also says that when you already have the thing Claude needs, such as a file, a screenshot or command output, you should hand it over instead of describing it. On scope, the page says Claude tends to read a request conservatively, so saying "be ambitious" and listing what you want, such as empty and error states, tells it how much you hoped for.

    how to

    How do you check Claude Code's work?

    Give it something it can run that returns pass or fail. Anthropic's page says Claude stops when the work looks done, so without a check you become the test suite. The check can be a test file, a build's exit code, a linter or a script that compares output with a fixture. The page lists four levels of strictness: ask in the prompt, set a goal with /goal, enforce it with a Stop hook, or have /code-review look at the diff in a fresh subagent. Whichever you pick, ask for evidence, meaning the command it ran and its output, not just a statement that all tests pass.

    how to

    Which rules should be enforced instead of written down?

    Anthropic's page splits instructions into two kinds. A prompt, CLAUDE.md or a skill is read by the model, which usually follows it but is not guaranteed to. A hook, a deny rule or a managed setting is applied by Claude Code every time, whatever the model decided. The page's advice is that if something has to happen every time, make it a hook, a deny rule or a managed setting, and keep CLAUDE.md for guidelines. Its examples of rules worth moving are never reading .env, always running the formatter after an edit, and not touching the migrations folder. It adds that deny rules hold in every permission mode.

    what kriv does

    What does Kriv AI do with Claude Code?

    Kriv AI runs hands-on Claude Code training for engineering teams, inside the team's own repositories. Our published example is the mSupply engagement: a four-week program for mSupply's engineering team, published with mSupply's permission, which produced role-specific starter kits and a knowledge base covering CLAUDE.md configuration, security and permissions. We do not rewrite Anthropic's guidance. We help a team decide which of these settings it needs, write them down, and have its own engineers own them afterwards. Pricing is scoped after a short discovery call, so this page quotes none.

    Straight answers

    Frequently asked questions about Claude Code best practices: what to set up, and what to leave alone

    What is a CLAUDE.md file?

    Anthropic describes CLAUDE.md as a file Claude Code loads into every session. Put in it only what Claude could not learn from the code, such as test commands and decisions made outside the repository (Anthropic best practices page, read 6 November 2026).

    Does Claude Code always follow what is in CLAUDE.md?

    No. Anthropic says an instruction written in a prompt, CLAUDE.md or a skill is read by the model, and there is no guarantee it will follow it. For rules that cannot have exceptions, Anthropic points to hooks, deny rules and managed settings (read 6 November 2026).

    What is a hook in Claude Code?

    A hook runs a script of yours at a fixed point in Claude's loop, such as before or after a tool call or when Claude tries to stop. Because Claude Code runs it, the result does not depend on what the model decided (Anthropic best practices page, read 6 November 2026).

    Do I need to set all of this up before I start?

    No. Anthropic says its defaults already work well for a first plain prompt in a fresh session, and that setup pays off where your project has knowledge, rules or constraints that Claude cannot see from the code (read 6 November 2026).

    Talk to the team that would do the work

    Bring your requirements to a working session with the person who'll actually deliver.

    Book a Discovery Call