Claude Code — Quick reference

Anthropic's agentic coding tool: it runs in your terminal (also VS Code, JetBrains, Desktop, and the web), reads your whole project, edits across files, runs your code, and works with git — all from plain-English requests.

At a glance

What it is: a terminal agent that reads your codebase, makes coordinated multi-file edits, runs commands and tests, and creates commits and pull requests. Where it runs: Terminal CLI, VS Code, JetBrains, Desktop app, and the web at claude.ai/code — one engine, shared CLAUDE.md and MCP servers across all of them. Pricing: Pro $17/mo annual · $20/mo includes Claude Code · Max from $100/mo (5× or 20× usage). No free tier; API/Console accounts pay per token.

Install & first task

Install
macOS/Linux: curl -fsSL https://claude.ai/install.sh | bash. Windows PowerShell: irm https://claude.ai/install.ps1 | iex. Also brew install --cask claude-code or winget install Anthropic.ClaudeCode.
Start
From your project folder run cd your-project && claude. You log in on first use. Type a task in plain English; Claude shows changes and asks before editing files.
claude "Read measurement_data.csv and write a Python script that plots a
heatmap of sample vs condition with seaborn. Save it as heatmap.png and run it."

Shell commands

CommandWhat it does
claudeStart an interactive session.
claude "task"Run a one-time task.
claude -p "query"Run a one-off query and exit (headless / pipeable).
claude -cContinue the most recent conversation in this directory.
claude -rResume a previous conversation.
claude --permission-mode planStart in plan mode (research and propose, no edits).

Session commands (type inside Claude Code)

CommandWhat it does
/helpShow available commands. Type / to see them all.
/clearClear conversation history — start fresh between unrelated tasks.
/compactSummarize history to free context (e.g. /compact Focus on test output).
/contextSee what's filling the context window.
/rewind · double-tap EscRestore code + conversation to an earlier checkpoint.
/resumeReturn to a past session.
/model · /configSwitch the model mid-session; set defaults.
/usageSee token usage broken down by skills, subagents, and MCP servers.
/mcpList, enable, and disable connected MCP servers.
/exit · Ctrl+DExit Claude Code.

Permission modes

Press Shift+Tab to cycle defaultacceptEditsplan; the current mode shows in the status bar.
ModeRuns without asking
defaultReads only — you approve each edit and command.
acceptEditsReads, file edits, and common filesystem commands in your working directory — review with git diff after.
planReads only; researches and proposes a plan you approve before any edit.
autoEverything, with background safety checks (research preview; account requirements apply).
dontAsk / bypassPermissionsLocked-down CI, or isolated containers/VMs only.

Prompting patterns

Be specific
"Fix the parser bug where rows with a missing e-value are dropped" beats "fix the bug". Specific asks mean fewer file reads.
Break into steps
Number the work: 1) parse the output, 2) keep the top hit per query, 3) write a CSV + histogram.
Let it explore first
Ask Claude to analyse the pipeline before changing it. Plan mode is built for this.
Course-correct early
Press Esc to stop the moment it heads the wrong way, then re-prompt sharper.
Give verification targets
Include a failing test or expected output so Claude can check its own work.
Keep context lean
/clear between unrelated tasks; vague "improve this codebase" triggers broad, costly scanning.

Customise & extend

CLAUDE.md
A markdown file in your project root, read at the start of every session — coding standards, preferred libraries, how to run tests. Keep it under ~200 lines.
Skills
A SKILL.md (e.g. .claude/skills/review-pr/SKILL.md) creates /review-pr. Loads only when used. Follows the open Agent Skills standard.
Subagents
Delegate noisy side-work to a subagent with its own context window; route simple tasks to a cheaper model (e.g. model: haiku).
Hooks
Run a shell command before/after actions (auto-format, lint, filter logs) via settings.json — deterministic, always runs.
MCP
Connect external tools and data (Google Drive, Jira, Slack, custom). Tool definitions are deferred, so idle servers cost almost nothing.
Headless / CI
tail -200 app.log | claude -p "flag anomalies". Pipe data in, get results out; drop into scripts or CI. /schedule runs Routines on a schedule.

Models & cost

ChoiceWhen
SonnetMost coding work — strong and lower cost. The day-to-day default.
OpusComplex architectural decisions or multi-step reasoning. Switch with /model.
HaikuSimple subagent tasks where speed and cost matter most.
Charged by API token consumption; subscription pricing at claude.com/pricing. Across enterprise deployments the average is ~$13 per developer per active day and $150–250 per developer per month, staying below $30/active day for 90% of users. Use /usage to track spend; /clear and the right model are your biggest cost levers.

Gotchas & tips

No free tier — a paid Claude plan (Pro and up) is required to run it at all.
It writes files directly — always start it in the correct project folder, and review the diff before accepting in acceptEdits mode.
Plan first for anything non-trivial — Shift+Tab into plan mode to avoid expensive re-work.
Keep CLAUDE.md lean — it loads every session; move long procedures into Skills, which load on demand.
Verify current numbers at claude.com/pricing and code.claude.com/docs — features and pricing change.