The Beginner’s Guide to Claude Code — Nerdster.ai

Free guide · March 2026

The Beginner’s Guide to Claude Code

Everything you need to start coding with AI. Practical workflows, real tips from the creators at Anthropic, and a clear path from first session to power user — without the jargon.

200%
increase in code output
per Anthropic engineer
3–5x
parallel sessions via
git worktrees
65%
improvement in style
consistency with CLAUDE.md

What is Claude Code?

Claude Code is Anthropic’s command-line AI coding assistant. It lives in your terminal, understands your entire codebase, and can read files, write code, run commands, and manage git — all through natural language.

What makes it different

Unlike chat-based AI tools that only see what you paste in, Claude Code operates directly inside your project. It can explore your file structure, read any file, run your tests, and make changes across multiple files in a single session.

Agentic, not just chat

Claude Code doesn’t just answer questions — it takes actions. It edits files, runs shell commands, creates commits, and verifies its own work by running your test suite.

Full project context

It sees your whole codebase. Ask it to “find where the login bug is” and it will search files, trace logic, and pinpoint the issue — no copy-paste needed.

How to install

# Install via npm (requires Node.js 18+) npm install -g @anthropic-ai/claude-code # Start a session in your project directory cd your-project claude # Or use it non-interactively claude -p "add error handling to src/api.ts"

Where it runs

Terminal (standalone)

Works in any terminal. Just type claude to start. The most powerful way to use it.

VS Code extension

Opens as a panel inside VS Code. Claude can see your open files, cursor position, and workspace.

JetBrains plugin

Available for IntelliJ, PyCharm, WebStorm, and other JetBrains IDEs via the marketplace.

GitHub Actions

Runs in CI/CD with claude -p for automated code review, fixes, and PR generation.

Plan, code, test, review

This four-step loop is the single most recommended workflow from Anthropic’s own team and the developer community. Boris Cherny, creator of Claude Code, says: “Claude usually one-shots execution after a good plan.”

1

Plan first (always)

Start in Plan Mode (press Shift+Tab twice). Claude reads your codebase without making any changes. Go back and forth until the plan looks right. This single step prevents most mistakes.

2

Execute the plan

Switch out of Plan Mode and let Claude implement. With a good plan, Claude typically gets it right in one pass. Review each diff as it appears.

3

Let Claude verify its own work

This is the single highest-leverage tip. Put your test commands in CLAUDE.md so Claude runs them after every change. Verification loops 2–3x the quality of the final result.

4

Review the diff

Always check the changes before accepting. Use /diff to see pending changes at any time. Correct drift immediately — tight feedback loops produce the best results.

The one-sentence rule: If you can describe the exact code change in a single sentence, skip the plan and go straight to coding. If you cannot, plan first. This heuristic saves more time than any other.

When things go wrong

If Claude starts going off track, don’t keep pushing forward. Switch back to Plan Mode and re-plan. A fresh plan almost always beats accumulated corrections. The Anthropic team calls this the “re-plan, don’t brute-force” rule.

Use Plan Mode when…

Multi-file changes. Unfamiliar code. Complex or ambiguous tasks. You can’t describe the diff in one sentence.

Go direct when…

Clear, small scope. One-sentence diff. Quick fixes: typos, log lines, renames, simple patches.

Test-driven development with Claude

TDD is one of the highest-leverage patterns. Write a failing test first (“Do NOT write implementation yet”), then ask Claude for minimal code to pass it. Use a separate session to review — fresh context catches what the author misses.

CLAUDE.md — the project brain

CLAUDE.md is a markdown file that Claude reads automatically every session. It acts as persistent memory for your project — think of it as a briefing document for your AI coding partner.

From Boris Cherny: “Anytime we see Claude do something incorrectly, we add it to the CLAUDE.md, so Claude knows not to do it next time.” Their team’s CLAUDE.md is just ~2,500 tokens. They ruthlessly edit it until Claude’s mistake rate measurably drops.

Where CLAUDE.md files live

LocationScopeShare with team?
~/.claude/CLAUDE.mdGlobal — all your projectsNo (personal)
./CLAUDE.mdProject rootYes (commit to git)
./.claude/CLAUDE.mdLocal overridesNo (gitignored)
.claude/rules/*.mdPath-specific rulesYes (commit to git)

The ideal CLAUDE.md template

Keep it under 80 lines. If it’s too long, Claude starts ignoring parts.

# Project My App — Next.js SaaS for invoice management # Stack Next.js 15, TypeScript, Prisma, PostgreSQL # Commands npm run dev — Dev server | npm test — Jest | npm run lint # Conventions - snake_case for DB columns | API routes return { data, error } # Don't - Never use `any` | Never modify migration files directly

Include

Build/test commands, naming conventions, architecture rules, pitfalls Claude cannot infer from code.

Avoid

Personality instructions, file trees, things Claude discovers by reading code, generic advice.

Essential slash commands

These are the commands you’ll use every day. Type them directly in your Claude Code session.

CommandWhat it doesWhen to use
/planEnter Plan Mode (read-only)Before any multi-file change
/compactCompress conversation contextEvery 30 min or at ~60% usage
/clearReset context completelyWhen switching topics
/costShow token usage and spendTo monitor consumption
/diffShow pending file changesBefore committing
/initAuto-generate CLAUDE.mdFirst time in a new project
/memoryBrowse and edit saved memoryTo check what Claude remembers
/checkpointSave state (undo point)Before risky changes
/permissionsManage tool permissionsTo pre-approve safe commands
/add-dirAdd another directoryWhen working across repos

Terminal shortcuts

Starting sessions

claude — start interactive
claude -c — continue last session
claude -r — resume by name
claude -p "prompt" — headless mode

Configuration

claude --model opus — use Opus model
claude --model haiku — use Haiku (fast)
/config — open settings UI
/statusline — customise status bar

Thinking modes

You can control how deeply Claude thinks by using specific phrases in your prompt:

PhraseThinking budgetBest for
"think"~4,000 tokensRoutine tasks
"think hard"~16,000 tokensMulti-file changes
"ultrathink"~32,000 tokensArchitecture decisions

Managing your context window

Claude Code has a 200,000-token context window, but quality degrades well before it fills up. Managing this is the single most important technical skill for effective Claude Code use.

Quality degrades around 147k–152k tokens even though the window is 200k. Compact proactively at 60% — don’t wait for auto-compaction at the limit, which produces worse summaries.

The five rules of context hygiene

1

Run /compact proactively

At ~60% context usage (check with /cost), manually compact. Claude still has clear recall and produces a better summary than auto-compaction at 95%.

2

Run /clear between topics

Every time you switch to an unrelated task, clear the context. A clean session with a focused prompt always outperforms a bloated session with accumulated corrections.

3

Keep sessions under 45 minutes

After 2+ hours and multiple compactions, summary quality degrades. Start a fresh session instead.

4

Keep CLAUDE.md lean

CLAUDE.md is loaded into context every single turn. Every line costs tokens. Ruthlessly prune anything Claude can discover by reading the code itself.

5

Use subagents for heavy tasks

Delegate research, exploration, and verbose operations (like test runs) to subagents. They get their own context window and don’t pollute your main session.

Parallel sessions

The Claude Code team’s number one productivity tip: use git worktrees to run 3–5 Claude sessions in parallel. See the next page for a full breakdown.

Git worktrees — parallel Claude sessions

Git worktrees let you have multiple copies of the same repo checked out simultaneously, each in its own folder, sharing a single git history. Run a separate Claude Code session in each one for truly parallel work.

How it works

# Main repo ~/projects/my-app/ # main branch # Worktrees (separate folders, shared git history) ~/projects/my-app-wt-a/ # feature-auth branch ~/projects/my-app-wt-b/ # fix-contact branch ~/projects/my-app-wt-c/ # blog-update branch

Step by step

1

Create worktrees

git worktree add ../my-app-wt-a -b feature-auth

2

Open Claude in each

In each terminal tab, cd into a worktree and run claude. Each gets its own 200k context.

3

Shell aliases for quick switching

Add alias za="cd ~/projects/my-app-wt-a" to ~/.zshrc. One keystroke to hop.

4

Merge and clean up

git merge feature-auth && git worktree remove ../my-app-wt-a

Why worktrees, not just multiple terminals?

Multiple terminals (same folder)Git worktrees
All share the same files — edits collideEach has its own files — zero conflicts
Can’t be on different branchesEach is on its own branch
Claude sessions step on each otherCompletely isolated per worktree
Boris Cherny’s setup: 5 terminal tabs (each a worktree) + 5–10 web sessions. You become a reviewer cycling through PRs while Claude implements in parallel. No two worktrees can share the same branch.

Writing effective prompts

The way you phrase your requests makes a huge difference in output quality. Here are the patterns that work best, based on research from Anthropic, Spotify, and the developer community.

Good prompt

“Fix the login bug where users see a blank screen after entering wrong credentials in src/auth/Login.tsx

Weak prompt

“Fix the bug”

Five prompting principles

1

Describe the end state, not the steps

Tell Claude what “done” looks like and let it figure out how to get there. Spotify’s research found Claude performs better with outcome-focused prompts than step-by-step instructions.

2

One task per prompt

Don’t mix “build this feature AND review that code AND explain this concept” in one message. Separate modes into separate turns.

3

Provide verification targets

Include tests, expected outputs, or screenshots so Claude can check its own work. This is the single highest-leverage prompting technique.

4

Reference specific files

Say look at src/auth/Login.tsx rather than “look at the login code.” Precision saves tokens and reduces errors.

5

Correct drift immediately

When Claude starts going the wrong direction, stop it immediately. The best results come from tight, iterative feedback loops — not hoping it self-corrects.

The spec-driven pattern: Write a detailed implementation spec (even 12 steps is fine), then have Claude execute it step by step. The upfront investment in specification pays off dramatically in accuracy. One developer reports writing a spec in 2 hours, then Claude executing it perfectly.

Hooks, commands & subagents

Once you’re comfortable with the basics, these three features turn Claude Code from a helpful tool into an automated workflow engine.

Custom slash commands

Every repeated workflow should become a command. Boris Cherny’s most-used command is /commit-push-pr, which he runs dozens of times daily.

# Save as .claude/commands/review.md Review the following code for bugs, security issues, and style violations. Reference our conventions in CLAUDE.md. Files to review: $ARGUMENTS # Use it: /project:review src/api/auth.ts

Hooks — deterministic guardrails

Unlike CLAUDE.md instructions (which are advisory), hooks are guaranteed to run. They fire at specific moments in Claude’s lifecycle.

PatternHook eventWhat it does
Auto-formatPostToolUseRuns Prettier/ESLint on every edited file
Protect filesPreToolUseBlocks edits to .env, lock files
Auto-testPostToolUseRuns test suite after code changes
NotificationsStopDesktop/Slack alert when Claude finishes
Context injectionSessionStartLoad live data at session start

Subagents — specialist workers

Subagents are separate Claude instances that handle specific tasks without polluting your main context.

When to use subagents

Codebase exploration, security audits, code review, running verbose test suites, research that would fill your main context.

When NOT to use them

95% of tasks don’t need subagents. They’re expensive and add complexity. Use them only for genuinely large, domain-spanning work.

Create custom subagents by dropping .md files in .claude/agents/. Each gets its own name, tool set, model, and system prompt. Boris uses a “Code Simplifier” agent (cleans architecture) and a “Verify App” agent (runs browser tests).

Top 10 tips from the Claude Code team

Compiled from Boris Cherny’s viral X threads (millions of views), Anthropic’s internal blog, and the developer community.

#1

Plan before you code

Always start in Plan Mode. Go back and forth until the plan looks right, then execute.

#2

Parallelise with worktrees

The team’s number one productivity tip. Run 3–5 Claude sessions simultaneously.

#3

Give Claude verification loops

Tests, browser checks, bash commands. This 2–3x’s the quality of the final result.

#4

Invest in CLAUDE.md

Treat it as living documentation. When Claude makes a mistake, add a rule to prevent it.

#5

Automate with commands

Anything you do twice becomes a slash command in .claude/commands/.

#6

Use the heaviest model

Boris uses Opus with thinking for everything. Quality over speed.

#7

Hooks for guarantees

CLAUDE.md is advisory. Hooks are deterministic. Use both together.

#8

Re-plan, don’t brute-force

When things go sideways, switch back to Plan Mode. Don’t keep pushing forward.

#9

Keep sessions short

30–45 minutes per session. Fresh context beats accumulated corrections.

#10

Check commands into git

Skills and settings in git = institutional knowledge. New team members inherit workflows.

Anthropic results: Code output per engineer up 200% in 2026. Security team uses 50% of all custom slash commands. Growth team generates hundreds of ad variations in minutes with two specialised subagents.

What’s next

Ready to start building
with Claude Code?

Whether you’re a solo developer or leading a team, we can help you get set up with Claude Code, configure your CLAUDE.md, and build workflows that actually save time.

Book a Free Discovery Call →

Or email us at [email protected]

Nerdster.ai is a UK-based AI consultancy. We help businesses adopt AI tools, build custom workflows, and deploy private AI solutions — all without the jargon.

Sources: Boris Cherny’s X threads (Jan–Feb 2026), Anthropic official documentation, Anthropic engineering blog, developer community research.

Cyber Essentials Certified Anthropic AWS

© 2026 Nerdster Limited · Company No. 08223563 · Registered in England & Wales