PRO Tips for Claude Code
The model is smart. What separates good results from chaos is how you run the session. These are the habits power users actually rely on: feed it the right context, make it plan, give it a way to check itself, and automate the rules you're tired of repeating.
Keep CLAUDE.md Lean and Specific
CLAUDE.md CLAUDE.md A Markdown file Claude Code reads at the start of every session: project context, commands, conventions, and rules. Put it at `./CLAUDE.md` (shared with the team), `~/.claude/CLAUDE.md` (personal, all projects), or `CLAUDE.local.md` (personal, gitignored). Run `/init` to generate a starter; AGENTS.md is read too. "Like a welcome packet for a new team member. It tells Claude everything it needs to know about your project."
Put in
- • How to run, test, lint, and build
- • Stack choices it would otherwise guess wrong
- • Rules it keeps breaking ("use proxy.ts, not middleware.ts")
- • Where the dangerous stuff lives
Leave out
- • Things it can read from the code itself
- • Long docs (link or import them instead)
- • Vague vibes ("write clean code")
- • Stale rules from three refactors ago
Split big rule sets into .claude/rules/*.md (they can be scoped to paths), pull in docs with @path/to/file imports, and keep personal notes in CLAUDE.local.md. Edit it all with /memory. The golden rule: when Claude makes the same mistake twice, the fix belongs in CLAUDE.md, not in another angry message.
Budget Your Context Like Money
The context window Context Window The amount of text an AI can 'see' at once, measured in tokens: your instructions, the conversation, files it read, and tool results. Current Claude models (Opus 5.5, Sonnet 5, Fable 5.1) offer 1M-token windows and Haiku 4.5 has 200K, but even huge windows work best when kept focused. "Like short-term memory. The bigger the window, the more the AI can remember from your conversation." Context Engineering Deliberately curating everything the model sees, not just the prompt: instructions files, retrieved docs, tool results, conversation history. Good context engineering keeps the context window small and relevant using CLAUDE.md, skills that load on demand, subagents for side quests, and compaction. "Like packing a carry-on for a trip. You can't bring the whole closet, so you choose exactly what the journey needs."
/context
See what's eating your window.
/clear
New task, new conversation. Every time.
/compact
Mid-task and heavy? Summarize, with focus text.
In a Claude Code session
/compact keep the failing test output and the list of files we changedAlso: ask a subagent Subagent A specialized AI agent Claude Code can delegate a task to. It works in its own separate context window with its own tools and instructions, then reports back a summary. Define one as a Markdown file in `.claude/agents/` (project) or `~/.claude/agents/` (personal) with `name` and `description` frontmatter; Explore, Plan, and general-purpose are built in. "Like hiring a specialist contractor for a specific part of a project. They work independently and report back when done."
Plan First, Then Build
For anything touching more than a couple of files, make Claude research and write a plan before it edits anything. You catch the bad idea while it's still a paragraph, not 400 changed lines.
In a Claude Code session
/plan add Google sign-in with Auth.js and protect the /dashboard routesOr press Shift+Tab until the status bar shows ⏸ plan mode on. Read the plan, push back, then approve. The opusplan model alias uses Opus while planning and Sonnet while executing. Full guide: Plan Mode.
Give Claude a Way to Check Its Own Work
The single biggest quality boost: a feedback loop. If Claude can run tests, a type check, or the dev server, it will catch its own mistakes before you do.
Prompts that close the loop:
- "Write a failing test first, then make it pass."
- "Run npx tsc --noEmit and fix every error before you say done."
- "Start the dev server and confirm /pricing renders without console errors."
Put the check commands in CLAUDE.md so you never have to type them again.
Run Parallel Sessions in Worktrees
Two Claude sessions editing the same folder will step on each other. A Git worktree Git Worktree A second (or third) working folder attached to the same Git repository, each checked out on its own branch. It lets several AI agents edit code in parallel without trampling each other's files. Claude Code can create one for you with `claude --worktree feature-auth`, and subagents can use `isolation: worktree`. "Like giving each contractor their own copy of the blueprints and their own room to work in, then merging the finished rooms."
Terminal (repo needs at least one commit)
# terminal 1
claude --worktree feature-auth
# terminal 2
claude --worktree fix-pricing-pageSession 1
Builds auth on its branch
Session 2
Fixes the pricing page
You
Review and merge each branch
Start with two. More sessions means more review work for you, and review is the real bottleneck. Patterns and pitfalls: Parallel Agents.
Automate the Non-Negotiables with Hooks
CLAUDE.md is a request. Hooks Hooks (Claude Code) Handlers that run automatically at specific moments in a Claude Code session, such as before a tool runs (PreToolUse), after it finishes (PostToolUse), when you submit a prompt, or when Claude stops. A hook can be a shell command, an HTTP call, an MCP tool, or a prompt, and can block risky actions. Configure them under the `hooks` key in settings.json or ship them in a plugin. "Like motion-sensor lights. When something happens (motion), an action triggers automatically (lights on)."
.claude/settings.json (formats every file Claude edits; needs jq and Prettier)
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
}
]
}
]
}
}Other favorites: block edits to .env files with a PreToolUse hook, or ping yourself on Notification when Claude needs input. More recipes: Hooks & Automation.
Know Your Escape Hatches
Esc
Stop Claude the moment it heads the wrong way. Redirect early; don't wait for it to finish a bad idea.
Esc Esc (rewind)
Jump back to an earlier point in the conversation and try a different direction.
Ctrl+O
Open the transcript viewer to see exactly which tools ran and what they returned.
git commit
Rewind is handy, but Git is your real safety net. Commit before every big change.
Dial the Effort, Not the Adjectives
You don't need to beg for "really careful thinking". Set it directly. Lower effort is faster and cheaper for simple edits; crank it up for gnarly bugs and architecture.
In a Claude Code session
/effort low # renaming, copy tweaks, small fixes
/effort high # tricky bugs, multi-file features
/effort auto # let Claude decideNeed one deep turn without changing the setting? Put ultrathink in your prompt. (On Opus 5.5 and Fable, thinking is always on; effort controls how deep it goes.)
Delegate to Subagents
Claude Code ships with built-in subagents, and it doesn't always reach for them on its own. Ask.
Explore
Read-only searching. "Use Explore to map all API routes."
Plan
Research that feeds a plan before edits.
general-purpose
Multi-step work that needs both reading and doing.
Build your own (a code reviewer, a migration checker) with the Agents & Skills guide.
Borrow Setups Instead of Building Them
A plugin Plugin (Claude Code) An installable bundle that adds skills, subagents, hooks, and MCP servers to Claude Code in one step. A plugin has a `.claude-plugin/plugin.json` manifest; its skills are invoked as `/plugin-name:skill-name`. Install with `/plugin install commit-commands@claude-plugins-official` or browse with `/plugin`. "Like an expansion pack for a game. One install, and you get new characters, levels, and items together."
In a Claude Code session
/plugin
/plugin install commit-commands@claude-plugins-officialOnly install plugins from sources you trust; they can run code on your machine. Guide: Claude Code Plugins.
Steer with Clear Feedback
Within a session, Claude adjusts to what you reward and what you reject. Be specific about both.
Confirm what worked
- "Yes, this error handling pattern. Use it in the other routes too."
- "Perfect, keep components this small."
Correct with specifics
- "You skipped the empty state. Add it and a test for it."
- "Don't mock the database here; use the dev branch."
Write your own prompts, too. You know the codebase and the goal; a clear two-line request from you beats a long generic prompt from anywhere else. More on this in Prompting.
Ready for the next level?
Master the context budget, then start running agents side by side.