Tutorial, use cases and tips to get the most out of Claude Code.
Claude Code is a coding agent that integrates directly into your terminal or IDE. Unlike a regular chatbot, it reads your entire project, runs commands, modifies files, and works autonomously on complex tasks. The key insight: it's not a passive assistant you query — it's an active collaborator you direct.
npm install -g @anthropic-ai/claude-codeLaunch it from your project root — not a subfolder. Claude Code reads your file structure to understand the full context, and starting elsewhere partially blinds it.
For daily speed, add an alias to your ~/.zshrc or ~/.bashrc:
alias cc="claude"You type cc instead of claude every session.
CLAUDE.md is a Markdown file placed at your project root. Claude Code reads it automatically every session — it's your permanent context.
What to put in it:
Technical architecture (stack, naming conventions, folder structure)
Coding rules (style, patterns to follow, things to never do)
Useful commands (npm run dev, test scripts, etc.)
Past mistakes and how to avoid them
The Anthropic team's golden rule: whenever Claude makes a mistake and gets corrected, have it write a rule in CLAUDE.md so it doesn't repeat it. The file improves itself over time.
Keep it short: Claude Code's creator Boris Cherny keeps his file around 2,500 tokens (~100 lines). A file that's too long dilutes the context.
Plan Mode lets Claude read files and answer questions without making changes. It's the thinking step before execution.
Activate it with Shift+Tab to cycle between modes (Normal → Plan → Auto-Accept).
The recommended 4-step workflow:
Enter Plan Mode
Ask Claude to explore the relevant files
Ask for a detailed implementation plan, edit it if needed (Ctrl+G)
Switch back to Normal Mode and let Claude code against the plan
Anthropic's internal testing shows unguided attempts succeed around 33% of the time. Planning dramatically reduces ambiguous decisions.
Use it for: multi-file changes, architecture decisions, unfamiliar code. Skip it for: simple, clearly scoped tasks you can describe in one sentence.
Context is your most precious resource. When it fills up, Claude starts "forgetting" instructions from early in the session.
Essential commands:
CommandUse/clearStart fresh (blank context)/compactCondense the session without clearing it/contextVisualize and audit current context/rewindRoll back to a previous checkpoint
Best practice: use /compact during long sessions, /clear when switching to a distinct new task.
Don't dump information "just in case" — every file read, every command output burns context.
Create slash commands for every workflow you run multiple times a day — it eliminates retyping the same prompts. They live in .claude/commands/ and are versioned in git.
Example /fix-issue command:
markdown
---
name: fix-issue
description: Fix a GitHub issue
---
Analyze and fix the GitHub issue: $ARGUMENTS.
1. Read the details with `gh issue view`
2. Find the relevant files
3. Implement the fix
4. Write and run tests
5. Create a descriptive commit and open a PRRun with /fix-issue 1234. Build your own commands for recurring workflows: code review, test generation, doc updates, etc.
/btw (by the way) lets you ask a quick side question while Claude is mid-task, without interrupting its work or cluttering your conversation history. The answer pops up in an overlay, and Claude keeps going like nothing happened.
Useful for: checking a syntax detail, asking for a function explanation, clarifying a behavior — without breaking the session flow.
Boris Cherny runs 10–15 Claude Code sessions in parallel. Each session works on its own git worktree to avoid conflicts.
bash
git worktree add ../feature-auth feature/auth
git worktree add ../feature-api feature/apiLaunch a Claude Code session in each folder. Branches stay isolated, agents work in parallel. Especially effective for comparing multiple implementations of the same feature.
Hooks run scripts at specific points in Claude's workflow. Unlike CLAUDE.md instructions which are advisory, hooks are deterministic — they guarantee the action happens every time.
Practical examples:
Post-edit hook: run ESLint/Prettier after every file modification
Pre-commit hook: check TypeScript types before committing
Blocking hook: prevent any writes to the /migrations folder
Claude can write hooks itself — try prompts like "Write a hook that runs eslint after every file edit."
By default, Claude Code uses Opus 4.6 or Opus 4.7. For simple tasks, switch to Sonnet 4.6 to save quota.
The think keyword in your prompt activates high effort and triggers adaptive reasoning on Opus. Claude dynamically allocates its thinking based on problem complexity.
You can also set effort permanently with /effort (low / medium / high / xhigh). Set xhigh for complex architecture decisions, medium for routine tasks.
/loop runs a recurring task at a regular interval while your session is open. /schedule goes further: tasks persist even when the terminal is closed. "Cloud tasks" run on Anthropic's servers even when your device is off.
Example uses: monitoring stale PRs, batch-processing Slack notifications, generating automatic reports.
The Claude in Chrome extension gives your Claude Code session a real browser: it can see, interact with, and test what it builds in real time. The extension and Claude Code "work together for a build-test-verify workflow." Available in beta on any paid plan.
/teleport lets you transfer a cloud session to your local machine and keep coding. You can also start on mobile (Claude iOS/Android app, Code tab) and pick up on desktop.
Launching Claude without context — always start from the project root with an up-to-date CLAUDE.md.
Skipping Plan Mode on complex tasks — 5 minutes of planning saves 30 minutes of refactoring.
Letting context fill up without ever using /compact or /clear — response quality degrades progressively.
Putting instructions in CLAUDE.md that belong in settings.json — for deterministic behaviors (permissions, git attribution), use config, not advisory text.