# Rethinking Claude Code Best Practices — Lydia Hallie, Anthropic
<!--
ref: @content/youtube/aie/2026-11-11-rethinking-claude-code-best-practices-lydia-hallie-anthropic
version: 1
updated_at: 2026-11-15T13:13:29.222Z
-->

**[Watch on YouTube](https://www.youtube.com/watch?v=vlfCjWuv4es)**


*Synthesized from Lydia Hallie's talk on AI Engineer, 2026-11-11.*

Lydia Hallie works on the Claude Code team at Anthropic. She re-recorded this talk at home after technical problems during the live session, and there is no host.

## Core Thesis
Lydia Hallie argues that the early-2026 best practices for Claude Code assumed a human in the loop: correcting the model, approving each command and starting each session. Models like Opus 5.5 and Fable can now run for hours, so each of those human jobs has to move to the model, the tooling or the environment. She says safety should be enforced by the system through deny rules, sandboxing and cloud sessions. Correctness should come from checks that return a pass or fail, such as tests, hooks and CI. In her view the developer's job shrinks to starting the first session and reviewing what comes out.

## Key Insights
- **The shift in how sessions run.** Early in 2026, with Opus 4.5, sessions stopped sooner and needed constant correction. People filled CLAUDE.md with "IMPORTANT" and exclamation marks, and either approved every command by hand or used dangerously-skip-permissions. At Anthropic today, engineers run dozens of sessions at once. Those sessions run for hours, check their own work, and some sessions coordinate others. Engineers now act more like managers than operators.
- **Output numbers.** An Anthropic blog post from October reported changes going from about **2,500 per day in May to more than 30,000 in September**.
- **Every task a human stops doing has to be picked up by something else:** the model, the tooling or the environment.
- **CLAUDE.md should be much shorter now.** Emphatic instructions ("IMPORTANT", "never do this!") can now send the model off track, leading to more tool calls and worse results. Keep only what Claude cannot see in the code, such as a service that depends on a legacy source the code never references directly. Drop the stack description and "where to look" hints. The **"doctor prompt audit"** command checks your CLAUDE.md and skills against the current model (for example Opus 5.5) and flags what it no longer needs.
- **How auto mode works.** Auto mode became the default in **August**. A separate classifier reviews almost every action other than reading or editing files in your project. It allows commands it judges safe, such as running tests or installing dependencies, and blocks the ones it isn't sure about. By default it trusts only the current folder and repo, so a push to a separate deployment repo gets blocked and puts you back in the loop. You can configure it in plain language: list trusted repos, buckets and domains, plus things it should always allow or never do. That text goes straight to the classifier.
- **Safety first, verification second.** In an Anthropic study published in August, only about **14% of humans** noticed a clearly dangerous command, while auto mode blocked **89%** of them. About **one in ten** still got through, so any real guarantee has to come from the system.
- **Deny rules come before the classifier.** If a tool call matches a deny rule, Claude Code rejects it before the auto-mode classifier sees it. Hallie's test for what needs a rule is whether you can undo the mistake. Bad code can be rolled back, so the model can be trusted there. Deleting uncommitted changes or reading a leaked secret can't be undone, so those need deny rules. For example, auto mode treats reading `.env` as normal, but a deny rule blocks it, including via `cat`.
- **Permissions can't control what a command does once it runs.** `npm test` looks harmless, but it executes dependency code you didn't write, and Claude may run quick scripts of its own. A compromised script could read `.env` or your SSH keys and send them to an unknown server. A human approving each step would also click "allow" here. You don't want to block tests, because they are how Claude checks its own work, so the answer is to limit the environment.
- **Local sandbox.** With sandboxing on, you choose which files a command can read, which folders it can write to and which hosts it can reach. The operating system enforces this for the command and every child process, and the same deny rule is passed down to the OS. By default the sandbox can still read most files on the machine, so add a separate rule for SSH keys. Unapproved hosts are blocked. The sandbox covers only shell commands and what they start. Claude's own files, MCP servers and hooks still run outside it.
- **Cloud sessions remove local exposure.** Each session gets its own machine with a fresh copy of the repo and keeps running when your laptop is closed. Files outside Git, such as `.env`, SSH keys and your GitHub token, simply aren't there. API keys can be added as **network secrets**, which the session can use without the model ever seeing them. Network access is limited by default to resources like package registries and GitHub, and other domains must be added explicitly. The machine is temporary, but anything it sends out (commits, messages through connectors) is not. Hallie therefore still uses auto mode with deny rules committed to the repo, which blocks things like force pushes and secrets in commits.
- **Verification through checkpoints.** One request can be carried out in several reasonable ways that are all wrong. Her example is an auth migration: one run leaves the old API in place, another migrates only new logins, a third logs everyone out. Any pass/fail check works as a checkpoint (tests, a build, screenshots), and checking those is much faster than reading the whole diff at the end.
- **Hooks give guarantees that prompts can't.** You can run the linter on every file edit, run tests for the changed area when a task is marked done (touching auth code means the auth tests must pass), and run the full suite when the session tries to finish. **A test failure usually exits with code 1, and Claude Code still treats the task as complete. Hook scripts need to exit with code 2** to make Claude go back and fix the problem.
- **Running sessions in parallel.** Because each cloud session has its own machine, sessions don't share a folder and you no longer need to manage worktrees.
- **CI is the most important control.** Every session ends in a PR, and CI applies the same checks no matter how the session was set up. With **CI auto-fix**, Claude sees failing checks and goes back to fix them. With GitHub's **"merge when ready"** (auto-merge), the PR merges once every check passes.
- **Review depth depends on risk.** At Anthropic, every PR is first reviewed by a separate Claude instance, not the session that wrote it. That reviewer starts with fresh context, and a separate group of agents re-checks each bug it finds. Docs and copy changes need no human review once checks pass. Ordinary product changes get one human reviewer, and risky changes get two.
- **Orchestration.** In **Claude Code projects (in beta)**, you talk to a single main session. It breaks the work into tasks, starts a new session for each, tracks results, and sends back anything that is incomplete or fails verification. The orchestrator doesn't write code. Hallie suggests a model that is good at judging and deciding, like Fable, for the orchestrator, and a strong executor like Opus 5.5 for the worker sessions. Both are configured separately. Context compaction and clearing are handled automatically.
- **The old best practices are still there, in different places.** The model drives the work, auto mode handles approvals within your deny rules, the environment limits what is possible, and tests, hooks and CI check the results.

## Actionable Takeaways
1. **Update the defaults.** Move from Opus 4.5 to Opus 5.5 and from manual permissions to auto mode.
2. **Run "doctor prompt audit"** against your current model, then cut CLAUDE.md down to what the code can't show. Remove "IMPORTANT" and exclamation-mark instructions.
3. **If you still approve many commands, configure auto mode in plain language.** List trusted repos, buckets and domains (for example a separate deployment repo), plus always-allow and never-do rules.
4. **Add deny rules for anything you can't undo:** reading `.env` and other secrets, deleting uncommitted work, force pushes, secrets in commits. Commit these rules to the repo.
5. **Turn on the sandbox for local runs.** Restrict reads, writes and network hosts, and add an explicit rule for SSH keys, since by default the sandbox can still read most files.
6. **Move long tasks to cloud sessions.** Add needed API keys as network secrets, explicitly allowlist any domains beyond package registries and GitHub, and write a setup script.
7. **Give every task pass/fail checkpoints.** In the prompt, describe the end result, ask Claude to split the work into subtasks with their own tests, and ask it to show actual output.
8. **Use hooks where a check must happen:** lint on each file edit, scoped tests when a task is marked done, the full suite when the session ends. **Make hook scripts exit with code 2 on failure, not 1.**
9. **Make CI catch what matters to you.** Turn on CI auto-fix and, for low-risk changes, GitHub's merge-when-ready.
10. **Set review depth by risk.** Have a separate Claude instance review every PR. Docs and copy changes need no human review, normal product changes need one reviewer, and risky ones need two.
11. **Try an orchestrator setup** (Claude Code projects, beta) with Fable as the orchestrator and Opus 5.5 for the worker sessions.
12. **To start,** pick one task much larger than you would normally hand to Claude. Run it in the cloud and watch where sessions stall or still need you; that is the next thing to automate.

## Notable Quotes
> "Today, your Claude MD file should only contain what Claude can't see directly in your code." — Lydia Hallie

> "So if you need a guarantee, you can only provide it within the system." — Lydia Hallie

> "Permissions only determine whether a tool call is run, but they cannot restrict its access while it is running." — Lydia Hallie

> "So make sure your scripts exit with code 2, because that's what makes Claude go back and fix the error." — Lydia Hallie

> "So instead of talking to eight sessions, you talk to just one." — Lydia Hallie

> "We are only here to launch the first session and review the result." — Lydia Hallie

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*