25 battle-tested tips from 800+ hours of Claude Code usage. Compiled from 4 expert sources + official docs. Organized by skill level.
Walid Boulanouar | AY Automate
Sources: Edmund Yong (602K views) | Academind (112K) | John Kim / Meta (251K) | Jaymin West (3K) | Official Docs
// 01Run /init on every new projectMedium
What it does Claude reads your entire codebase and generates a starter CLAUDE.md with project conventions, tech stack, and key patterns.
Why it matters Without /init, Claude guesses your project structure on every message. With it, Claude already knows your stack, test runner, linter config, and file layout before you ask anything.
# First thing in any new repo
claude
> /init
# Review the generated CLAUDE.md and edit it
Sources: John Kim, Edmund Yong
// 02Use # to add memory instantlyLow
What it does Press # during any session to append rules, preferences, or conventions directly to CLAUDE.md without leaving the terminal.
Why it matters When Claude does something you don't like, correct it once and make it permanent. No context switch, no file editing. The rule applies to every future session.
# During a session, press # and type:
Always use named exports, never default exports
# This gets appended to CLAUDE.md automatically
Sources: Official Docs
// 03Always start in Plan Mode (Shift+Tab)High
What it does Before executing anything, Claude gathers information, reads files, and presents a structured plan for your approval.
Why it matters Without plan mode, Claude dives straight into code changes. With it, you catch wrong assumptions before a single file is touched. The key: edit the plan, don't just approve it.
"I use plan mode almost exclusively for new features. Let Claude think before it writes."
# Toggle plan mode
Shift+Tab
# cycles: Plan -> Auto-accept -> Normal
# In plan mode, Claude shows its approach first
# READ the plan. EDIT it. Then approve.
Sources: Edmund Yong, Jaymin West
// 04Keep CLAUDE.md under 200-300 linesHigh
What it does Constrains your project instructions to only the most critical rules, using .claude/rules/ for everything else.
Why it matters More rules does not mean more compliance. A 50-line file followed 100% of the time beats a 500-line file followed 40%. Claude has finite attention. Front-load what matters most.
# CLAUDE.md = critical rules only (50-200 lines)
# .claude/rules/frontend.md = frontend conventions
# .claude/rules/testing.md = test patterns
# .claude/rules/api.md = API conventions
project/
CLAUDE.md # 150 lines max
.claude/rules/
frontend.md # loads when touching src/
testing.md # loads when touching tests/
api.md # loads when touching server/
Sources: John Kim, Official Docs
// 05Add build + test commands to CLAUDE.mdHigh
What it does Claude automatically runs your build and test commands after every change, self-corrects on failure, and retries until everything passes.
Why it matters This is the single most important pattern for automated AI loops. Without it, Claude writes code that looks right but doesn't compile. With it, Claude catches its own mistakes and fixes them before presenting results.
"The validation loop is the single most important thing for automated AI loops."
# Add this to CLAUDE.md
## Validation
After every code change:
1. Run: npm run build
2. Run: npm test
3. If errors, fix and re-run
4. Only present results when all pass
Sources: Edmund Yong, John Kim, Official Docs
// 06Use /compact when context fills upMedium
What it does Compresses your entire conversation context into a summary while keeping CLAUDE.md and system rules active.
Why it matters Don't start a new chat when context fills up — you lose accumulated understanding. /compact preserves the important context while freeing space for more work. Claude remembers what it built, just compressed.
# When you see context warnings or Claude forgets things
> /compact
# Claude summarizes conversation, keeps CLAUDE.md loaded
# You can keep working in the same session
Sources: Edmund Yong, Official Docs
// 07Use /clear for new featuresLow
What it does Wipes the entire conversation context and starts fresh while staying in the same terminal session.
Why it matters Old context bleeds into new tasks. If you just finished a database migration and now want to build a UI component, the database context pollutes Claude's thinking. /clear wipes. /compact summarizes. Know the difference.
# /compact = summarize + keep working (same task)
# /clear = wipe + start fresh (new task)
> /clear
# CLAUDE.md still loaded, but conversation is gone
Sources: Jaymin West, Official Docs
// 08Be explicit about which tools to useMedium
What it does Tells Claude exactly which tool, file, or approach to use instead of letting it guess.
Why it matters "Explore the codebase" is vague. "Read src/api/routes.ts and src/db/schema.ts, then propose changes" is precise. Explicit instructions remove randomness and reduce wasted tool calls.
# Bad: vague instruction
"Look at the API and fix the bug"
# Good: explicit instruction
"Read src/api/users.ts lines 45-80.
The getUserById function returns null
when the user exists but is deactivated.
Fix it to return a 403 status instead."
Sources: Academind, Jaymin West
// 09Git is your safety netLow
What it does Commit before every major Claude task so you have reliable recovery points.
Why it matters Claude can make sweeping changes across dozens of files. /rewind exists but is less reliable than git. A quick commit before asking Claude to refactor gives you a guaranteed rollback point.
# Before a big refactor
git add -A && git commit -m "checkpoint: before auth refactor"
# Ask Claude to do the refactor
"Refactor auth to use JWT middleware..."
# If it goes wrong
git diff # see what changed
git checkout -- . # revert everything
Sources: Academind, Official Docs
// 10Build a custom command libraryMedium
What it does Save repeating prompts as .claude/commands/*.md files and call them with /command-name from any session.
Why it matters If you type the same prompt more than twice, it should be a command. Commands ensure consistency, reduce typing, and compound over time.
"My 10 most-used commands replaced 6 hours of weekly work."
# .claude/commands/review.md
Review the file at $ARGUMENTS for:
1. Type safety issues
2. Missing error handling
3. Performance concerns
4. Security vulnerabilities
Present findings as a numbered list.
# Usage in any session:
> /review src/api/auth.ts
Sources: John Kim, Official Docs
// 11MCPs blow up your context — be surgicalHigh
What it does Every active MCP server adds its tool definitions to every single Claude call, consuming tokens even when unused.
Why it matters A single MCP with 50 tools can add thousands of tokens per request. Scope MCPs per-directory in settings.json so they only load when relevant.
"I try very hard not to use MCPs because they blow up context."
# Bad: global MCPs loaded everywhere
# Good: scoped MCPs in .claude/settings.json
{
"mcpServers": {
"database": {
"command":
"npx",
"args": [
"@modelcontextprotocol/server-postgres"
]
}
}
# Only put this in projects that need DB access
Sources: Edmund Yong, Jaymin West
// 12Use /context to audit token usageHigh
What it does Shows a detailed breakdown of where your context tokens are being spent — system prompt, CLAUDE.md, MCPs, conversation history.
Why it matters Most engineers never check where their tokens go. MCPs are usually the biggest offenders, sometimes consuming 30–50% of available context with tool definitions alone. You can't optimize what you don't measure.
> /context
# Example output:
System prompt: 12,400 tokens (8%)
CLAUDE.md: 2,100 tokens (1%)
MCP tools: 48,200 tokens (31%) <-- problem
Conversation: 89,000 tokens (57%)
Available: 4,300 tokens (3%)
Sources: Edmund Yong
// 13Scope Zapier/Composio MCP to 10 actions, not 8000High
What it does When connecting integration platforms, expose only the specific actions you need instead of loading the entire catalog.
Why it matters Zapier exposes 8,000+ actions by default. Each one becomes a tool definition in your context. That's potentially hundreds of thousands of wasted tokens. Pick 5–10 actions and skip the rest.
# Bad: expose everything
"composio": { "actions": "*" }
# Good: expose only what you use
"composio": {
"actions": [
"GMAIL_SEND_EMAIL",
"GOOGLE_CALENDAR_CREATE_EVENT",
"NOTION_CREATE_PAGE"
]
}
Sources: Edmund Yong
// 14Subagents = tasks, not rolesHigh
What it does Define subagents by specific tasks they perform, not vague roles they fill.
Why it matters "Frontend developer agent" is useless — it's a role without boundaries. "UI reviewer — uses Playwright to screenshot components, compares against design spec, reports mismatches" is a task with clear inputs, outputs, and tools. Task-scoped agents work. Role-scoped agents hallucinate.
# Bad: role-based agent
name:
frontend-developer
description:
Handles all frontend work
# Good: task-based agent
name:
ui-reviewer
description:
Screenshots components with Playwright,
compares against design spec images,
reports visual mismatches as a checklist.
tools:
Bash (playwright only), Read
scope:
src/components/**
Sources: Official Docs, John Kim
// 15Use worktrees for parallel workMedium
What it does Setting isolation to "worktree" gives each agent its own git worktree — a full copy of the repo that doesn't conflict with your working directory.
Why it matters Without worktrees, two Claude instances editing the same repo create file conflicts. With worktrees, each agent works in isolation. Perfect for parallel code review, testing, or feature branches.
# In agent definition or headless invocation
"isolation":
"worktree"
# Agent gets its own copy at:
# .git/worktrees/agent-session-xyz/
# No conflicts with your main working directory
Sources: Official Docs
// 16Path-scoped rulesHigh
What it does Rules in .claude/rules/ can specify glob patterns so they only load when Claude touches matching files.
Why it matters Your React component conventions are irrelevant when Claude is editing a database migration. Path-scoped rules keep context lean by only loading relevant instructions.
# .claude/rules/frontend.md
# paths: src/components/**, src/pages/**
Use functional components only.
All props must have TypeScript interfaces.
Use Tailwind, never inline styles.
Every component needs a unit test.
# This file ONLY loads when Claude reads/edits
# files matching src/components/** or src/pages/**
Sources: John Kim, Official Docs
// 17Use --json-schema for structured outputMedium
What it does Forces Claude to return output matching a strict JSON schema, parsing unstructured text into structured data.
Why it matters When you need machine-readable output — for CI pipelines, data processing, or chaining commands — JSON schema guarantees the shape. No more regex parsing of Claude's prose.
claude
-p "Extract all API endpoints from src/routes/" \
--json-schema '{
"type": "object",
"properties": {
"endpoints": {
"type": "array"
}
}
}'
Sources: Official Docs
// 18Chain Claude Code in CI/CDMedium
What it does Use claude -p (headless mode) in GitHub Actions, pre-commit hooks, and build pipelines to automate code quality checks.
Why it matters Claude becomes a quality gate in your pipeline. Every PR gets an AI review. Every commit gets checked against your conventions. AI quality gates catch issues that linters miss.
"Build script with AI quality gate."
# .github/workflows/ai-review.yml
- name:
AI Code Review
run: |
claude
-p "Review the changes in this PR.
Check for: security issues, missing tests,
breaking API changes. Output as markdown." \
--json-schema '{"type":"object","properties":{
"issues":{"type":"array"},
"approved":{"type":"boolean"}
}}'
Sources: Academind, Official Docs
// 19Multi-agent teams (experimental)High
What it does Multiple Claude instances coordinating on a shared task list with dependencies, running in parallel.
Why it matters One agent writes the backend API. Another builds the frontend components. A third writes tests. They work simultaneously, aware of each other's progress. Best for parallel review and independent workstreams.
# Enable in environment
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS
="1"
# Agents share a task list with dependencies
# Agent A: "Build /api/users endpoint"
# Agent B: "Build UserList component" (depends on A)
# Agent C: "Write integration tests" (depends on A+B)
Sources: Official Docs
// 20Persistent agent memoryHigh
What it does Setting memory: user in agent frontmatter lets the agent read and write a MEMORY.md file that persists across sessions.
Why it matters Without memory, every session starts cold. With persistent memory, agents accumulate knowledge: client names, past bugs, preferred patterns, things that failed before. Compound intelligence across sessions.
# .claude/agents/code-reviewer.md
---
name:
code-reviewer
memory:
user
---
You are a code reviewer. Check for patterns
that have caused bugs before (see MEMORY.md).
After each review, log new patterns found.
# MEMORY.md gets created automatically
# Agent reads it at start, writes to it during work
Sources: Official Docs
// 21Hooks as guardrailsHigh
What it does PreToolUse hooks intercept dangerous operations before they execute. PostToolUse hooks run automated checks after every edit.
Why it matters A PreToolUse hook can block Claude from deleting production config files. A PostToolUse hook can run ESLint after every file edit. Shell scripts as automated quality gates — no human intervention needed.
What it does A git-controlled markdown vault with CLAUDE.md, custom skills, agents, and commands that functions as a full business operating system.
Why it matters Claude Code isn't just a coding assistant. When you combine a structured knowledge base + CLAUDE.md + skills + agents + commands, you get a system that handles sales, content, client work, operations, and engineering. The compound effect is massive.
What it does Skills bundle instructions (SKILL.md), reference data, and scripts into self-contained workflow packages that Claude loads on demand.
Why it matters MCPs are for external API connections — databases, email, calendar. Skills are for your own processes — how you write proposals, how you research prospects, how you generate content. They don't burn context like MCPs do.
# .claude/skills/prospect-research/
SKILL.md # 'How to research a prospect'
references/
icp-scorecard.md # scoring criteria
talking-points.md # industry-specific angles
scripts/
enrich.py # pull LinkedIn data
score.py # calculate ICP fit
# Claude loads SKILL.md, reads references, runs scripts
# Zero context overhead when not in use
Sources: Original research, Official Docs
// 24The validation feedback loopHigh
What it does Combines build + test + lint commands in CLAUDE.md with Playwright visual testing to create a fully autonomous quality loop.
Why it matters Build and test catch logic errors. Lint catches style issues. But neither catches visual bugs. Adding Playwright screenshots gives Claude 'eyes.' It can see what it built, compare against expectations, and self-correct visual issues without human review.
# CLAUDE.md validation section
## Validation Loop
After every UI change:
1. npm run build
2. npm test
3. npx eslint src/ --fix
4. npx playwright screenshot http://localhost:3000
5. Compare screenshot to design spec
6. If mismatch, fix and re-run from step 1
7. Only present when all pass + visual match
Sources: Edmund Yong, John Kim
// 25Context engineering is the real skillHigh
What it does The deliberate practice of controlling what information enters Claude's context window and when.
Why it matters Prompt engineering is writing good instructions. Context engineering is controlling the entire information environment. The engineers who master this work 5–10x faster than those who just write good prompts. Context is the bottleneck, not the model.
"What you put in context matters more than what you prompt."
# Context engineering checklist:
1. CLAUDE.md: under 200 lines (critical rules only)
2. .claude/rules/: path-scoped (load on demand)
3. MCPs: surgical (5-10 actions, not 8000)
4. @imports: pull specific files, not directories
5. /compact: when context fills, don't start new chat
6. /clear: between unrelated tasks
7. /context: audit regularly, fix token hogs
8. Skills over MCPs for internal workflows
Sources: Edmund Yong, John Kim, Official Docs
The Efficiency Ladder
Each level compounds on the previous one
Level
Focus
Time Saved
Key Unlock
Everyone
Basics right
2–3 hrs/week
Plan mode + CLAUDE.md + validation loop
Power User
Context control
5–8 hrs/week
Scoped MCPs + path rules + subagents
Architect
Full system
15–20 hrs/week
Skills + agents + hooks + second brain
Quick Reference
All 25 tips at a glance
01Run /init on every new projectL1
02Use # to add memory instantlyL1
03Always start in Plan ModeL1
04Keep CLAUDE.md under 200-300 linesL1
05Add build + test to CLAUDE.mdL1
06Use /compact when context fillsL1
07Use /clear for new featuresL1
08Be explicit about tools to useL1
09Git is your safety netL1
10Build a custom command libraryL1
11MCPs blow up context — be surgicalL2
12Use /context to audit token usageL2
13Scope integrations to 10 actionsL2
14Subagents = tasks, not rolesL2
15Use worktrees for parallel workL2
16Path-scoped rulesL2
17--json-schema for structured outputL2
18Chain Claude Code in CI/CDL2
19Multi-agent teamsL3
20Persistent agent memoryL3
21Hooks as guardrailsL3
22The second brain patternL3
23Skills > MCP for custom workflowsL3
24The validation feedback loopL3
25Context engineering is the real skillL3
Start with Level 1. Master it. Then unlock Level 2.
Install Claude Code and start building.
$ npm install -g @anthropic-ai/claude-code
don't miss what's next.
playbooks, templates, and tools that actually save you hours. straight to your inbox. no spam. unsubscribe anytime.