How to Use Claude Code: 50 Practical Tips from a Daily User
Claude Code is an AI coding agent you run straight from the terminal. It reads your code, edits files, runs tests, and even commits changes — a different animal entirely from copying and pasting code snippets into a chat window.
The trouble is, it has too many features. Used well, it can multiply your productivity several times over — but most people stick to the basics, shrug, and think, "How is this any different from a chat window?"
Developer Vishwas pulled together 50 tips drawing on Anthropic's official documentation, advice from Claude Code creator Boris Cherny, community know-how, and his own year of daily use. Here's a category-by-category rundown of the ones you can put to work right away.
1. Initial Setup: Do It Once, Benefit Every Day
Set Up a "cc" Alias
Typing out `claude --dangerously-skip-permissions` every single time is a pain. Add an alias to your shell config file (~/.zshrc or ~/.bashrc) and you can launch it just by typing `cc`.
alias cc='claude --dangerously-skip-permissions'
The flag's name is scary on purpose — it's a reminder to only use it once you fully understand what Claude Code can do to your codebase.
Set Up CLAUDE.md from the Start
Running `/init` generates a draft CLAUDE.md based on your project structure, automatically capturing build commands, test scripts, and directory layout. The output tends to be long and rambling, though — you should cut it roughly in half. If you can't explain why a line needs to be there, delete it.
Ask this question of every line in CLAUDE.md: "Would Claude get this wrong without this instruction?" Guidance for something Claude already does well on its own is just noise. The more unnecessary lines pile up, the more they dilute the instructions that actually matter — compliance tends to drop off once you're past roughly 150–200 instructions.
Install Language-Specific Code Intelligence Plugins
LSP plugins automatically run diagnostics every time Claude edits a file, letting it see and fix type errors, unused imports, and missing return types on its own. Of all the individual tips here, this is the single highest-impact one.
/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 also exist for C#, Java, Kotlin, Swift, PHP, Lua, and C/C++. Open the Discover tab under `/plugin` to see the full list.
Configure Output Style
Pick your preferred style from `/config`. There are three built-in options: Explanatory (detailed, step-by-step), Concise (short and action-focused), and Technical (precise, jargon-heavy). You can also add custom styles as files in `~/.claude/output-styles/`.
2. Session Management: Keeping Context Clean
Use /clear Between Unrelated Tasks
One sharp prompt in a clean session beats three hours of a session where everything's gotten mixed together. The rule of thumb: run `/clear` first whenever you switch tasks.
It feels like you're throwing away progress, but starting fresh gets better results. As a session drags on, context piled up earlier starts to interfere with your current instructions. Running `/clear` and writing a focused opening prompt takes five seconds — and those five seconds head off thirty minutes of lost productivity.
If Two Fixes Don't Work, Start Over
If you're stuck in a fix-fail-retry-fail loop with Claude, it's because the context is now full of failed approaches that are actively getting in the way of the next attempt. Run `/clear` and write a better opening prompt that incorporates what you learned from the failures.
Esc to Stop, Esc+Esc to Rewind
Pressing Esc stops Claude instantly without losing context, so you can redirect immediately. Esc+Esc (or `/rewind`) brings up a list of every checkpoint Claude has created — you can restore the code, the conversation, or both.
That means you can try an approach you're only 40% confident in — if it works, great; if not, just rewind. Keep in mind checkpoints only track file edits, though. Changes made through bash commands, like migrations or database operations, aren't included.
Resuming Sessions
`claude --continue` picks up your most recent conversation. `claude --resume` lets you choose from a list of past sessions.
Naming and Color-Coding Sessions
Name a session with `/rename auth-refactor`. Set the prompt bar's color with `/color red` or `/color blue`. When you're running two or three sessions in parallel, spending five seconds on naming and color-coding saves you from typing into the wrong terminal window.
Managing Compaction
You can tell Claude what to preserve when context gets compacted — something like `/compact focus on the API changes and the list of files modified`. You can also bake a standing instruction into CLAUDE.md: "When compacting, preserve the full list of modified files and the current test status."
Expanding the Context Window to 1 Million Tokens
Both Sonnet 4.6 and Opus 4.6 support a 1-million-token context window. Switch mid-session with `/model opus[1m]` or `/model sonnet[1m]`.
3. Prompting Techniques: Getting Claude to Do Good Work
Paste Raw Data, Don't Interpret the Bug Yourself
Describing a bug in your own words is slow — Claude ends up guessing, getting it wrong, and needing correction in a repeating cycle. Instead, paste the error log, CI output, or Slack thread verbatim and just say "fix this." Adding your own interpretation on top actually strips out details Claude needs to pin down the root cause.
You can also pipe it straight from the terminal.
cat error.log | claude "explain this error and suggest a fix" npm test 2>&1 | claude "fix the failing tests"
Tell Claude Exactly Which File to Look At
Reference files directly with an @, like `@src/auth/middleware.ts`. Claude can search for the right file on its own, but narrowing down candidates and locating the right one burns tokens and context every time. Point directly at it from the start and that cost disappears.
Trigger Deep Thinking with the "ultrathink" Keyword
For complex architecture decisions, tricky debugging, or multi-step reasoning, add "ultrathink" to your prompt. On Opus 4.6, adaptive reasoning kicks in and scales the depth of thinking to match the problem's complexity. You don't need it for simple tasks like renaming a variable. You can also set a default effort level permanently with `/effort`.
Give Claude a Way to Verify Its Own Work
Include test commands, linter checks, and expected output in your prompt.
Refactor the auth middleware to use JWT. After the change, run the existing test suite. If any tests fail, fix them before you're done.
Claude runs the tests, sees the failures, and fixes them itself. Boris Cherny, who created Claude Code, says this one habit alone doubles or triples output quality. For UI changes, set up the Playwright MCP server and Claude will open a browser, interact with the page, and check the UI directly.
Explore Code with Open-Ended Prompts
"What would you improve in this file?" is a good exploratory prompt. Not every prompt needs to be specific — when existing code needs a fresh set of eyes, an open-ended question is more likely to surface something you wouldn't have thought to ask about.
When You Can't Fully Spec a Feature, Let Claude Interview You
Sometimes you know what you want to build, but you're missing the details Claude needs to build it well.
I want to build [brief description]. Interview me in depth about the technical implementation, edge cases, concerns, and trade-offs. Skip the obvious questions. Keep asking until we've covered everything, then write the complete spec to SPEC.md.
Once the spec is done, open a new session and execute it with clean context and a complete spec.
4. Keyboard Shortcuts and Quick Controls
Claude Code Keyboard Shortcuts
Voice input (`/voice`) is especially useful. Speaking tends to naturally pack in more background context, constraints, and desired outcomes than typing does.
5. Parallel Work and Using Agents
Isolated Parallel Branches with Worktrees
Running `claude --worktree feature-auth` creates a new branch and an isolated working copy. The Claude Code team calls this the single biggest productivity leap in the tool — you can spin up three to five worktrees and run an independent Claude session in each, in parallel.
The limiting factor is your local machine's resources — multiple dev servers, builds, and Claude sessions all end up competing for CPU.
Protecting Main Context with Subagents
Say "use a subagent to figure out how the payment flow handles failed transactions" and a separate Claude instance spins up. It reads and analyzes the files, then reports back only a concise summary to your main session.
A deep investigation can eat up half your context window. With a subagent, that cost gets absorbed outside the main session. Built-in types include Explore (Haiku-powered, fast file search) and Plan (read-only analysis).
Custom Subagents
You can save preconfigured agents in `.claude/agents/` — a security reviewer (Opus, read-only tools), a quick-search agent (Haiku), and so on. Manage them with `/agents`.
Agent Teams (Experimental)
Enable `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`, then instruct: "create a team of 3 agents and refactor these modules in parallel." A team lead distributes the work, and each member gets its own context window plus a shared task list.
Start with three to five team members and five or six tasks per member. Avoid assigning tasks that touch the same file — if two team members edit the same file, one will overwrite the other.
Using claude -p for Batch Jobs
Non-interactive mode lets you loop through a list of files.
bash for file in $(cat files-to-migrate.txt); do claude -p "migrate $file from a class component to hooks" \ --allowedTools "Edit,Bash(git commit *)" & done wait
Well-suited for file format conversions, codebase-wide import updates, and repetitive migrations that are independent on a per-file basis.
6. Configuration Files and Rule Management
CLAUDE.md Is Advisory, Hooks Are Mandatory
CLAUDE.md is a recommendation — Claude follows it roughly 80% of the time. Hooks run 100% of the time. Anything that must happen without exception — formatting, linting, security checks — belongs in a hook. Guidelines Claude should simply be aware of belong in CLAUDE.md.
Feed Lessons from Mistakes Back into CLAUDE.md
When Claude makes a mistake, just say "update CLAUDE.md so this doesn't happen again." Claude writes the rule itself, and it's automatically followed in the next session. Over time, CLAUDE.md becomes a living document shaped by real mistakes.
Conditional Rules Go in .claude/rules/
Drop markdown files into `.claude/rules/` to split instructions by topic. To have a rule load only when working on specific files, specify a path in the frontmatter.
yaml --- paths: - "**/*.ts" --- # TypeScript rules Prefer interface over type
TypeScript rules load only when you touch .ts files; Go rules load only when you touch .go files.
Keep CLAUDE.md Light with @imports
Reference external docs like `@docs/git-instructions.md`. You can link README.md, package.json, or separate instruction files, and Claude reads them when it needs to. It's a way to supply extra context without bloating the CLAUDE.md that gets loaded every session.
On-Demand Knowledge with Skills
Skills are markdown files that extend Claude's knowledge. Unlike CLAUDE.md, which loads every session, skills load only when they're relevant to the current task. Create them in `.claude/skills/`, or install prebuilt ones bundled with plugins. They're a good fit for specialized knowledge you only need occasionally — API conventions, deployment procedures, coding patterns.
7. Using Hooks: Automation and Safeguards
Auto-Format on File Edit (PostToolUse)
Have a formatter run automatically every time Claude edits a file.
json { "hooks": { "PostToolUse": [ { "matcher": "Edit|Write", "hooks": [ { "type": "command", "command": "npx prettier --write \"$CLAUDE_FILE_PATH\" 2>/dev/null || true" } ] } ] } }
If you have the same file open in your editor, turn off format-on-save there. There are reports that editor saves invalidate the prompt cache, forcing Claude to re-read the file.
Block Dangerous Commands (PreToolUse)
Block destructive commands like `rm -rf`, `drop table`, and `truncate` before they run.
json { "hooks": { "PreToolUse": [ { "matcher": "Bash", "type": "command", "command": "if echo \"$TOOL_INPUT\" | grep -qE 'rm -rf|drop table|truncate'; then echo 'BLOCKED' >&2; exit 2; fi" } ] } }
Auto-Reinject Context on Compaction (Notification)
In a long session, compaction can cause Claude to lose track of the current task. Just tell Claude: "set up a Notification hook that reminds you of the current task, modified files, and constraints after compaction."
Sound Alert on Task Completion (Stop)
json { "hooks": { "Stop": [ { "matcher": "*", "hooks": [ { "type": "command", "command": "/usr/bin/afplay /System/Library/Sounds/Glass.aiff" } ] } ] } }
Kick off a task, go do something else, and come back when you hear the completion sound.
8. Connecting External Tools
Handling GitHub with the gh CLI
The gh CLI handles PRs, issues, and comments without needing a separate MCP server. CLI tools are more context-efficient than MCP servers because they don't load tool schemas into the context window. The same goes for standard CLI tools like jq and curl.
You can even teach Claude tools it doesn't know. Say "read sentry-cli --help to figure out how it works, then find the most recent error in production," and Claude reads the help output, works out the syntax, and runs the command.
A Guide to Choosing MCP Servers
Four MCP servers are worth starting with: Playwright (browser testing, UI verification), PostgreSQL/MySQL (querying schemas directly), Slack (reading bug reports and thread context), and Figma (design-to-code workflows). Claude Code supports dynamic tool loading, so server definitions only load when you actually need them.
Managing Permissions
Add trusted commands to an allowlist with `/permissions`, and you'll stop having to approve `npm run lint` every single time. Anything not on the list still needs approval.
Running `/sandbox` turns on OS-level isolation. Writes are restricted to the project directory, and network requests are limited to domains you've approved.
9. Code Review and Collaboration Patterns
One Writes, Another Reviews
One Claude instance implements the feature; a second, working in fresh context, reviews it like a senior engineer. Because the reviewer has no knowledge of the compromises made during implementation, it questions everything. The same pattern works for TDD — Session A writes the tests, Session B writes the code that passes them.
Review PRs Conversationally
Instead of asking for a batch review, open the PR in a session and have a conversation. "Explain the riskiest change in this PR." "What breaks if this runs concurrently?" "Is the error handling consistent with the rest of the codebase?"
Conversational review catches more problems. Batch review tends to skew toward style nitpicks and miss architectural issues.
Using /loop for Recurring Checks
`/loop 5m check whether the deploy succeeded and report back` re-runs every five minutes. Use it for deploy monitoring, watching CI pipelines, or polling external services. Tasks are scoped to the session and expire after three days, so a forgotten loop won't run forever.
10. Remote Control and Mobile Access
Running `claude remote-control` starts a session you can access from claude.ai/code or the Claude app on iOS/Android. The session still runs on your local machine — your phone or browser is just a window into it. You can send messages, approve tool calls, and monitor progress.
If you're using the `cc` alias (auto-approving permissions), remote sessions proceed without approval too. That means you can kick off a task, walk away, and check in occasionally from your phone.
11. What Still Needs a Human
Even when Claude writes good code, these things still need human review.
Auth flows, payment logic, data mutations, and destructive database operations. A misconfigured auth scope, a poorly wired payment webhook, or a migration that silently drops a column can cost you users, money, and trust. No amount of automated testing catches all of these.
12. Small but Useful Extras
Adding a Status Line
The status line is a shell script that runs after every one of Claude's turns, showing your current directory, git branch, and context usage at the bottom of the terminal. Run `/statusline` and it will ask what you want displayed, then generate the script.
Customizing the Spinner Verbs
While Claude is thinking, it shows a whimsical verb like "Flibbertigibbeting…" You can change these. Say "change the spinner verbs to Harry Potter spells" and Claude will generate the list for you. It's small, but it makes the waiting more fun.
