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
| Command | What it does |
claude | Start an interactive session. |
claude "task" | Run a one-time task. |
claude -p "query" | Run a one-off query and exit (headless / pipeable). |
claude -c | Continue the most recent conversation in this directory. |
claude -r | Resume a previous conversation. |
claude --permission-mode plan | Start in plan mode (research and propose, no edits). |
Session commands (type inside Claude Code)
| Command | What it does |
/help | Show available commands. Type / to see them all. |
/clear | Clear conversation history — start fresh between unrelated tasks. |
/compact | Summarize history to free context (e.g. /compact Focus on test output). |
/context | See what's filling the context window. |
/rewind · double-tap Esc | Restore code + conversation to an earlier checkpoint. |
/resume | Return to a past session. |
/model · /config | Switch the model mid-session; set defaults. |
/usage | See token usage broken down by skills, subagents, and MCP servers. |
/mcp | List, enable, and disable connected MCP servers. |
/exit · Ctrl+D | Exit Claude Code. |
Permission modes
Press Shift+Tab to cycle default → acceptEdits → plan; the current mode shows in the status bar.
| Mode | Runs without asking |
default | Reads only — you approve each edit and command. |
acceptEdits | Reads, file edits, and common filesystem commands in your working directory — review with git diff after. |
plan | Reads only; researches and proposes a plan you approve before any edit. |
auto | Everything, with background safety checks (research preview; account requirements apply). |
dontAsk / bypassPermissions | Locked-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
| Choice | When |
| Sonnet | Most coding work — strong and lower cost. The day-to-day default. |
| Opus | Complex architectural decisions or multi-step reasoning. Switch with /model. |
| Haiku | Simple 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.