How to Use Claude Code: 50 Field-Tested Tips From a Daily User
Claude Code is an AI coding agent that runs right in your terminal. It reads code, edits files, runs tests, and even commits. It's a different world from copying and pasting code snippets into a chat window.
The problem is that it does so much. Used well, it can multiply your productivity several times over—but most people stick to the basic features, come away with the impression "how is this any different from just chatting?," and stop there.
Developer Vishwas pulled together 50 tips, drawing on Anthropic's official documentation, advice from Boris Cherny (the creator of Claude Code), the community's collective experience, and his own year of daily use. Here we organize the ones you can put to work right away, sorted by category.
1. First-Time Setup: Do It Once, Reap It Daily
Register a cc alias
Typing `claude --dangerously-skip-permissions` every time is painful. Add an alias to your shell config file (~/.zshrc or ~/.bashrc) and you can launch with just `cc`.
alias cc='claude --dangerously-skip-permissions'
The flag name is deliberately scary. The point is to use it only once you fully understand what Claude Code can do to your codebase.
Set up CLAUDE.md from the start
Run `/init` and it generates a draft CLAUDE.md based on your project structure. It automatically captures build commands, test scripts, and the directory layout. The catch: the output is long and verbose. You're better off cutting it 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 make a mistake without this instruction?" Guidance about things Claude already does well on its own is just noise. The more unnecessary lines you have, the more you dilute the impact of the instructions that matter. Compliance starts to drop off somewhere past 150–200 instructions.
Install language-specific code-intelligence plugins
LSP plugins automatically run diagnostics every time Claude edits a file. Type errors, unused imports, missing return types—Claude sees them and fixes them itself. As single additions go, this is the highest-impact plugin there is.
/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
There are also plugins for C#, Java, Kotlin, Swift, PHP, Lua, and C/C++. Open the Discover tab in `/plugin` to see the full list.
Set your output style
Pick your preferred style in `/config`. There are three defaults: Explanatory (step-by-step detail), Concise (brief, action-oriented), and Technical (precise, jargon-forward). You can also add a custom style by dropping a file in `~/.claude/output-styles/`.
2. Session Management: Keeping Your Context Clean
Use /clear between unrelated tasks
One sharp prompt in a clean session beats a three-hour session with a little of everything mixed in. The rule: when the task changes, start with `/clear`.
It feels like you're throwing away progress, so you'll be reluctant—but starting fresh produces better results. As a session drags on, the context piled up at the front gets in the way of your current instructions. It takes five seconds to `/clear` and write a focused opening prompt. Those five seconds save you 30 minutes of degraded output.
If two fixes don't solve the same problem, start over
If you've fallen down the rabbit hole of fix → fail → re-fix → fail-again with Claude, your context is now full of failed approaches that are sabotaging the next attempt. `/clear`, and write a better opening prompt that bakes in what you learned from the failures.
Esc to stop, Esc+Esc to rewind
Press Esc to stop Claude instantly without losing context. You can change direction on the spot. Press Esc+Esc (or `/rewind`) and you get a list of every checkpoint Claude created. You can restore the code, the conversation, or both.
That means you can try an approach you're only 40% sure about. If it works, great; if it doesn't, you rewind. Just note that checkpoints only track file edits. Changes made through bash commands (migrations, DB operations) aren't included.
Resume a session
`claude --continue` picks up your most recent conversation. `claude --resume` lets you choose from a list of sessions to continue.
Name and color your sessions
Use `/rename auth-refactor` to give a session a name. Use `/color red` or `/color blue` to set the prompt-bar color. When you're running two or three sessions in parallel, spending five seconds on a name and color saves you from typing into the wrong terminal.
Manage compaction (context compression)
You can tell Claude what to preserve when the context gets compressed. Write something like `/compact focus on the API changes and the list of modified files`. You can also put a standing instruction in CLAUDE.md: "When compacting, preserve the full list of modified files and the current test status."
Expand the context window to 1 million tokens
Both Sonnet 4.6 and Opus 4.6 support a 1-million-token context window. You can switch mid-session with `/model opus[1m]` or `/model sonnet[1m]`.
3. Prompting Techniques: Getting Claude to Do Good Work
Don't interpret the bug—paste the raw data
Describing a bug in words is slow. It kicks off a loop of Claude guessing, getting it wrong, and patching. Just paste the error log, the CI output, the Slack thread as-is and say "fix it." Adding your own interpretation actually strips away the details Claude needs to pinpoint the cause.
You can also pipe 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 it exactly which files to look at
Reference a file directly with @, like `@src/auth/middleware.ts`. Claude can search on its own, but narrowing the candidates and hunting down the right file burns tokens and context at every step. Point it there from the start and that cost disappears.
Trigger deep thinking with the "ultrathink" keyword
For complex architecture decisions, tricky debugging, and multi-step reasoning, put "ultrathink" in your prompt. On Opus 4.6, adaptive reasoning kicks in and scales the depth of thinking to the complexity of the problem. You don't need it for simple tasks like renaming a variable. You can also set a permanent default effort level with `/effort`.
Give Claude a way to verify its own work
Include the test command, the linter check, and the 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 finish.
Claude runs the tests, sees the failures, and fixes them itself. Boris Cherny, the creator of Claude Code, says this alone raises quality two- to three-fold. For UI changes, set up the Playwright MCP server and Claude will open a browser, interact with the page, and check the UI for itself.
Explore code with vague prompts
"What would you improve in this file?" is a good exploration prompt. Not every prompt has to be specific. When existing code needs fresh eyes, a vague question often surfaces things you'd never have thought to ask about.
When you can't fully spec a feature, have Claude interview you
Sometimes you know what you want to build, but you're short on 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. Don't ask obvious questions. Keep asking until you've covered everything, then write a complete spec to SPEC.md.
Once the spec is done, open a new session and run it with clean context and a complete spec.
4. Shortcuts and Quick Moves
Claude Code keyboard shortcuts
Voice input (`/voice`) is especially handy. Speaking naturally gets you to include more background, constraints, and desired outcomes than you would when typing.
5. Parallel Work and Putting Agents to Use
Isolated parallel branches with worktrees
Run `claude --worktree feature-auth` and you get a new branch and an isolated working copy. The Claude Code team calls this their single biggest productivity leap. You can spin up three to five worktrees and run independent Claude sessions in parallel.
The limit is your local machine's resources. Multiple dev servers, builds, and Claude sessions all compete for the CPU.
Protect your 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 the main session.
A deep investigation can eat up half your context window. With a subagent, that cost is handled outside the main session. Built-in types include Explore (Haiku, fast file search) and Plan (read-only analysis).
Custom subagents
You can store pre-configured agents in `.claude/agents/`—a security reviewer (Opus, read-only tools), a fast searcher (Haiku), and so on. Manage them with `/agents`.
Agent teams (experimental)
Enable `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`, then say "create a team of three agents and refactor these modules in parallel." A team lead distributes the work, and each member gets its own context window and a shared task list.
Start with three to five members and five or six tasks per member. Avoid tasks that edit the same file. If two members touch the same file, you get overwrites.
Use claude -p for batch jobs
Non-interactive mode lets you loop over 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
It's a good fit for file-format conversions, codebase-wide import updates, and repetitive migrations that are independent file by file.
6. Config Files and Managing Rules
CLAUDE.md is advice; hooks are enforcement
CLAUDE.md is a set of recommendations. Claude follows them about 80% of the time. Hooks run 100% of the time. Make a hook for anything that must happen without exception (formatting, linting, security checks). Put the guidelines Claude should consult in CLAUDE.md.
Feed lessons from mistakes back into CLAUDE.md
When Claude makes a mistake, say "update CLAUDE.md so this mistake doesn't happen again." Claude writes the rule itself, and follows it automatically in the next session. Over time, CLAUDE.md becomes a living document shaped by actual mistakes.
Put conditional rules in .claude/rules/
Drop markdown files in `.claude/rules/` to split your guidance by topic. To have a file load only when you're working on certain files, specify the paths in its frontmatter.
yaml --- paths: - "**/*.ts" --- # TypeScript rules Prefer interface over type
TypeScript rules load only when you touch a .ts file; Go rules load only when you touch a .go file.
Keep CLAUDE.md lean with @imports
Reference external docs like `@docs/git-instructions.md`. You can link a README.md, package.json, or a separate instruction file. Claude reads them when it needs to. It's a way to provide extra context without bloating the CLAUDE.md that loads every session.
Provide on-demand knowledge with Skills
Skills are markdown files that extend Claude's knowledge. Unlike CLAUDE.md, which loads every session, a skill loads only when it's relevant to the current task. Create them in `.claude/skills/`, or install pre-made skills that ship bundled with a plugin. They're a good fit for specialized knowledge you need only occasionally—API rules, deployment procedures, coding patterns.
7. Putting Hooks to Work: Automation and Guardrails
Auto-format on file edits (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've got the same file open in your editor, you should turn off format-on-save. There are reports that an editor save invalidates 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, when the context gets compressed, Claude can lose track of the current task. Just tell Claude: "set up a Notification hook that, after compaction, reminds me of the current task, the modified files, and the constraints."
Sound alert when a task finishes (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
Handle GitHub work with the gh CLI
The gh CLI handles PRs, issues, and comments without a separate MCP server. CLI tools are more context-efficient than MCP servers because they don't load a tool schema into the context window. The same goes for standard CLI tools like jq and curl.
You can also teach Claude tools it doesn't know. Say "read sentry-cli --help to figure out how to use it, 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 the schema directly), Slack (reading bug reports and thread context), and Figma (the design-to-code workflow). Claude Code supports dynamic tool loading, so it loads a server's definitions only when you actually need that server.
Manage permissions
Use `/permissions` to add commands you trust to the allowlist. No more approving `npm run lint` every single time. Anything not on the list still needs approval.
Run `/sandbox` to turn on OS-level isolation. Writes are restricted to the project directory, and network requests are allowed only to domains you've approved.
9. Code Review and Collaboration Patterns
One writes, another reviews
The first Claude implements a feature; a second Claude reviews it from fresh context, like a senior engineer. Because the reviewer doesn't know the compromises made during implementation, it challenges everything. You can apply the same pattern to 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 reviews tend to skew toward style nitpicks and miss the architectural issues.
Use /loop for recurring checks
`/loop 5m check whether the deploy succeeded and report back` runs every five minutes. Use it for deploy monitoring, watching a CI pipeline, or polling an external service. The task is session-scoped and expires after three days, so a forgotten loop won't run forever.
10. Remote Control and Mobile Access
Run `claude remote-control` and a session starts. Connect from claude.ai/code or the Claude app on iOS/Android. The session 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-approve permissions), it proceeds without approval remotely too. You can kick off a task, walk away, and check in from your phone now and then.
11. What a Human Absolutely Must Review
Even when Claude writes good code, these always need a human reviewer.
Auth flows, payment logic, data mutations, destructive DB operations. A wrong auth scope, a misconfigured payment webhook, a migration that quietly drops a column—these cost you users, money, and trust. No amount of automated testing will catch all of it.
12. Small but Useful
Add a status line
The status line is a shell script that runs after every one of Claude's turns. It shows your current directory, git branch, and context usage at the bottom of the terminal. Run `/statusline` and it asks what you want to show, then generates the script.
Customize the spinner verbs
While Claude is thinking, you see verbs like "Flibbertigibbeting...". You can change these. Say "change the spinner verbs to Harry Potter spells" and Claude will generate a list. It's small, but it makes the wait more fun.
