Claude Code best practices have moved

The CLAUDE.md file in this blog's repository has a line in bold that begins Never. Another ends first, every time. Each line arrived the day after Claude Code did the wrong thing, and no line has been removed since. The model reading that file has been replaced several times.

This post is for engineers who use Claude Code daily and still approve most commands by hand. It follows Lydia Hallie's 17-minute talk, Rethinking Claude Code Best Practices. It applies each point to that repository.

Instructions written for an older model

Earlier models stopped early and needed reminders, so the advice was to write rules with emphasis: capitals, IMPORTANT, never. Hallie reports that current models read the codebase well enough that emphatic rules now cause harm. The model makes more tool calls and returns a worse result.

Her rule for the file is short: keep only the facts that Claude cannot see in the code. A legacy service that no source file references belongs there. The technology stack and the folder layout do not.

❌ Two lines from this blog's file fail that rule:

- `content/`: Contains all Markdown/reStructuredText articles and pages.
- `output/`: Generated HTML (do not manually edit this).

✅ Two facts pass it, because no file in the repository records them:

- `make github` takes 35 to 40 minutes. Run it in the background.
- The devserver and the deploy both write to `output/`. Stop the devserver first.

One command runs the same review across the whole configuration. Type it at the Claude Code prompt:

/doctor prompt-audit

It checks CLAUDE.md files and skills for outdated or conflicting instructions. Hallie recommends running it after each model change, to find the rules that the new model no longer needs.

Auto mode approves, deny rules guarantee

Auto mode runs a separate classifier on every action except reading and editing project files. It approves commands that it judges safe, such as running tests, and blocks the rest. The classifier takes its policy from plain English under autoMode.environment: which repositories, buckets and domains to trust. It reads that key from ~/.claude/settings.json, not from the project settings.

Hallie quotes an Anthropic study that compared the classifier with people. People caught about 14% of clearly dangerous commands. Auto mode blocked 89%. That leaves about 1 dangerous command in 10 that still runs.

A deny rule removes that risk for a specific action. Claude Code checks deny rules before the classifier, and a matching tool call never reaches the classifier.

{
  "permissions": {
    "deny": ["Read(./.env)", "Read(**/.env)"]
  }
}

Her test for choosing between a rule and the model is one question: if Claude gets this wrong once, can the result be taken back? Wrong code can be reverted. Discarded uncommitted changes and an API key printed into a transcript cannot.

Permissions stop at the tool call

A permission decides whether a tool call runs. It does not limit the files and hosts the command reaches once it is running. npm test passes every check, then executes dependency code that nobody reviewed. A compromised dependency can read .env or the SSH keys and send them to a remote server.

A sandbox moves the limit into the operating system. The /sandbox command enables it. Claude Code merges the Read deny rules into the sandbox, so the rule applies to the command and to every child process it starts. Unapproved hosts are unreachable. Reads stay open across most of the machine by default, so ~/.ssh needs its own entry in sandbox.filesystem.denyRead.

FSM diagram

The sandbox covers shell commands only. Hooks, MCP (Model Context Protocol) servers and Claude's own file tools still run on the laptop, beside everything stored there.

A cloud session leaves the secrets behind

A cloud session removes that remaining exposure. The product name is Claude Code on the web, and each session runs on a virtual machine that Anthropic hosts. The Pro, Max, Ultra, Team and Enterprise plans include it. A session counts against the same usage limits as local Claude Code, with no separate charge for the machine.

Start one at claude.ai/code, or from a terminal after pushing the branch:

claude --cloud "Move the auth module to the new API"

The machine holds a fresh clone of the GitHub remote, so .env and the SSH keys are absent. Network access starts limited to package registries and GitHub. An API key goes in the environment as a network secret, and a proxy attaches it after the request leaves the machine.

The cloud machine is disposable, but a pushed commit or a sent message is not. Auto mode and the deny rules still apply there. Commit the deny rules to the repository so that they travel with the clone.

Checks that return pass or fail

A person who approves every command has already seen every change. A session that runs for hours needs another source of that confidence. Hallie's answer is verification points: a test, a build or a screenshot, each returning pass or fail. Reviewing those points takes less time than reviewing the final diff.

A prompt can ask for those checks, but a prompt is a request, not a guarantee. A hook is a script that Claude Code runs at a fixed point, such as after each file edit or before the session finishes. One detail decides whether the hook has any effect: exit code 2 sends the error text back to Claude, and exit code 1 lets the action proceed. On PreToolUse, TaskCompleted and Stop, exit code 2 also blocks the action.

This blog has a rule that exists only as bold text in CLAUDE.md: never deploy while the devserver is running. A wrong deploy breaks every link on the live site, so the rule fails the take-it-back test. As a PreToolUse hook on the Bash tool, the rule becomes a script:

#!/bin/bash
# Block a deploy while the Pelican devserver is running.
command=$(jq -r '.tool_input.command')

if [[ "$command" == *"make github"* ]] && pgrep -f "pelican -lr" > /dev/null; then
    echo "Devserver is running. Stop it before deploying." >&2
    exit 2
fi
exit 0

A coordinator starts the sessions

Several cloud sessions can run in parallel, each on its own machine. CI (continuous integration) then becomes the one check that every session shares, because each session ends in a PR (pull request). With Auto-fix turned on for a PR, Claude reads a failed check and pushes a fix before a person looks.

Hallie's team sets review depth by risk:

  • Documentation and copy changes merge when the automated checks pass.
  • Ordinary product changes need 1 human reviewer.
  • Risky changes need 2 human reviewers.

Every PR also gets a Code Review pass first: several agents find problems in parallel and a verify step drops the false positives.

The next step removes the person who starts each session. Projects, in public beta, provides this. A coordinator conversation splits the work, starts a thread for each task and sends back any result that fails its checks. The coordinator needs a model that judges well. The threads need a model that builds well. The project settings hold the two models separately.

Where each old habit went

No practice from the start of the year has disappeared. Each one has moved from the person at the keyboard to the model, the harness or the environment.

Old habit New owner
Steer the session The model
Approve each command Auto mode
Restrict Claude Deny rules, sandbox, cloud session
Check the output Tests, hooks, CI
Start each session A Projects coordinator

Hallie's closing advice is to hand over one task far larger than usual and run it in the cloud. The point where that session stops and waits for a person is the next job to hand over.

social