Claude Code is Anthropic’s terminal-native coding agent. Unlike an IDE autocomplete plugin, it runs inside your shell right next to git, cargo, npm, pytest, and your test databases—reading files across a repository, editing code, running commands, inspecting real compiler errors, and iterating until checks pass.
Across the twelve public repositories in this workspace, we use Claude Code daily alongside Codex for multi-file Rust, PostgreSQL, and SvelteKit builds. Most getting-started guides only show a toy demo and skip the operational questions engineers actually hit in week one: clean installation on Mac/Windows, Pro vs. Max vs. API key pricing, managing usage limits, updating/uninstalling cleanly, and keeping the agent from wrecking your repo.
Here is the complete practical reference.
1. Install, update, and uninstall Claude Code (Mac & Windows)
Anthropic recommends the native installer (self-contained binary, no Node.js version drift), though npm remains available on older setups.
macOS & Linux
# Recommended native installer
curl -fsSL https://claude.ai/install.sh | bash
# Verify installation and check environment health
claude --version
claude doctorWindows (PowerShell or WSL)
On Windows, Claude Code runs either natively via PowerShell (requires Git for Windows) or inside WSL2 (strongly recommended if your backend toolchain targets Linux):
# Windows native PowerShell installer
irm https://claude.ai/install.ps1 | iex
(Inside WSL2 Ubuntu, use the macOS/Linux curl -fsSL https://claude.ai/install.sh | bash command instead.)
How to update Claude Code
claude update
If you originally installed via npm, run npm install -g @anthropic-ai/claude-code@latest—or migrate to the native installer (claude install) so auto-updates stay clean.
How to uninstall Claude Code
# If installed via native binary (macOS/Linux):
rm -f ~/.local/bin/claude
# If installed via npm:
npm uninstall -g @anthropic-ai/claude-code
# Optional: remove local config, session logs, and auth state
rm -rf ~/.claude ~/.claude.json2. Claude Code pricing: Pro vs. Max vs. API Key
One of the first decisions is how you authenticate and pay. Run claude in a project folder and it walks you through signing in with either a Claude.ai subscription or an Anthropic Console API key:
| Billing mode | Approximate cost | How limits work | Best fit |
|---|---|---|---|
| Claude Pro | $20 / month | Rolling 5-hour usage window + weekly caps shared with claude.ai | Part-time coding, learning, side projects, light daily edits |
| Claude Max (5× / 20×) | $100 or $200 / month | Much higher rolling session & weekly quotas with priority access to flagship models | Full-time engineers running multi-file refactors and long test loops every day |
Anthropic API Key (ANTHROPIC_API_KEY) | Pay-per-token (exact API rates) | No 5-hour quota wall; billed per input/output/cached token up to your Console spend limit | Headless CI/GitHub Actions, sporadic use, or enterprise teams with strict cost accounting |
Setting up a Claude Code API key safely
If you use API billing (especially in CI or headless runs):
- Create a dedicated API key in the Anthropic Console with a hard monthly spend cap before running a single agent loop.
- Export
ANTHROPIC_API_KEYin your shell profile or CI secret store—never commit it into.envfiles tracked by git or paste it intoCLAUDE.md. - Watch token usage live with
/costinside a session so a stuck compile loop never surprises your billing card.
3. Managing Claude Code usage limits (without starving quality)
Engineers on Pro or Max frequently wonder why one session lasts three hours and another hits the 5-hour limit in twenty minutes. Almost always, it comes down to context bloat:
- Run
/clearbetween unrelated tasks. Every turn resends the entire session history inside the context window. Fixing a bug in auth and then pivoting to a CSS tweak in the same thread drags 100K stale tokens into every single CSS edit. - Use
/compactwhen a long task gets heavy. Compacting summarizes completed steps before the thread hits 60–70% context utilization. - Keep
CLAUDE.mdlean (under ~60–80 lines).CLAUDE.mdis loaded on every turn—keep it focused on build commands, test invariants, and forbidden patterns (see CLAUDE.md and AGENTS.md: what actually works). - Match model size to the task. Use Sonnet for routine implementation, tests, and refactors; save Opus/heavy reasoning for tricky architecture design, concurrency bugs, and hard audits.
- Avoid dumping giant logs into stdout. Pipe verbose test suites through
tail -n 60or run targeted single-test filters so a 20,000-line log does not eat half your context in one tool call.
4. Essential workflow habits for real repositories
Start with a plan, then let it verify against real commands
For any change touching more than 2 files, use Plan Mode (Shift+Tab in the CLI) first so Claude reads the relevant modules and proposes exact file edits before touching disk. Once you approve the plan, require it to run your actual compiler, linter, and test suite.
Wire GitHub workflows & headless mode cleanly
Claude Code supports non-interactive headless execution (claude -p "...") for scoped automation—such as triaging failing CI logs, checking PR diffs against repo invariants, or generating changelogs—using explicit --allowedTools permissions so CI jobs cannot execute arbitrary destructive commands.
Isolate databases and run a second reader
Two guardrails from our own multi-repo builds make the biggest reliability difference:
- Never point a coding agent at staging or a shared local DB. Give tests ephemeral databases with checksummed migrations (how to isolate PostgreSQL for AI coding agents).
- Do not let the same session review its own complex fix. After Claude Code lands a tricky patch, hand the clean
git diffto a fresh session (or to Codex) instructed to attack edge cases and verify negative tests. That single habit caught serious bugs inside our own passing fixes (Codex vs Claude Code vs Cursor).
Frequently asked questions
Should I use Claude Code with a Pro/Max subscription or an Anthropic API key? For heavy daily interactive coding, a flat-rate Claude Pro ($20/mo) or Max ($100–$200/mo) subscription is usually much cheaper than paying per token via API, because multi-file agent loops consume hundreds of thousands of cached and uncached tokens per hour. An API key (Console billing) makes more sense for CI pipelines, sporadic usage, or team billing with hard spend caps.
How do I update or uninstall Claude Code cleanly?
Run claude update directly from your terminal (or re-run the native installer / npm update -g @anthropic-ai/claude-code if installed via npm). To uninstall, remove the native binary (or run npm uninstall -g @anthropic-ai/claude-code) and optionally delete ~/.claude and ~/.claude.json if you want to clear local settings and caches.
Why does Claude Code hit usage limits faster on big repositories?
Every turn in an active session resends the conversation history, CLAUDE.md instructions, tool schemas, and recent file/command outputs. Letting one session grow to 150K+ tokens burns your 5-hour quota much faster than running /clear or /compact between tasks.