AI 101

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.

By the end of this page, you'll have Claude Code installed, signed in with a Claude subscription, and running its first real task in one of your own folders โ€” with the permission model understood, a 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)
Version check: the number above is the npm release at the time of writing (November 2026). Anything โ‰ฅ 2.1 behaves as described here. If 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:

AccessWhat it costsGood for
Claude Pro$20/month ($17/month billed annually)one person, daily use
Claude Max$100/monthheavy agent use, bigger usage limits
Claude Ultra$200/monthmaximum limits
Claude Console (API)pay per tokenteams, cost tracking per project
Bedrock / Vertex / Foundrycloud billingenterprises 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

CommandWhat it does
/initscans the repo and writes a CLAUDE.md
/modelswitch models mid-session
/contextshow what’s filling the context window
/compactsummarize the conversation to free space
/clearstart fresh
/costtokens and spend so far
/diffreview pending changes
/permissionsinspect and edit what it’s allowed to do
/resumereopen an earlier session
/rewindroll back to an earlier checkpoint
/reviewcode review of the current changes
/doctordiagnose 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 โ†’
The classic first-day mistakes: running it in your home directory instead of a project; approving a 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 CodeCodex CLIGemini CLI
Free tiernoChatGPT Free/Goyes, generous
Installnative script, npm, brew, wingetnpm, brewnpm
Strengthlong agentic sessions, hooks, subagentssandbox modes, --oss local modelsprice, 1M context
Runs local modelsnoyes (--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.

Next in the cloud track: [Codex CLI โ€” the same idea, with a sandbox and a local-model escape hatch โ†’](/tutorials/cloud/codex-cli/)