Claude Code Tips and Tricks: 20 Power User Techniques That Actually Matter
20 battle-tested Claude Code tips from power users. Master CLAUDE.md, slash commands, hooks, subagents, plan mode, and context management.
Most developers install Claude Code and immediately start prompting it like ChatGPT. They type vague requests, get mediocre results, and conclude that AI coding tools are overhyped. Meanwhile, the developers who actually read the docs and learned the system are shipping features in minutes that used to take hours.
The gap between a casual Claude Code user and a power user is enormous. It is not about intelligence or experience. It is about knowing which levers to pull. This guide covers 20 specific techniques that separate developers who use Claude Code from developers who get real leverage from it.
Key Takeaways
- A well-crafted CLAUDE.md file is the single highest-leverage improvement you can make to Claude Code's output quality
- Slash commands like
/init,/compact, and custom commands give you precise control over Claude's behavior - Hooks let you automate formatting, linting, and testing so Claude's output meets your standards automatically
- Subagents keep your main context window clean by offloading research and exploration to separate sessions
- Plan mode forces Claude to think before it acts, dramatically reducing wasted iterations on complex tasks
- Context management is the meta-skill: everything else depends on keeping Claude focused on the right information
CLAUDE.md Mastery
1. Craft Your CLAUDE.md by Hand
The /init command generates a decent starting point, but the best CLAUDE.md files are hand-written. Auto-generated files tend to be bloated with obvious information Claude could infer from your codebase. Instead, focus on the things Claude cannot figure out on its own:
- Build and test commands specific to your project
- Architectural decisions and the reasoning behind them
- Code style preferences that differ from defaults
- File naming conventions
- Common gotchas that waste time
Keep it under 500 lines. Every line costs tokens, and tokens cost context.
2. Use the CLAUDE.md Hierarchy
Claude Code reads CLAUDE.md files at multiple levels:
- Root CLAUDE.md: Project-wide instructions loaded every session
- Child directory CLAUDE.md files: Loaded on demand when Claude works in that directory
- User-level CLAUDE.md: Personal preferences that apply across all projects (
~/.claude/CLAUDE.md)
In a monorepo, put shared conventions in the root file and service-specific context in child directories. A frontend package gets its own CLAUDE.md with component patterns and styling rules. The backend package gets one with API conventions and database schemas.
3. Use Progressive Disclosure
Do not dump everything Claude might need into CLAUDE.md. Instead, tell Claude where to find information:
## Architecture
See docs/architecture.md for system design decisions.
See docs/api-contracts.md for API response formats.
Run `make docs` to generate the latest API documentation.
This approach keeps the initial context small while giving Claude a path to detailed information when it actually needs it.
Slash Commands
4. Use /compact Religiously
The /compact command summarizes your conversation and clears old context. This is critical for long sessions. Claude Code's 200K context window is large, but it fills up faster than you think when Claude is reading files, writing code, and running tests.
Run /compact after every major milestone. Finished implementing a feature? Compact. Fixed a bug? Compact. About to switch to a different part of the codebase? Compact.
The rule of thumb: if your session has been running for more than 15 minutes, you probably need to compact.
5. Create Custom Slash Commands
Custom slash commands live in the .claude/commands/ directory as markdown files. The filename becomes the command name. This is one of the most underused features in Claude Code.
Create a file at .claude/commands/review.md:
Review the changes in the current branch compared to main.
Focus on:
- Logic errors and edge cases
- Performance implications
- Security concerns
- Test coverage gaps
Use `git diff main...HEAD` to see the changes.
Be specific. Reference line numbers. Suggest fixes, not just problems.
Now /project:review runs a thorough code review every time. Build commands for your most common workflows: deploying, debugging, writing tests, updating docs.
6. Use /init on Every New Project
Before writing a single prompt, run /init. Claude scans your codebase and generates a CLAUDE.md with build commands, directory structure, key dependencies, and coding conventions. It saves you from the most common mistake new users make: giving Claude zero context about the project and then wondering why it writes code that does not match your stack.
After /init, edit the generated file. Remove the obvious stuff. Add the non-obvious stuff. This 5-minute investment pays for itself within the first hour.
Hooks
7. Auto-Format After Every Edit
Hooks are deterministic actions that run at specific moments in Claude's workflow. The most universally useful hook is auto-formatting after file edits.
In .claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"type": "command",
"command": "npx prettier --write \"$CLAUDE_FILE_PATH\" 2>/dev/null || true"
}
]
}
}
Claude writes code. Prettier formats it. You never have to think about formatting again. The 2>/dev/null || true ensures the hook does not fail on non-JS files.
8. Run Linters Automatically
Extend the PostToolUse pattern to catch errors before they accumulate:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"type": "command",
"command": "npx eslint --fix \"$CLAUDE_FILE_PATH\" 2>/dev/null || true"
}
]
}
}
When the linter finds problems, the output feeds back to Claude, which can then fix the issues immediately. This creates a tight feedback loop where code quality stays high throughout the entire session.
9. Guard Dangerous Operations with PreToolUse
PreToolUse hooks run before Claude takes an action. Use them to prevent Claude from doing things you do not want:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"type": "command",
"command": "echo \"$CLAUDE_TOOL_INPUT\" | grep -qE '(rm -rf|git push --force|drop table)' && echo 'BLOCKED: Dangerous command' && exit 1 || true"
}
]
}
}
This blocks destructive commands before they execute. You can adapt the pattern for any operation you want to restrict.
Subagents
10. Offload Research to Subagents
Subagents are separate Claude sessions spawned from your main session. They have their own context window, which means your main session stays clean.
When Claude needs to research something, reading a long file, exploring an unfamiliar part of the codebase, or analyzing a complex dependency, offload it to a subagent. The subagent returns a summary. Your main context stays focused.
The pattern: one task per subagent. Do not try to make a subagent do five things. Spawn five subagents instead.
11. Create Custom Subagents for Recurring Tasks
Custom subagents live in .claude/agents/ as markdown files. Define their personality, tool access, and focus area:
Create .claude/agents/reviewer.md:
You are a code reviewer. Your job is to find bugs, security issues, and performance problems.
You have access to: Read, Glob, Grep
You do NOT have access to: Write, Edit, Bash
Be ruthless. Do not suggest stylistic changes. Focus on correctness and security.
This reviewer agent cannot modify code. It can only analyze. That constraint makes it better at its specific job while preventing scope creep.
12. Use the Explore Pattern in Plan Mode
Before implementing a complex feature, spawn a subagent to explore the existing codebase. The subagent reads relevant files, identifies patterns, and returns a summary of how similar features are implemented. Your main session then uses that summary to build the feature consistently.
This pattern is especially powerful in large codebases where the main session would waste significant context just reading files.
Plan Mode
13. Force Plan Mode for Non-Trivial Tasks
Plan mode makes Claude write out its approach before executing anything. For any task that involves more than 2-3 files or requires architectural decisions, plan mode dramatically reduces wasted iterations.
Type your request and add "plan first" or use the plan mode toggle. Claude will output a structured plan with specific files to change, the approach for each change, and potential risks. Review the plan before letting Claude execute.
The time spent reviewing a plan is always less than the time spent undoing a bad implementation.
14. Use Plans as Checkpoints
Break complex features into phases. Have Claude plan phase 1, execute it, compact, then plan phase 2. Each phase gets the full context window. This approach handles features that would otherwise exceed Claude's effective working memory.
Phase 1: Create the database schema and migrations
Phase 2: Build the API endpoints
Phase 3: Add the frontend components
Phase 4: Write tests and integration tests
After each phase, verify the work before moving on. This is how you ship features that are too complex for a single session.
Context Management
15. Start Fresh When Context Gets Stale
If Claude starts producing lower quality output or seems confused, do not keep prompting. Start a new session. Claude's context window is a finite resource, and once it fills up with irrelevant information, performance degrades.
The cost of starting fresh is lower than the cost of fighting a polluted context. Your CLAUDE.md ensures Claude picks up the essential context automatically.
16. Be Specific in Your Prompts
Vague prompts produce vague results. Compare:
Bad: "Fix the authentication bug" Good: "The login endpoint at src/api/auth.ts returns 500 when the user's email contains a plus sign. The issue is in the email validation regex on line 47. Fix the regex and add a test case for emails with plus signs."
The good prompt gives Claude exactly what it needs. No time wasted reading files to understand the problem. No ambiguity about what "fix" means.
17. Use File References to Direct Attention
When you reference specific files in your prompt, Claude focuses its attention there instead of scanning the entire codebase. This is faster and produces better results:
Look at src/components/Dashboard.tsx and src/hooks/useAnalytics.ts.
The dashboard re-renders every 2 seconds because useAnalytics
creates a new object reference on every call. Memoize the return value.
Advanced Techniques
18. Chain Claude Code with Git Workflows
Claude Code has deep git integration. Use it:
- "Create a new branch called feat/user-profiles, implement the user profile page based on the Figma spec in docs/specs/profiles.md, write tests, and open a PR"
- Claude handles the entire workflow: branch creation, implementation, testing, commit messages, and PR description
This is where Claude Code's agentic nature shines. You are not asking for code snippets. You are delegating an entire workflow.
19. Use MCP Servers to Expand Capabilities
MCP servers give Claude access to external tools. The highest-leverage MCP servers for most developers:
- GitHub MCP: Read issues, create PRs, review code directly
- Brave Search MCP: Let Claude research documentation and solutions
- Playwright MCP: Automate browser testing and screenshots
Install them once and Claude can use them automatically in any session. Check out our complete MCP setup guide for step-by-step instructions.
20. Build a Feedback Loop with tasks/lessons.md
Create a tasks/lessons.md file in your project. After every correction you make to Claude's output, add a note:
## Lessons
- Always use `pnpm` not `npm` in this project
- Test files go in `__tests__/` not next to source files
- API responses must include `requestId` field for tracing
- Never use default exports, always named exports
Reference this file in your CLAUDE.md. Over time, Claude stops making the same mistakes. This is how you train Claude to work the way your team works.
Workflow Integration Tips
Combining Techniques
The real power comes from combining these techniques. A typical power user session looks like this:
- Start with a well-crafted CLAUDE.md (tips 1-3)
- Use
/initif it is a new project (tip 6) - Enter plan mode for the task (tip 13)
- Spawn a subagent to explore relevant code (tip 12)
- Execute the plan with hooks running auto-format and lint (tips 7-8)
- Use
/compactbetween phases (tip 4) - Commit with git integration (tip 18)
- Update lessons.md with anything learned (tip 20)
This workflow handles tasks from simple bug fixes to complex multi-file features. The structure keeps Claude focused and the output quality high.
Common Mistakes to Avoid
Overloading CLAUDE.md: If your CLAUDE.md is over 500 lines, Claude spends too many tokens reading instructions instead of doing work. Trim it.
Skipping plan mode: The developers who complain about Claude "going in circles" are almost always skipping plan mode. Plan first. Execute second.
Ignoring context limits: Claude does not tell you when its context is getting full. Watch for declining output quality and compact or restart proactively.
Not using hooks: Every minute Claude spends on formatting is a minute it could spend on logic. Automate the mechanical stuff.
Where to Go From Here
These 20 techniques cover the features that actually move the needle. If you are new to Claude Code, start with the CLAUDE.md tips and plan mode. Those two changes alone will transform your experience.
For a deeper look at how Claude Code compares to other AI coding tools, see our Claude Code vs Cursor comparison. If you want to understand the MCP ecosystem, read our guide to the best MCP servers. And if you are building on top of Claude programmatically, our API beginner's guide covers everything you need to get started.
The tools are only getting better. The developers who invest in learning them deeply now are the ones who will compound that advantage over the next 12 months.
The Claude Code Brief. Weekly. No noise.
One email/week. MCP patterns, agent architectures, and tools builders actually use in production.
No spam. Read the archive first.