Field guide · Agentic coding

Working with Claude Code, without the guesswork.

A practical guide to Claude Code — the terminal agent that reads your files, runs your commands, and works through problems while you watch, redirect, or step away. Most of what follows is something you can try as you read, not just take my word for.

01 The one constraint

Everything bends around the context window.

Claude's context holds the entire conversation — every message, every file it reads, every command's output. It fills fast, and model performance degrades as it fills. Most best practices[1] exist to protect it. Try it: feed the window, watch it forget, then reset.

5%
Sharp

Plenty of room. Claude follows instructions precisely and reasons clearly.


02 Feed it the right things

Point Claude at exactly what matters.

Naming a file is cheaper and sharper than pasting its contents — and pulling in the right screenshot, URL, or log often does more than a paragraph of explanation. These are the ways to load context deliberately. Tap any to expand.

@ file

@-mention a file

+
Type @ and a path (with autocomplete) to pull a specific file — or a whole folder — into context. The precise way to add exactly what Claude needs and nothing more.
$@src/auth/token.ts walk me through the refresh flow
image

Attach images & PDFs

+
Drag a screenshot or design mockup into the prompt, or paste an image straight from the clipboard. Ideal for "make it match this" and for bug reports — Claude reads the picture.
URL

Hand it a URL

+
Paste a link and Claude fetches it — an RFC, API docs, a failing build log — grounding the work in a real source without pasting the whole thing.
$read https://example.com/rfc-42 and list the open questions
stdin

Pipe data in

+
Stream stdin into a one-shot prompt — logs, JSON, another command's output. The fastest way to ask "what happened here?"
$cat error.log | claude -p "what is the root cause?"
--add-dir

Add a working directory

+
Grant access to files outside the current repo for this session — a shared library, a sibling service. This grants file access, not config discovery.
$claude --add-dir ../shared-lib # or /add-dir mid-session
lean

Reference, don't paste

+
A path costs a few tokens; pasting the file costs hundreds. Referencing with @ keeps the window lean so Claude stays sharp longer — which is the whole point of the context section above.

03 Close the loop

Give Claude a way to verify its work.

Claude stops when work looks done. Without a check it can run, "looks done" is the only signal — and you become the verification loop. Hand it a pass/fail and it iterates on its own. Tap a card to turn a vague ask into a verifiable one.

✕ Before

"implement a function that validates email addresses"

tap to fix →
✓ Verification criteria

write a validateEmail function. test cases: user@example.com → true, "invalid" → false, user@.com → false. run the tests after implementing.

← Claude can self-check
✕ Before

"make the dashboard look better"

tap to fix →
✓ Verify visually

[paste screenshot] implement this design. take a screenshot of the result and compare to the original. list the differences and fix them.

← screenshot is the check
✕ Before

"the build is failing"

tap to fix →
✓ Root cause

the build fails with this error: [paste]. fix it and verify the build succeeds. address the root cause — don't suppress the error.

← exit code is the check

04 The core loop

Explore, plan, code, commit.

Letting Claude jump straight to code can solve the wrong problem. Separate research from execution. Click through the four phases.

Enter plan mode. Claude reads files and answers questions without making any changes.

claude (plan mode)
read /src/auth and understand how we handle
sessions and login. also look at how we manage
environment variables for secrets.
⏵ reading 9 files… no edits made

05 Say what you mean

Specific context, fewer corrections.

Claude infers intent but can't read your mind. Reference files, name constraints, point to patterns. Flip the switch to see vague prompts sharpen.

Vague
Precise
Scope the taskwhich file, what scenario
Beforeadd tests for foo.py
Point to sourceswhere the answer lives
Beforewhy does ExecutionFactory have such a weird api?
Reference patternsmirror existing code
Beforeadd a calendar widget
Describe the symptom+ location + "fixed"
Beforefix the login bug

06 Right tool, right cost

Match the model to the task.

Switch any time with /model, check the current one with /status or your status line, and dial reasoning depth with /effort. Pick a model to see what it's for.

Everyday coding

Sonnet 4.6

Fast and capable for the bulk of implementation. The efficient default for writing and editing code once the plan is clear.

Effort level — adaptive reasoning
lowmediumhighmax

The recommended default. Balances speed and depth; higher levels can make the model overthink routine work.

Need one deep think without changing your setting? Drop "ultrathink" into a single prompt. Want planning on Opus and execution on Sonnet automatically? Use opusplan.


07 Learn by doing

Let Claude teach — and leave you the keys.

Output styles change how Claude responds. Beyond the default, there's a mode that explains its reasoning, and a Learning mode that hands you small, strategic pieces to write yourself via TODO(human) markers. Flip between them:

DefaultProactiveExplanatoryLearning
Default · efficient software engineering
› add a 300ms debounce to the search input
Added a debounce helper and wired it to the input handler.
✓ done

Set it in /config → Output style (saved to .claude/settings.local.json), or add "outputStyle": "Learning" to settings. Changes take effect after /clear or a new session.


08 Tune your environment

Set it up once, benefit every session.

A handful of configuration steps make Claude Code dramatically more effective — see the memory docs[9] for the CLAUDE.md details. Expand each to see how.

CLAUDE.md

Write an effective CLAUDE.md

+
A file Claude reads at the start of every session — bash commands it can't guess, code style that differs from defaults, repo etiquette. Run /init to generate a starter, then prune ruthlessly. Ask of every line: "would removing this cause a mistake?" Bloated files get ignored.
/permissions

Configure permissions

+
Cut the approval prompts without losing control: auto mode lets a classifier block only risky actions, allowlists permit known-safe tools like npm run lint, and sandboxing gives OS-level isolation so Claude can roam within boundaries.
gh / aws

Use CLI tools

+
CLI tools are the most context-efficient way to touch external services. Install gh and Claude opens PRs, reads issues, and posts comments natively. It also learns unknown tools — try "use foo-cli --help to learn it, then solve X."
MCP

Connect MCP servers

+
Run claude mcp add to wire in Notion, Figma, your database, or monitoring. Claude can then implement features straight from issue trackers, query data, and pull designs into the work.
hooks

Set up hooks

+
For actions that must happen every time with zero exceptions. Unlike CLAUDE.md (advisory), hooks are deterministic. Try "write a hook that runs eslint after every file edit" or "block writes to the migrations folder."
SKILL.md

Create skills & subagents

+
Skills add domain knowledge loaded on demand, so they don't bloat every conversation. Subagents run in their own context with their own tools — perfect for research-heavy or specialized tasks that would otherwise clutter your main thread.

09 Teach it new tricks

Skills: reusable instructions, loaded on demand.

A skill is a SKILL.md file with a description and instructions. Its body loads only when used, so long reference material costs almost nothing until you need it. Claude invokes a skill automatically when it's relevant, or you can trigger it with /skill-name. Pair them with subagents[10] for heavier, isolated work.

# ~/.claude/skills/summarize-changes/SKILL.md
---
description: Summarize uncommitted changes and flag anything risky.
  Use when the user asks what changed or wants a commit message.
---
## Current changes
!`git diff HEAD`

## Instructions
Summarize the diff in 2-3 bullets, then list risks
(missing error handling, hardcoded values, stale tests).

Personal skills live in ~/.claude/skills/ (all projects); project skills in .claude/skills/ (this repo). List what's available with /skills.

Skills you already have

Bundled, prompt-based skills ship with Claude Code — type / to see them:

/runlaunch your app/verifyconfirm a change works/debughunt a bug/looprepeat a prompt on an interval/code-reviewmulti-agent review/batchbulk edits/simplifyrefactor down/claude-apibuild on the API

Where to find more

01The Agent Skills standard
Skills follow the open Agent Skills spec[3], so a single SKILL.md is portable across Claude Code, Codex, Gemini CLI and 30+ other agents. Anything you write or download in this format travels with you.
02Install from the terminal
Browse thousands of community skills at the skills.sh directory[4], then add any of them by repo URL. Run npx skills init once per project, then:
$npx skills add <repo-url> --skill <name>
03Plugin marketplaces — /plugin
Plugins bundle skills plus agents, hooks, and MCP servers. Add a marketplace, then install from it — including Anthropic's official one:
$/plugin marketplace add anthropics/claude-plugins-official
04Security-audited stores
A meaningful share of public skills carry security flaws, so curated stores scan for prompt injection and credential theft. Whatever the source, skim a skill before you enable it.

10 Stay in control

Conversations are persistent and reversible.

The best results come from tight feedback loops — correct early, manage context aggressively, and rewind freely. These are your steering controls.

Stop Claude mid-action. Context is preserved, so you can immediately redirect it.

11 Multiply your output

One Claude is a start. Run many.

Claude Code scales horizontally — parallel sessions, non-interactive runs, and fan-out patterns. A fresh context reviews better than the one that wrote the code, so split the writer from the reviewer.

● Session A — Writer

Implement a rate limiter for our API endpoints.
Here's the review feedback: [Session B output]. Address these issues.

● Session B — Reviewer

Review the rate limiter in @src/middleware/rateLimiter.ts. Look for edge cases, race conditions, and consistency with existing middleware patterns.
# Fan out across files — loop one Claude per task
for file in $(cat files.txt); do
  claude -p "Migrate $file from React to Vue. Return OK or FAIL." \
    --allowedTools "Edit,Bash(git commit *)"
done

Where to actually run them

Same agents, different cockpit. Two are worth singling out — running Claude Code straight from the desktop app, and orchestrating a whole fleet in Cmux. Tap any surface to expand.

worktrees

Git worktrees

+
Built-in · CLI
Run separate CLI sessions in isolated git checkouts so edits never collide. Each agent gets full ownership of its own working directory.
$git worktree add ../feat-oauth
desktop

Claude Code in the desktop app★ highlight

+
Built-in · Desktop
Run and manage Claude Code visually from the Claude desktop app — spin up multiple local sessions side by side, each in its own worktree, and watch them progress without juggling terminal tabs. The friendliest way to parallelize if you don't live in the terminal, and you can drive sessions remotely from the mobile app too.
web

Claude Code on the web

+
Cloud
Launch sessions on Anthropic-managed cloud infrastructure in isolated VMs — no local setup, kickable from anywhere.
teams

Agent teams

+
Built-in · Auto
Automated coordination of multiple sessions with shared tasks, messaging, and a team lead — built for longer autonomous runs you spot-check.
cmux

Cmux — tmux for coding agents★ highlight

+
Third-party · macOS
A native macOS terminal[5] purpose-built for running many agents in parallel. Vertical tabs show each session's git branch, PR status, ports and latest notification; notification rings light up exactly the pane that needs you. cmux claude-teams runs Claude Code's agent-teams mode as native splits with full sidebar metadata — no manual tmux plumbing.
$cmux claude-teams

12 Recognize them early

Five ways sessions go sideways.

Every one of these traces back to a cluttered context window. Tap to reveal the fix.

01The kitchen-sink session
You start one task, ask something unrelated, then go back. Context is now full of irrelevant information competing with what matters.
Fix → /clear between unrelated tasks.
02Correcting over and over
Claude does something wrong, you correct it, it's still wrong, you correct again. The context is polluted with every failed approach.
Fix → After two failed corrections, /clear and write a better initial prompt that incorporates what you learned.
03The over-specified CLAUDE.md
The file grew too long, so Claude ignores half of it — the important rules get lost in the noise.
Fix → Ruthlessly prune. If Claude already does it right without the line, delete it or convert it to a hook.
04The trust-then-verify gap
Claude produces a plausible-looking implementation that quietly fails to handle edge cases.
Fix → Always provide verification — tests, scripts, screenshots. If you can't verify it, don't ship it.
05The infinite exploration
You ask Claude to "investigate" without scoping it. It reads hundreds of files and fills the window before doing any work.
Fix → Scope investigations narrowly, or use subagents so the exploration never touches your main context.

13 From the field

How Anthropic's own teams actually use it.

Distilled from "How Anthropic teams use Claude Code"[2] — interviews with power users across engineering, data, security, marketing, design, and legal. These are the patterns that don't show up in feature docs.

80%
less time researching ML concepts
Inference
~70%
of Vim mode written autonomously
Product Dev
10×
creative output in marketing
Growth
wks → hrs
launch-copy changes, with legal in the loop
Design
The throughline

Across every team, the move is the same: treat Claude Code as an autonomous-but-supervised collaborator. Give it a clean state and a way to verify, let it run, and when it drifts — restart from a sharper prompt rather than wrestle the wrong approach into shape.

Field-tested moves

01The slot-machine loop
Commit a clean state, let Claude run unattended for ~30 minutes, then accept the result or /rewind and start fresh. Power users report that restarting from a better prompt usually beats wrestling a wrong approach into shape. — Data Science & ML
02Classify the task: async vs synchronous
Peripheral features and prototyping → flip on auto-accept mode (Shift+Tab) and let Claude loop on write → test → iterate. Core business logic → drive it synchronously with detailed prompts and real-time review. Building this intuition is the single highest-leverage skill. — Product Development
03Tell it to try something simpler
Claude trends toward complex solutions by default, but responds well to being steered. When supervising, interrupt with "why are you doing this? try something simpler." — Data Science
04Commit as you go
Start from a clean git state and tell Claude to commit at each checkpoint, so any wrong turn is one revert away. "Let Claude talk first" — give it room to work autonomously with periodic check-ins rather than micromanaging each step. — Security & Product Dev
05Close the loop on CLAUDE.md
At the end of a session, ask Claude to summarize what it did and suggest improvements to your CLAUDE.md. Your docs compound with use, and the next run starts sharper — a continuous-improvement loop. — Data Infrastructure
06It is not just for code
Runbooks, documentation synthesis, onboarding, edge-case mapping, even fully non-technical workflows — finance queries, ad generation, legal copy sweeps — all run on plain-text instructions. Non-coders describe the steps; Claude executes them. — Multiple teams

Browse by team

Pick a team to see their standout use case, a top tip, and the impact.

Data

Data Infrastructure

Standout use case

Diagnosed a downed Kubernetes cluster from dashboard screenshots, then ran the exact fix — no networking specialist required.

Top tip

Write detailed CLAUDE.md files, and use MCP servers (not raw CLI) when data is sensitive.

Impact → Finance teammates with zero coding now run full data workflows themselves.

14 Cheat sheet

Everything you can type.

In a session, type / to see every command, or /help for the basics. This is the shortlist you'll actually reach for — filter by keyword or category.

/35 / 35
AllContextModelsUsageSessionSetupSkillsReview
@<file>Pull a specific file into context (with autocomplete)Context
/contextVisualize context-window usage as a grid, with tipsContext
/add-dir <path>Add a working directory for file access this sessionContext
/compact [focus]Summarize history to free context, optionally focusedContext
/clearWipe the conversation and free the window (alias /new)Context
/model [name]Switch model; left/right arrows adjust effortModels
/effort low|medium|high|maxSet adaptive-reasoning depthModels
/statusShow version, model, account & connectivityModels
opusplanPlan on Opus, then execute on Sonnet automaticallyModels
ultrathinkTrigger high effort for a single promptModels
/usagePlan usage limits and rate-limit statusUsage
/costToken usage statistics for the sessionUsage
/statsDaily usage, streaks, and model preferencesUsage
EscStop Claude mid-action; context is preservedSession
Esc EscOpen the rewind menuSession
/rewindRewind conversation and/or code to a checkpointSession
/branch [name]Fork the conversation at this point (alias /fork)Session
/resume [id]Resume a past conversation (alias /continue)Session
/rename [name]Name the session; shown on the prompt barSession
/btw <question>Ask a side question without derailing the threadSession
/diffInteractive viewer for uncommitted & per-turn changesSession
Shift+TabCycle permission modes (Ask → Auto-accept → Plan)Session
/initGenerate a starter CLAUDE.md for the projectSetup
/memoryEdit CLAUDE.md; toggle and view auto-memorySetup
/permissionsManage allow / ask / deny tool rulesSetup
/hooksView hook configurations for tool eventsSetup
/mcpManage MCP server connections & OAuthSetup
/configSettings: theme, model, output style & moreSetup
/doctorDiagnose your install and settingsSetup
/skillsList available skillsSkills
/agentsCreate & manage subagentsSkills
/pluginAdd marketplaces and install pluginsSkills
/reload-pluginsApply plugin changes without restartingSkills
/security-reviewScan branch changes for vulnerabilitiesReview
/pr-comments [PR]Fetch GitHub PR comments (needs gh)Review

Full reference in the built-in commands docs[6] and the interactive-mode docs[7].


Develop your intuition

These patterns aren't set in stone — they're starting points. Sometimes you should let context accumulate. Sometimes skip the plan. Sometimes a vague prompt is exactly right. Pay attention to what works — and when you're ready for more, start from the overview[8].

Over time you'll develop an intuition no guide can capture.

FAQ Quick answers

Common questions about Claude Code.

What is Claude Code?

Claude Code is Anthropic's terminal-based AI coding agent. It reads your files, runs your commands, and works through problems while you watch, redirect, or step away — all from the command line.

What is the CLAUDE.md file?

CLAUDE.md is a memory file Claude Code loads at the start of every session. Putting your project's conventions, commands, and constraints there means you set up context once and benefit from it in every conversation.

How do I get Claude Code to write correct code?

Give Claude a way to verify its own work — tests, scripts, or screenshots. Claude often produces plausible-looking code that quietly fails on edge cases, so if you can't verify a change, don't ship it.

What are Claude Code skills?

A skill is a SKILL.md file with a description and instructions. Its body only loads when it's needed, so skills give Claude reusable, on-demand expertise without permanently filling the context window.

Which Claude model should I use in Claude Code?

Match the model to the task. Reach for the most capable model on hard, ambiguous problems, and use a faster, lighter model for routine or well-scoped work to save time and context.

Can Claude Code run more than one agent at a time?

Yes. Beyond a single session you can run subagents and multiple Claude instances in parallel to divide a problem, explore alternatives, or work through independent tasks at once.


Notes & references
  1. Claude Code best practices. https://code.claude.com/docs/en/best-practices
  2. “How Anthropic teams use Claude Code” (PDF). https://www-cdn.anthropic.com/58284b19e702b49db9302d5b6f135ad8871e7658.pdf
  3. The Agent Skills standard. https://agentskills.io
  4. skills.sh — community skills directory. https://skills.sh
  5. Cmux — a terminal for coding agents. https://cmux.com/
  6. Built-in commands reference. https://code.claude.com/docs/en/commands
  7. Interactive-mode reference. https://code.claude.com/docs/en/interactive-mode
  8. Getting started / overview. https://code.claude.com/docs/en/overview
  9. Memory & CLAUDE.md. https://code.claude.com/docs/en/memory
  10. Subagents. https://code.claude.com/docs/en/sub-agents
Copied to clipboard