Claude Code Best Practices
From Anthropic's Applied AI team. The internal walkthrough on moving Claude Code from 20% utilization to 80%+. CLAUDE.md, planning prompts, the Escape key trick, multi-agent state sharing, and what most developers miss.
claude-best-ps.mp4 (180 MB) — locally stored, not hosted.
Cal joined Anthropic ~18 months before the talk to help start the Applied AI team — engineers whose mission is helping customers and partners build great products on top of Claude. He spends his day prompting Claude for the best outputs.
He became a Claude Code core contributor by accident: late 2025 he downloaded an internal tool over a weekend to build a side project, accidentally shot to the top of the internal token-usage leaderboard, and got pulled in. Now works on system prompts, tool descriptions, and evals for the team.
Claude Code is the coworker who does everything from the terminal. The whiz mentor you watched fly through bash and vim and walked away thinking "I should learn how to do that," who you never quite did. Having Claude Code installed is like having that mentor sitting next to you all the time.
Anthropic's design principle is "the simple thing that works." For Claude Code that means it is a "very pure agent."
What "agent" means at Anthropic
- Some instructions
- Some powerful tools
- Run in a loop until the model decides it's done
Tools
The same tools a terminal expert would use:
- File create + edit
- Terminal access
- MCP for pulling in external capabilities
Code-base understanding — no indexing
A coding agent built a year ago would have indexed the codebase, embedded files, and done RAG retrieval. Claude Code does none of that.
Instead it explores the codebase the way you would on a new team — through agentic search using the same primitives a human would: glob, grep, find. The model searches, looks at results, decides "I need to look at a few more things," does more searching, then synthesizes.
Claude Code's understanding of your codebase is built fresh each session, on demand, via the same tools you'd use. There's no stale embedding to maintain, no index to rebuild after a refactor.
Layers above the agent
- Lightweight UI — watch Claude work in real time
- Permission system — forces the human to butt in for dangerous actions
- Security focus — works via Anthropic API, AWS Bedrock, or Google Cloud Vertex AI
Discovery / Onboarding
New codebase? Try:
- "Where is this feature implemented?"
- "Look at this file and the git history. Tell me a story about how this code has changed over the past few weeks."
Thought partner — underrated
Don't just say "fix this bug." Say:
"I'm thinking about implementing this feature. Search around and figure out how we'd do it. Report back with two or three different options. Don't start writing files yet."
Claude uses agentic search, returns options, you validate, then you jump into implementation. This is the single biggest workflow change for most users.
Building
| Type | Example | Real value |
|---|---|---|
| Zero-to-one | "Build me a game" | Great demo, very gratifying |
| Existing codebases | The bread and butter | Claude Code team has unusually high test coverage because Claude makes adding tests trivial. Plus great PR messages — they let Claude write the commit + PR description. |
Headless / SDK
Claude Code SDK lets you "sprinkle a coding agent anywhere" — CI/CD pipelines, GitHub Actions, internal tooling.
Large code-base migrations
The team didn't predict this one. Customers said "we have this large code-base migration we've been putting off" — Java upgrades, PHP-to-React, etc. Claude Code makes month-long migrations digestible.
CLI tool wrapper
Because Claude is great at the terminal, it's great at every CLI tool: git, docker, bq, etc. Sticky rebase? Fire up Claude, describe the situation, "fix this for me."
5.1 Use CLAUDE.md files
Claude Code is an agent with no memory. The main way to share state across sessions and across your team is CLAUDE.md.
When Claude starts in a directory with a CLAUDE.md, the file loads into the prompt with: "Hey Claude, by the way, these are important instructions the developer left for you. Pay close attention."
Two locations:
- Project root — check it in, your team shares it
- Home directory — universal preferences across every project
What to put inside: how to run unit tests; high-level project layout (where tests live, what each module does); style guide; any context that makes Claude's life easier. Build it up over time.
5.2 Permission management
- Read actions (search, file read) — Claude proceeds freely
- Write / bash / state-changing actions — UI prompts: Yes once, yes always, or no?
Speed-up moves:
- Auto-accept mode — Shift+Tab toggles it. Claude works without prompting.
- Configure approved commands in settings — tired of approving
npm run test? Always approve it.
5.3 Integration setup — CLI tools beat MCP
If you use an application that has a CLI (gh for GitHub is the classic example), give Claude that CLI rather than installing an MCP server for it.
For well-known, well-documented CLI tools, prefer the CLI over MCP. MCP shines for less-common or proprietary integrations. For internal tools, document them in CLAUDE.md.
5.4 Context management
200k-token window. You can max it out. Two options when you see the warning:
/clear— start over, keeps CLAUDE.md and your working directory/compact— inserts a synthetic message asking Claude to summarize everything so another developer can pick up. That summary seeds the next session.
The team spends significant time tuning compact so you can max → compact → keep going without losing the thread.
5.5 Planning + todo lists
Plan-first prompt:
"I have this bug. Search around, figure out what's causing it, and tell me a plan how we're going to fix it."
You verify the plan before any code is written.
Watch the todo list. When Claude works on a big task it creates a todo list. If you see something weird in there, press Esc: "Let's change the todo list. I think you're on the wrong path."
5.6 Smart vibe coding
- Test-driven development
- Small changes + run tests + ensure pass
- Always check TypeScript types and linting
- Commit regularly — when it goes off the rails you can fall back
5.7 Screenshots for debug + build
Claude is multimodal. Paste screenshots directly. "Look at mock.png and build the website for me."
5.8 Multiple Claude instances — power user move
People at Anthropic run 4 Claude Code sessions at once. Tools to do this: tmux, multiple terminal tabs, multiple windows.
Cal does 2; he knows people who do 4. Try it.
5.9 Use Escape — the hidden productivity key
Esc once → stop and interject: "I think you're on the wrong path."
Esc twice → jump back in your conversation history. Reset, undo a tool expansion, restart from an earlier state.
Knowing when the right time to press Escape is — versus just letting Claude figure it out — is key to getting the most out of the tool.
5.10 MCP for tool expansion
When you've worked with Claude long enough that bash + built-in tools genuinely can't do something, then look at MCP servers. Don't reach for MCP first.
5.11 Headless automation
The team is most excited about this and still figuring it out. Claude Code in GitHub Actions is one example. Where else can you sprinkle a coding agent in your dev lifecycle?
5.12 Stay current
Cal can't even keep up. Public GitHub project: anthropic/claude-code. Read the changelog weekly.
Switching models on the fly
/model— see what's running, switch between Opus, Sonnet, Haiku/config— change in settings
Extended thinking between tool calls (Claude 4)
Previously Claude could "think hard" only at the start of a turn. Starting with Claude 4, the model thinks between tool calls — exactly when reasoning matters most.
You see thinking via lighter grey text. Try adding "think hard" to your prompt next time you're solving a tricky bug.
IDE integrations
VS Code + JetBrains plugins. Claude knows what file you're currently in, what's selected. Removes a layer of context-passing friction.
Multiple CLAUDE.md files in a project
Default: Claude reads only the CLAUDE.md in the working directory it was launched from. It does NOT auto-read CLAUDE.md files in subdirectories.
Why: Anthropic's monorepo. Launching Claude at the top would blow up context with every team's CLAUDE.md.
What does happen:
- When Claude searches into a subdirectory and finds a relevant
CLAUDE.mdthere, it's encouraged to read it - You can set one in your home directory
- Inside
CLAUDE.mdyou can reference other files with@filenamesyntax to compose
"My CLAUDE.md is being ignored"
A user complained their CLAUDE.md said "remove inline comments" but Claude refactored, kept comments, removed them when told, then immediately added them back.
Cal's diagnosis: this was a model problem, not a prompt problem. Claude 3.7 had a strong baked-in tendency to leave inline comments — the team had instructions in the system prompt fighting against it.
After upgrading to a new model, revisit your CLAUDE.md. Workarounds you added for old model quirks may be obsolete; you may want to add new things you wouldn't have trusted before.
Multi-agent state coordination
Q: "Can you make agents 2 and 3 use the context from agent 1, and agent 4 use the context from agent 2?"
Cal: the team is "trying to do the simple thing that works — one agent that's great at coding."
Today's pattern:
- Have your agents write state to a shared markdown file (e.g.,
ticket.md) - Fire up another Claude instance: "Read
ticket.md. Another developer left this note for you. This is what you're going to work on."
Lean on the model's ability to read files and make sense of them. The team may expose something more native later.
Stop treating Claude Code as an autocomplete tool. Start treating it as a junior engineer you are actively managing. Plan together. Review the approach. Watch the work. Redirect when needed. The gap between current and possible isn't talent. It's whether you press Enter or Escape at the right moment.
If you do nothing else after reading this:
- Add a
CLAUDE.mdto your active project. Include: how to run tests, project layout, style guide. Check it in. - Add a home-directory
CLAUDE.mdwith universal preferences. - Default to "search around, give me a plan, don't write code yet" before any non-trivial task.
- Practice using Escape — once to interject, twice to jump back.
- Try running 2 Claude Code instances at once. Even just a second tab.
- Configure auto-approval for the bash commands you always say yes to (
npm run test,git status, etc.). - Subscribe to the
anthropic/claude-codechangelog. Read it weekly. - When you upgrade to a new model, revisit your CLAUDE.md and remove obsolete workarounds.
This guide is the internal Anthropic perspective — what the team that builds Claude Code actually does. It complements:
- Karpathy 12-Rule CLAUDE.md — community-driven behavioral guardrails
- Stanford CS230 — academic foundations: prompting, RAG, fine-tuning, agents, evals
- Docs Anthropic public reference — canonical source