The Complete Claude Code Guide: 50 Practical Tips That Actually Work
If you’ve been using Claude Code long enough to know it works, you’re probably ready to dig deeper. Not the basics—the real techniques that separate occasional users from those who get remarkable results day after day.
This guide brings together insights from Anthropic’s official documentation, Boris Cherny (the person who built Claude Code), community experiences, and a full year of my own daily use. Whether you started last week or you’ve been at it for months, these tips will change how you work.
Getting Started: Foundation Tips for Daily Use
1. Create the cc Alias and Save Yourself Typing
This is how every single one of my Claude Code sessions begins. Add this line to your ~/.zshrc file (or ~/.bashrc if you’re using Bash):
alias cc='claude --dangerously-skip-permissions'
Run source ~/.zshrc to load it. Now you just type cc instead of claude, and you never see another permission prompt. That flag name is intentionally alarming—only use it after you truly understand what Claude Code can and will do to your codebase. Once you’re comfortable, it’s a massive time-saver.
2. Use ! to Run Bash Commands Without Leaving Claude
Type !git status or !npm test and the command executes immediately. The command and its output land right in Claude’s context, so it can see the result and act on it. This is much faster than asking Claude to run the command and waiting for it to figure out the syntax.
3. Stop Claude Mid-Action with Esc. Rewind with Esc+Esc.
Press Esc once and Claude stops whatever it’s doing—no lost context, you can immediately redirect.
Press Esc twice quickly (or type /rewind) and you get a scrollable menu showing every checkpoint Claude has created. You can restore just the code, just the conversation, or both. Saying “undo that” works too. Four restore options: code and conversation together, conversation only, code only, or summarize from a checkpoint forward.
This means you can try approaches you’re only 40% sure about. If it works, great. If not, rewind. Zero damage. One thing to know: checkpoints only track file edits. Changes from bash commands—like migrations or database operations—aren’t captured.
Want to pick up where you left off? claude --continue resumes your most recent conversation. claude --resume opens a session picker.
4. Give Claude a Way to Check Its Own Work
Create a feedback loop so Claude catches its own mistakes. Include test commands, linter checks, or expected outputs in your prompt:
Refactor the auth middleware to use JWT instead of session tokens.
Run the existing test suite after making changes.
Fix any failures before calling it done.
Claude runs the tests, sees failures, and fixes them without you stepping in. For UI changes, set up the Playwright MCP server—Claude can open a browser, interact with the page, and verify the UI works as expected. That feedback loop catches issues unit tests miss.
5. Install a Code Intelligence Plugin for Your Language
Language Server Protocol plugins give Claude automatic diagnostics after every file edit. Type errors, unused imports, missing return types—Claude sees and fixes issues before you even notice them. This is the single highest-impact plugin you can install.
Pick yours and run the install command:
/plugin install typescript-lsp@claude-plugins-official
/plugin install pyright-lsp@claude-plugins-official
/plugin install rust-analyzer-lsp@claude-plugins-official
/plugin install gopls-lsp@claude-plugins-official
Plugins for C#, Java, Kotlin, Swift, PHP, Lua, and C/C++ are also available. Run /plugin and go to the Discover tab to browse the full list. You’ll need the corresponding language server binary installed on your system—the plugin will tell you if it’s missing.
6. Use the gh CLI and Teach Claude Any CLI Tool
The GitHub CLI handles PRs, issues, and comments without needing a separate MCP server. CLI tools are actually more context-efficient than MCP servers because they don’t load tool schemas into your context window. Same applies to jq, curl, and other standard CLI tools.
For tools Claude doesn’t know yet: “Use ‘sentry-cli –help’ to learn about it, then use it to find the most recent error in production.” Claude reads the help output, figures out the syntax, and runs the commands. Even niche internal CLIs work this way.
7. Add “ultrathink” for Complex Reasoning
It’s a keyword that sets effort to high and triggers adaptive reasoning on Opus 4.6. Claude dynamically allocates thinking based on the problem. Use it for architecture decisions, tricky debugging, multi-step reasoning—anything where you want Claude to think before acting.
You can also set effort permanently with /effort. For less complex tasks, lower effort levels keep things fast and cheap. Match the effort to the problem. No point burning thinking tokens on a variable rename.
Managing Sessions: Keep Your Work Clean and Focused
8. Run /clear Between Unrelated Tasks
A clean session with a sharp prompt beats a messy three-hour session every time. Different task? /clear first.
I know it feels like throwing away progress, but you’ll get better results starting fresh. Sessions degrade because accumulated context from earlier work drowns out your current instructions. The five seconds it takes to /clear and write a focused starting prompt saves you from 30 minutes of diminishing returns.
9. Control Claude Code from Your Phone
Run claude remote-control to start a session, then connect to it from the Claude website or the Claude app on iOS or Android. The session runs locally on your machine—your phone or browser is just a window into it. You can send messages, approve tool calls, and monitor progress from anywhere.
If you’re using the cc alias from tip #1, Claude already has full permissions and won’t need approval for each action. This makes remote control even smoother: kick off a task, walk away, and check in from your phone only when Claude finishes or hits something unexpected.
10. Extend Your Context Window to 1 Million Tokens
Both Sonnet 4.6 and Opus 4.6 support 1 million token context windows. On Max, Team, and Enterprise plans, Opus is automatically upgraded to 1M context. You can also switch models mid-session with /model opus[1m] or /model sonnet[1m].
If you’re concerned about quality at larger context sizes, start at 500k and work up gradually. Higher context means more room before compaction kicks in, but response quality can vary depending on the task. Use CLAUDE_CODE_AUTO_COMPACT_WINDOW to control when compaction triggers, and CLAUDE_AUTOCOMPACT_PCT_OVERRIDE to set the percentage threshold. Find the sweet spot for your workflow.
11. Use Plan Mode When You’re Not Sure How to Approach Something
Use plan mode for multi-file changes, unfamiliar code, and architectural decisions. The overhead is real—a few extra minutes upfront—but it prevents Claude from spending 20 minutes confidently solving the wrong problem entirely.
Skip it for small, clear-scope tasks. If you can describe the diff in one sentence, just do it directly. You can switch into plan mode anytime with Shift+Tab to cycle between normal, auto-accept, and plan permission modes without leaving the conversation.
12. Leverage Skills for On-Demand Knowledge
Skills are markdown files that extend Claude’s knowledge on demand. Unlike system prompts which load every session, skills load only when relevant to the current task. This keeps your context lean.
Create skills in .claude/skills/ or install plugins that bundle pre-built skills—run /plugin to browse what’s available. Use skills for specialized domain knowledge—API conventions, deployment procedures, coding patterns—that Claude needs sometimes but not always.
13. Use /btw for Quick Side Questions
/btw pops up an overlay for a quick question without entering your conversation history. I use it for clarifications about the current session: “Why did you choose this approach?” or “What’s the tradeoff with the other option?” The answer shows in a dismissible overlay, your main context stays lean, and Claude keeps working.
14. Use /loop for Recurring Checks
/loop 5m check if the deploy succeeded and report back schedules a recurring prompt that fires in the background while your session stays open. The interval is optional—defaults to 10 minutes—and supports s, m, h, and d units. You can also loop over other commands: /loop 20m /review-pr 1234. Tasks are session-scoped and expire after 3 days, so a forgotten loop won’t run forever. Use /loop for monitoring deploys, watching CI pipelines, or polling an external service while you focus on something else.
Working with Files and Prompts: Getting Claude to Understand You
15. Tell Claude Exactly Which Files to Look At
Use @ to reference files directly:
@middleware.ts contains the session handling logic.
Check if it redirects correctly after expiration.
The @ prefix resolves to the file path automatically, so Claude knows exactly where to look. Claude can grep and search your codebase on its own, but it still has to narrow down candidates and identify the right file. Every search step costs tokens and context. Pointing Claude at the right files from the start skips that entire process.
16. Explore Unfamiliar Code with Vague Prompts
“What would you improve in this file?” is a great exploration prompt. Not every prompt needs to be specific. When you want fresh eyes on existing code, a vague question gives Claude room to surface things you wouldn’t have thought to ask about.
I use this when onboarding onto an unfamiliar repository. Claude points out patterns, inconsistencies, and improvement opportunities that I’d miss on a first read.
17. Edit Plans with Ctrl+G
When Claude presents a plan, Ctrl+G opens it in your text editor for direct editing. Add constraints, remove steps, redirect the approach before Claude writes a single line of code. Useful when the plan is mostly right but you want to tweak a few steps without re-explaining the whole thing.
18. Let Claude Interview You When You Can’t Fully Spec a Feature
You know what you want to build, but you feel like you don’t have all the details Claude needs to build it well. Let Claude ask the questions.
I want to build a user dashboard showing recent activity and notifications.
Interview me in detail using the AskUserQuestion tool.
Ask about technical implementation, edge cases, concerns, and tradeoffs.
Don't ask obvious questions.
Keep interviewing until we've covered everything,
then write a complete spec to SPEC.md.
Once the spec is done, start a fresh session to execute with clean context and a complete spec.
19. Stash Your Prompt with Ctrl+S
You’re halfway through writing a long prompt and realize you need a quick answer first. Ctrl+S stashes your draft. Type your quick question, submit it, and your stashed prompt restores automatically.
20. Background Long-Running Tasks with Ctrl+B
When Claude kicks off a long bash command—a test suite, a build, a migration—press Ctrl+B to send it to the background. Claude continues working while the process runs, and you can keep chatting. The result appears when the process finishes.
Permissions and Safety: Balance Speed with Protection
21. Add a Live Status Line
The status line is a shell script that runs after every Claude turn. It displays live information at the bottom of your terminal: current directory, git branch, context usage color-coded by how full the window is.
The fastest way to set one up is /statusline inside Claude Code. It’ll ask what you want to display and generate the script for you.
22. Allowlist Safe Commands with /permissions
Stop clicking “approve” on npm run lint for the hundredth time. /permissions lets you allowlist trusted commands so you stay in flow. You’ll still get prompted for anything not on the list.
23. Use /sandbox When You Want Claude to Work Freely
Run /sandbox to enable OS-level isolation. Writes are restricted to your project directory, and network requests are limited to domains you approve. It uses Seatbelt on macOS and bubblewrap on Linux, so restrictions apply to every subprocess Claude spawns. In auto-allow mode, sandboxed commands run without permission prompts, which gives you near-full autonomy with guardrails.
For unsupervised work—overnight migrations, experimental refactors—run Claude in a Docker container. Containers give you full isolation, easy rollback, and the confidence to let Claude run for hours.
24. Block Destructive Commands with PreToolUse Hooks
Block rm -rf, drop table, and truncate patterns with a PreToolUse hook on Bash. Claude won’t even try. The hook fires before Claude executes the tool, so destructive commands get caught before they cause damage.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"type": "command",
"command": "if echo \\"$TOOL_INPUT\\" | grep -qE 'rm -rf|drop table|truncate'; then echo 'BLOCKED: destructive command' >&2; exit 2; fi"
}
]
}
}
Add this to .claude/settings.json in your project. You can set it up interactively with /hooks, or just tell Claude: “Add a PreToolUse hook that blocks rm -rf, drop table, and truncate commands.”
25. Always Manually Review Auth, Payments, and Data Mutations
Claude is good at code. These decisions need a human: auth flows, payment logic, data mutations, destructive database operations. Review these regardless of how good the rest looks. A wrong auth scope, a misconfigured payment webhook, or a migration that drops a column silently can cost you users, money, or trust. No amount of automated testing catches every one of these.
Advanced Automation: Hooks and Workflows
26. Use Subagents to Keep Your Main Context Clean
“Use subagents to figure out how the payment flow handles failed transactions.” This spawns a separate Claude instance with its own context window. It reads all the files, reasons about the codebase, and reports back a concise summary.
Your main session stays clean with plenty of room to build something. A deep investigation can consume half your context window before you write any code. Subagents keep that cost out of your main session. Built-in types include Explore (Haiku, fast file search) and Plan (read-only analysis).
27. Agent Teams for Multi-Session Coordination
This is experimental but powerful. Enable it first by adding CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to your settings or environment. Then tell Claude to create a team: “Create an agent team with 3 teammates to refactor these modules in parallel.” A team lead distributes work to teammates, each with their own context window and a shared task list. Teammates can message each other directly to coordinate.
Start with 3-5 teammates and 5-6 tasks per teammate. Avoid assigning tasks that modify the same files—two teammates editing the same file leads to overwrites. Start with research and review tasks—PR reviews, bug investigations—before attempting parallel implementation.
28. Create Custom Subagents for Recurring Tasks
Different from using subagents on the fly, custom subagents are pre-configured agents saved in .claude/agents/. For example, a security-reviewer agent with Opus and read-only tools, or a quick-search agent with Haiku for speed.
Use /agents to browse and create them. You can set isolation: worktree for agents that need their own file system.
29. Pick the Right MCP Servers for Your Stack
The MCP servers worth starting with: Playwright for browser testing and UI verification, PostgreSQL or MySQL for direct schema queries, Slack for reading bug reports and thread context, and Figma for design-to-code workflows.
Claude Code supports dynamic tool loading, so servers only load their definitions when Claude needs them.
30. Have One Claude Write, Another Claude Review
First Claude implements the feature, second Claude reviews the PR. The reviewer has no knowledge of the implementation shortcuts and will challenge every one of them.
Same idea works for test-driven development. Session A writes tests, Session B writes the code to pass them.
31. Review PRs Conversationally
Don’t ask Claude for a one-shot PR review—although you can if you want. Open the PR in a session and have a conversation about it. “Walk me through the riskiest change in this PR.” “What would break if this runs concurrently?” “Is the error handling consistent with the rest of the codebase?”
Conversational reviews catch more issues because you can drill into the areas that matter. One-shot reviews tend to flag style nits and often miss the architectural problems.
32. Auto-Format with a PostToolUse Hook
Every time Claude edits a file, your formatter should run automatically. Add a PostToolUse hook in .claude/settings.json that runs Prettier—or your formatter of choice—on any file after Claude edits or writes it:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "npx prettier --write \\"$CLAUDE_FILE_PATH\\" 2>/dev/null || true"
}
]
}
]
}
}
The || true prevents hook failures from blocking Claude. You can chain other tools too—add npx eslint --fix as a second hook entry.
If you have an editor open to the same files, consider turning off format-on-save while Claude is working. Some developers have reported that editor saves can invalidate the prompt cache, forcing Claude to re-read files. Let the hook handle formatting instead.
33. Use Instructions for Suggestions, Hooks for Requirements
.claude/instructions is advisory. Claude follows it about 80% of the time. Hooks are deterministic—100%. If something must happen every time without exception—formatting, linting, security checks—make it a hook. If it’s guidance Claude should consider, instructions are fine.
34. Play a Sound When Claude Finishes
Add a Stop hook that plays a system sound when Claude completes a response. Kick off a task, switch to something else, and hear a ping when it’s done.
{
"hooks": {
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "/usr/bin/afplay /System/Library/Sounds/Glass.aiff"
}
]
}
]
}
}
35. Fan-Out with claude -p for Batch Operations
Loop through a list of files with non-interactive mode. --allowedTools scopes what Claude can do per file. Run them in parallel with & for maximum throughput.
for file in $(cat files-to-migrate.txt); do
claude -p "Migrate $file from class components to hooks" \\
--allowedTools "Edit,Bash(git commit *)" &
done
wait
This is great for converting file formats, updating imports across a codebase, and running repetitive migrations where each file is independent of the others.
36. Customize the Spinner Verbs
While Claude thinks, the terminal shows a spinner with verbs like “Flibbertigibbeting…” and “Flummoxing…” You can replace them with whatever you want. Tell Claude:
Replace my spinner verbs in user settings with these: Hallucinating responsibly, Pretending to think, Confidently guessing, Blaming the context window
You don’t have to provide a list either. Just tell Claude what vibe you’re going for: “Replace my spinner verbs with Harry Potter spells.” Claude generates the list. It’s a small thing that makes the wait more enjoyable.
Context Management: Keep Sessions Clear and Efficient
37. Guide Compaction with Instructions
When context compacts—automatically or via /compact—tell Claude what to preserve: /compact focus on the API changes and the list of modified files. You can also add standing instructions to your .claude/instructions: “When compacting, preserve the full list of modified files and current test status.”
38. After 2 Corrections on the Same Thing, Start Fresh
When you and Claude are going down a rabbit hole of corrections and the issue still isn’t fixed, the context is now full of failed approaches that are actively hurting the next attempt. /clear and write a better starting prompt that incorporates what you learned. A clean session with a sharper prompt almost always outperforms a long session weighed down by accumulated dead ends.
39. Preserve Important Context Across Compaction with Hooks
When context compacts during long sessions, Claude can lose track of what you’re working on. A Notification hook with a compact matcher automatically re-injects your key context every time compaction fires.
Tell Claude: “Set up a Notification hook that after compaction reminds you of the current task, modified files, and any constraints.” Claude will create the hook in your settings. Good candidates for re-injection: the current task description, the list of files you’ve modified, and any hard constraints—like “don’t modify migration files.”
This is most valuable during multi-hour sessions where you’re deep in a feature and can’t afford Claude losing the thread.
40. Use /branch to Try a Different Approach Without Losing Your Current One
/branch—or /fork—creates a copy of your conversation at the current point. Try the risky refactor in the branch. If it works, keep it. If it doesn’t, your original conversation is untouched. This is different from rewind because both paths stay alive.
41. Name and Color-Code Your Sessions
/rename auth-refactor puts a label on the prompt bar so you know which session is which. /color red or /color blue sets the prompt bar color. Available colors: red, blue, green, yellow, purple, orange, pink, cyan. When you’re running 2-3 parallel sessions, naming and coloring them takes five seconds and saves you from typing into the wrong terminal.
Project Setup: Help Claude Understand Your Codebase
42. Run /init, Then Cut the Result in Half
.claude/instructions is a markdown file at the root of your project that gives Claude persistent instructions: build commands, coding standards, architectural decisions, repo conventions. Claude reads it at the start of every session. /init generates a starter version based on your project structure—it picks up build commands, test scripts, and directory layout.
The output tends to be bloated. If you can’t explain why a line is there, delete it. Trim the noise and add what’s missing.
43. The Litmus Test for Every Instructions Line
For every line in your .claude/instructions, ask: would Claude make a mistake without this? If Claude already does something correctly on its own, the instruction is noise. Every unnecessary line dilutes the ones that matter. There’s roughly a 150-200 instruction budget before compliance drops off, and the system prompt already uses about 50 of those.
44. After Claude Makes a Mistake, Say “Update Your Instructions So This Doesn’t Happen Again”
When Claude makes a mistake, say “update the instructions file so this doesn’t happen again.” Claude writes its own rule. Next session, it follows it automatically.
Over time your instructions become a living document shaped by real mistakes. To keep it from growing indefinitely, use @ references to point to a separate file like .claude/project-context.md for patterns and fixes. Your instructions stay lean, and Claude reads the details on demand.
45. Use .claude/rules/ for Rules That Only Apply Sometimes
Place markdown files in .claude/rules/ to organize instructions by topic. By default, every rule file loads at the start of each session. To make a rule load only when Claude works on specific files, add paths frontmatter:
---
paths:
- "**/*.ts"
---
# TypeScript conventions
Prefer interfaces over types.
This keeps your main .claude/instructions lean. TypeScript rules load when Claude reads .ts files, Go rules when it reads .go files. Claude never wades through conventions for languages it isn’t touching.
46. Use @ References to Keep Instructions Lean
Reference docs with @.claude/auth-patterns.md. You can also reference README.md, package.json, or even @~/.claude/my-project-instructions.md.
Claude reads the file when it needs it. Think of instructions as “here’s more context if you need it” without bloating the file Claude reads every session.
47. Stop Interpreting Bugs for Claude. Paste the Raw Data.
Describing a bug in words is slow. You watch Claude guess, correct it, and repeat.
Paste the error log, CI output, or Slack thread directly and say “fix.” Claude reads logs from distributed systems and traces where things break. Your interpretation adds abstraction that often loses the detail Claude needs to pinpoint the root cause. Give Claude the raw data and get out of the way.
This works for CI too. “Go fix the failing CI tests” with a paste of the CI output is one of the most reliable patterns. You can also paste a PR URL or number and ask Claude to check the failing checks and fix them. With the gh CLI installed, Claude handles the rest.
You can also pipe output directly from the terminal:
cat error.log | claude "explain this error and suggest a fix"
npm test 2>&1 | claude "fix the failing tests"
Remote and Parallel Work: Scaling Your Approach
48. Set Your Output Style
Run /config and select your preferred style. The built-in options are Explanatory—detailed, step-by-step; Concise—brief, action-focused; and Technical—precise, jargon-friendly.
You can also create custom output styles as files in ~/.claude/output-styles/.
49. Use Voice Dictation for Richer Prompts
Run /voice to enable push-to-talk, then hold Space to dictate. Your speech transcribes live into the prompt, and you can mix voice and typing in the same message. Spoken prompts naturally include more context than typed ones because you explain the background, mention constraints, and describe what you want without cutting corners to save keystrokes. Requires a Claude.ai account—not an API key. You can rebind the push-to-talk key to a modifier combo like meta+k in ~/.claude/keybindings.json to skip the hold-detection warmup.
50. Use –worktree for Isolated Parallel Branches
claude --worktree feature-auth creates an isolated working copy with a new branch. Claude handles the git worktree setup and cleanup for you.
The Claude Code team calls this “Claude Code at scale.” Spin up 3-5 worktrees, each running its own Claude session in parallel. I usually run 2-3. Each worktree gets its own session, its own branch, and its own file system state.
The ceiling on local worktrees is your machine—multiple dev servers, builds, and Claude sessions all competing for CPU. Claude Code Cloud moves each agent to its own cloud container with a browser preview, so your machine stays free for the work that needs your brain.
Frequently Asked Questions
Q: When should I use /claude –continue versus /claude –resume?
A: --continue directly resumes your most recent session—perfect for picking up yesterday’s progress at the start of your day. --resume opens a session picker, ideal when you’re juggling multiple parallel sessions and need to choose which one to re-enter.
Q: What’s the difference between hooks and instructions?
A: Instructions are advisory—Claude follows them about 80% of the time. Hooks are deterministic—they execute 100% of the time. Use hooks for things that must happen every session without exception. Use instructions for guidance Claude should consider.
Q: Subagents versus agent teams—what’s the distinction?
A: Subagents are individual Claude instances you temporarily assign to handle specific tasks—they report results back to your main session. Agent teams are multiple Claude instances working together collaboratively, with a team lead distributing tasks and members communicating directly. Teams excel at parallel work on complex projects.
Q: MCP servers or CLI tools—which should I choose?
A: CLI tools are more context-efficient because they don’t load tool schemas into your context window. MCP servers offer richer functionality—Playwright lets Claude open and interact with browsers, database servers enable direct schema queries. Choose based on what you need: efficiency or capability.
Q: After context compaction, what does Claude forget?
A: Compaction removes older conversation content but preserves key information. You can guide what’s preserved using compaction instructions, or use hooks to re-inject important context after compaction fires. This ensures Claude maintains focus during long sessions.
You don’t need all 50 tips. Pick the one that solves the thing that annoyed you most in your last session, and try it tomorrow. One tip that sticks is worth more than fifty you bookmarked and never revisit.
