Claude Code is Anthropic’s terminal-native coding agent. It reads your project, edits files, runs commands, and handles git — all via natural language. The latest stable release as of writing is v2.1.209 (2026-07-14). This article walks through installation on Ubuntu 22.04/24.04, the recommended daily-driver workflow, and the configuration patterns that show up most often in production.

## Install on Ubuntu 22.04 or 24.04

There are two install paths. The npm path is what most users do:

“`bash
sudo apt update && sudo apt install -y nodejs npm
sudo npm install -g @anthropic-ai/claude-code
“`

The Anthropic-curated alternative is a native installer that bundles Node so you don’t need it on the box:

“`bash
curl -fsSL https://claude.ai/install.sh | bash
“`

Both put a `claude` binary on your `PATH`. Verify:

“`bash
claude –version
claude doctor
“`

`claude doctor` checks your API key, network, and the latest version against npm.

**Set the API key** (Anthropic recommends a long-lived key from the Console, not a billing-portal one):

“`bash
export ANTHROPIC_API_KEY=”sk-ant-…”
“`

If you’re behind a corporate proxy:

“`bash
export HTTPS_PROXY=http://proxy.example.com:8080
export ANTHROPIC_AUTH_TOKEN=”$ANTHROPIC_API_KEY”
“`

## First three commands to run

## First three commands to run

After install, `cd` into any project and start Claude Code:

“`bash
cd ~/work/my-app
claude
“`

You’ll land in an interactive REPL. Three commands to learn first:

– `/init` — generates a `CLAUDE.md` in your project root describing conventions, build/test commands, and any rules the agent should always follow. Edit it after each session — over time this becomes your project’s authoritative prompt for the agent.
– `/review` — runs a code review over the working tree and prints suggestions inline. Use it before committing.
– `/mcp` — manages MCP (Model Context Protocol) servers. Add only the ones you actually need; each one costs you prompt cache tokens every turn.

To exit, `/exit` or `Ctrl+D`.

## The plan-first workflow that compounds

Claude Code’s biggest 2025-2026 feature is its **plan-first** default. When you ask for a non-trivial change, it returns a numbered plan (files it will touch, commands it will run, risks) before touching anything. Your job is to **read the plan, not the code**.

A useful discipline:

1. State the goal in one sentence.
2. Read the plan. Reject scope creep (e.g. “I asked for a refactor, not a rewrite”).
3. Approve with a thumbs-up emoji or by typing “yes”.
4. After completion, run your actual test suite — Claude Code doesn’t ship-verified code by default; you’ll have the chance to.

For multi-file edits spanning architecture, ask Claude Code to write the plan first, then run the implementation step-by-step. The verbose transcript is the audit trail.

## Configuration that actually matters

Three files make most of the day-to-day difference:

– **`~/.claude/settings.json`** — global user preferences (model defaults, MCP servers, allowedTools, ticket info)
– **`/CLAUDE.md`** — project context, build/test commands, do-and-don’t rules
– **`.claude/commands/`** — custom slash commands (`/pr`, `/release`, `/incident-postmortem`) you write once and reuse

An example CLAUDE.md for an Ubuntu-targeted service:

“`markdown
## Conventions
– Python 3.12+, uv-managed (`uv sync`, `uv run pytest`)
– Type hints required on public functions
– Never commit secrets; the pre-commit hook scans for them

## Build & test
– `make build` for the production binary
– `make test` for unit/integration (uses docker-compose for the DB)
– `make lint` for the formatter+typechecker

## Don’t
– Don’t bump dependencies without asking
– Don’t push to main; use a feature branch + PR
“`

## What Claude Code doesn’t replace

It’s not a cloud engineer (Devin-class) — it sits next to you in the terminal. It doesn’t touch the editor by itself; for that you’d use Cursor, Windsurf, or Cline. It’s also not local-only by default — Anthropic’s API is required, though you can switch the model via the open-source-compatible proxy OpenRouter if you want BYOK with other models.

## When it earns its $20

If you spend most of your day in a terminal anyway, on a codebase Claude can read (~200K tokens is the practical ceiling), and you’re willing to read plans instead of accepting diffs blindly — Claude Code is the highest-leverage subscription in the AI toolset right now.

Last modified: 2026年7月15日

Author

Comments

Write a Reply or Comment

Your email address will not be published.