Claude Code: Anthropic's coding agent in your terminal
Install Claude Code with the native installer, sign in with a Claude plan, run your first agentic session, and learn the handful of slash commands that matter. Permissions, CLAUDE.md and headless mode included.
CLAUDE.md in place, and headless mode working for scripts.What Claude Code actually is
Claude Code is Anthropic’s terminal-native coding agent. You run claude inside a project; it reads files, edits them, runs your tests and shell commands, and commits โ after asking your permission for the risky parts.
It is not a chat window with a copy-paste workflow. The agent loop is the product: it looks at the repo, decides a next action, executes a tool, reads the result, and repeats until the task is done. What an agent loop is โ
Three things worth knowing before installing:
- It runs on your machine, in your terminal, against your real files.
- It needs a paid Claude plan or API access โ there is no permanent free tier.
- The “intelligence” is in the cloud; the hands are local. That split is what makes it useful and what makes permissions matter.
Step 1 โ Install
Pick one method. The native installer is the recommended one and auto-updates in the background.
macOS / Linux / WSL:
curl -fsSL https://claude.ai/install.sh | bash
Windows (PowerShell):
irm https://claude.ai/install.ps1 | iex
Windows (WinGet):
winget install Anthropic.ClaudeCode
macOS (Homebrew) โ note: Homebrew installs do not auto-update:
brew install --cask claude-code
Any OS (npm) โ requires Node.js 22+:
npm install -g @anthropic-ai/claude-code
Verify it landed:
claude --version
# 2.1.319 (Claude Code)
claude is "not recognized", your PATH hasn't picked up ~/.local/bin yet โ open a new terminal before debugging further.Step 2 โ Sign in
cd ~/projects/my-app
claude
On first launch it asks how to authenticate. Pick Claude account and finish the browser flow. You need one of:
| Access | What it costs | Good for |
|---|---|---|
| Claude Pro | $20/month ($17/month billed annually) | one person, daily use |
| Claude Max | $100/month | heavy agent use, bigger usage limits |
| Claude Ultra | $200/month | maximum limits |
| Claude Console (API) | pay per token | teams, cost tracking per project |
| Bedrock / Vertex / Foundry | cloud billing | enterprises already on those clouds |
On first login with a Console account, Claude Code creates a dedicated workspace so you can track what the agent spends.
Step 3 โ Your first session
Inside the session, talk to it like a colleague who can see the repo:
> explain the architecture of this project, then list the three riskiest files
Then give it something real:
> the login form shows a blank screen after a wrong password โ find the cause and fix it
Claude Code will read files, propose edits as diffs, and ask before running commands. Read the diffs. Approving blindly is how people ship broken code with an agent’s name on the commit.
The commands you’ll actually use
| Command | What it does |
|---|---|
/init | scans the repo and writes a CLAUDE.md |
/model | switch models mid-session |
/context | show what’s filling the context window |
/compact | summarize the conversation to free space |
/clear | start fresh |
/cost | tokens and spend so far |
/diff | review pending changes |
/permissions | inspect and edit what it’s allowed to do |
/resume | reopen an earlier session |
/rewind | roll back to an earlier checkpoint |
/review | code review of the current changes |
/doctor | diagnose installation problems |
Step 4 โ Teach it your project (CLAUDE.md)
/init creates a CLAUDE.md at the repo root. This file is injected into every session โ it’s how you stop repeating yourself:
# Project conventions
- Python 3.12, FastAPI, tests with pytest
- Run `pytest -q` before claiming a task is done
- Never touch `migrations/` without asking
- French UI strings, English code comments
Keep it short and factual. A 200-line CLAUDE.md eats context on every single turn. Why context is a budget โ
Step 5 โ Headless mode
The same agent works as a Unix command, which is where it becomes infrastructure:
claude -p "summarize what changed in the last 5 commits"
claude -p "list every TODO in src/ as a markdown checklist" > todos.md
-p (print mode) runs one turn, prints the answer, exits. Perfect for CI, git hooks, cron jobs, or piping into another tool.
The permission model (don’t skip this)
Claude Code asks before actions with side effects. Three outcomes per request: allow once, allow for this session, always allow (written to settings).
- Start restrictive. Widen only for commands you’d let a junior run unattended.
- Never blanket-allow
rm,git push, or anything touching production credentials. - Agent security is a real field now: prompt injection through files and web pages is the main attack path. Agentic risks โ
git push --force because it looked routine; and installing via npm on Node 20 โ the package needs Node 22+, and older versions print an EBADENGINE warning that people scroll past.Claude Code vs. the alternatives
| Claude Code | Codex CLI | Gemini CLI | |
|---|---|---|---|
| Free tier | no | ChatGPT Free/Go | yes, generous |
| Install | native script, npm, brew, winget | npm, brew | npm |
| Strength | long agentic sessions, hooks, subagents | sandbox modes, --oss local models | price, 1M context |
| Runs local models | no | yes (--oss) | no |
The pragmatic answer for most people: try Gemini CLI free, keep Claude Code if you already pay for Claude, and use Codex CLI if you want the same terminal workflow wired to a local model.