Building Module 6 · CLI Tools Setup

Claude Code

Last reviewed · content updated

Beginner

What you'll learn

~15 min
  • Install Claude Code with the native installer (or npm)
  • Authenticate with a Claude subscription or an API key
  • Run your first task and inspect the output
  • Understand Auto, Manual, and Plan modes
  • Use key commands like /help, /clear, and /usage

By the end of this lesson, you’ll have Claude Code installed and working — and you’ll have built your first web page by describing it in plain English.

ℹCloud Equivalent

Claude Code Web at claude.ai/code offers Claude Code’s capabilities without local install. It connects to your GitHub repos for full project editing in the browser. See the Cloud Sandbox Cheat Sheet for current pricing, or set up your sandbox.

What is Claude Code?

Claude Code is Anthropic’s command-line AI agent. It runs in your terminal, can inspect files in your project directory, and uses a large context window to reason across many files — planning, writing, editing, and debugging code autonomously.

Key features:

  • Understands your codebase through a 1M-token context window — Sonnet 5 on every plan; Opus 5 and Fable 5.1 at 1M on Max, Team, and Enterprise (on Pro, Opus at 1M and Fable 5.1 at all need usage credits)
  • Creates, edits, and deletes files
  • Runs commands and tests
  • Iterates on errors automatically
  • Respects your project’s style and conventions

Installation

Step 1: Install Claude Code

Anthropic’s recommended path is the native installer — one command, no Node.js required, and it keeps itself up to date in the background.

Terminal window
curl -fsSL https://claude.ai/install.sh | bash

Homebrew users have two casks: brew install --cask claude-code (stable channel, roughly a week behind and skips releases with major regressions) or brew install --cask claude-code@latest (latest channel). Neither auto-updates — run brew upgrade yourself.

WSL (recommended):

Terminal window
curl -fsSL https://claude.ai/install.sh | bash

Windows native (PowerShell):

Terminal window
irm https://claude.ai/install.ps1 | iex

Or winget install Anthropic.ClaudeCode. Claude Code has full Windows-native support (PowerShell, CMD, Git Bash); sandboxing features require WSL 2.

Terminal window
curl -fsSL https://claude.ai/install.sh | bash

Anthropic also publishes signed apt/dnf/apk repositories if your organization prefers package managers.

The installer puts a claude launcher in ~/.local/bin. Verify it installed:

Terminal window
claude --version

You should see a version number (something like 2.1.261 (Claude Code)). claude doctor prints a read-only health check of the install if anything looks off.

ℹAlternative: npm

If you already manage tools with Node, npm install -g @anthropic-ai/claude-code still works — it’s now listed as an “advanced” option. It requires Node 22 or newer and installs the same native binary (Node is not used at runtime). Upgrade with npm install -g @anthropic-ai/claude-code@latest, and never use sudo with it. Native installs update themselves (claude update forces one); brew and winget installs upgrade through their package manager.

Step 2: Authenticate

Run Claude Code for the first time:

Terminal window
claude

It will walk you through authentication. You have two options:

Option A — Claude subscription (easiest): If you have a Claude Pro ($20/mo), Max (from $100/mo — see claude.com/pricing), Team, or Enterprise plan, Claude Code logs in through your browser and uses that plan. The free claude.ai plan does not include Claude Code.

Option B — API key (pay per token):

  1. Go to the Claude Console at console.anthropic.com
  2. Create an account if you don’t have one
  3. Go to API Keys and create a new key
  4. When Claude Code asks, paste your key
ℹPaying for Claude Code
  • Pro ($20/month): Sonnet 5 is the default model (1M context); Opus 5 is available; Fable 5.1 only via usage credits.
  • Max 5x ($100/month) and Max 20x (a higher fixed-usage tier — check claude.com/pricing for the current rate): Opus 5 is the default, and Fable 5.1 is available — check current plan terms for its usage allowance.
  • Team / Enterprise: per-seat plans with admin controls.
  • API key: pay per million tokens — Sonnet 5 $2 in / $10 out (this is now Anthropic’s standard price, not an introductory rate), Opus 5 $5 / $25, Fable 5.1 $10 / $50. One number moved with Fable 5.1 (released 2026-09-01): re-reading a cached prompt costs $0.25 per million tokens instead of $1, which lowers the cost of sessions that reuse cached prompts.

Subscriptions have a rolling 5-hour limit and a weekly limit shared with claude.ai; run /usage (alias /cost) any time to see where you stand. If you hit a limit you can enable usage credits to keep going at API rates. Start with the lowest tier that fits and upgrade when you see the value.

💡Authenticating over SSH, in WSL, or in a container

Browser login usually works even remotely: if the browser shows a login code instead of bouncing back to the terminal, paste it at the Paste code here if prompted prompt. That’s the normal path in WSL 2, SSH sessions, and containers.

If you’d rather skip the browser entirely, use Option B — set the key as an environment variable before starting Claude:

Terminal window
export ANTHROPIC_API_KEY="sk-ant-your-key-here"
claude

You can add the export to your ~/.bashrc (or ~/.zshrc) so it persists. For scripts and CI on a subscription, claude setup-token mints a long-lived login token instead.

Your first interaction

Let’s do a “hello world” — the simplest possible task to make sure everything works.

💡Safe default workflow

Before using any AI coding tool on real work, build the habit of: (1) working in a new folder or test project, (2) initializing git with git init, (3) reviewing changed files before running generated code. For this first exercise, a fresh folder is enough.

Step 1: Create a project folder

Terminal window
mkdir hello-claude && cd hello-claude

Step 2: Start Claude Code

Terminal window
claude

You’ll see a welcome screen with a prompt. Claude Code is now an interactive session — you type messages, Claude responds, and you go back and forth like a conversation.

Step 3: Describe what you want

Type this into the Claude Code session:

I need a simple HTML page that says "Hello from Claude Code!" with a
dark background and centered white text. Make it look clean and modern.

Watch what happens:

  1. Claude plans what to create
  2. It creates an index.html file
  3. It writes the HTML, CSS, and content
  4. It tells you what it did

Step 4: Refine it

Without leaving the session, type a follow-up:

Add a subtle gradient to the background and a footer with today's date.

Claude updates the file. This back-and-forth conversation is how you’ll use Claude Code for real work — not one-shot commands, but an ongoing dialogue.

Step 5: Check the result

Press Ctrl+C to exit Claude Code, then inspect what it built:

Terminal window
ls # See the file(s) Claude created
cat index.html # Look at the contents

Open the file in your browser:

Terminal window
open index.html

If you’re in WSL, open it with:

Terminal window
explorer.exe index.html

Or if you’re in VS Code, right-click the file in the Explorer panel and select “Open with Live Server” or “Reveal in File Explorer.”

Open the file in your browser:

Terminal window
xdg-open index.html

If you’re on a remote server (SSH), use VS Code’s file explorer to preview, or copy the file to your local machine. If you used VS Code Remote, just click the HTML file and it opens locally.

You should see a clean webpage with your message. You just built a website by having a conversation in plain English.

The Real Workflow

Knowing the commands is one thing. Knowing how experienced practitioners actually use Claude Code is another. Here’s the session lifecycle that makes the difference.

Launch with intention

Claude Code has permission modes that decide how much it asks before acting. Press Shift+Tab to cycle through them; the current mode shows in the status bar.

  • Auto — the starting mode on Pro, Max, and Team plans, in a terminal or the VS Code extension, from v2.1.228 onward (v2.1.233+ on native Windows). A built-in classifier approves routine reads and edits on its own and stops to ask you about anything risky. Good default for everyday interactive work. It is not the starting mode for claude -p, the Agent SDK, Enterprise plans, or Console API keys — those always start in Manual, regardless of version.
  • Manual — Claude asks before every file edit and command. This is the starting mode for API-key/Console accounts, Enterprise plans, claude -p, and the Agent SDK, and the one to pick when you’re working on code you care about and want to see every step.
  • Accept edits — file edits go through without asking; commands still ask.
  • Plan — read-only. Claude reads your project and proposes a strategy without touching anything. Start here for anything non-trivial: claude --permission-mode plan, or press Shift+Tab until the bar says plan.

There is also claude --dangerously-skip-permissions for prototyping in throwaway folders. It removes every confirmation and deliberately has no short alias — typing it in full is part of the safety friction. Never use it near important code.

Describe, don’t command

Bad: “Create a file called form.html with a form element containing three input fields.”

Good: “I need a contact form for a small business website. It should collect name, email, and message, with validation. Dark theme.”

Give context and intent. Let Claude figure out the implementation details — that’s what it’s good at.

Start by asking questions

The fastest way to get value from Claude Code on an unfamiliar codebase isn’t to have it write code — it’s to have it explain the code. Before reaching for autonomous edits, ask:

  • “How does authentication work in this project?”
  • “Where is the checkout total calculated, and how is that function used?”
  • “Why does this function take so many arguments? Check the git history.”

Claude reads your actual files (and your git history) to answer — it traces real usage rather than doing a plain text search, and nothing is indexed or uploaded to a server. This is how teams at Anthropic onboard new engineers onto a codebase, and it doubles as a low-risk way to learn what Claude can do before you trust it with changes.

The mode dance

This is the skill that separates casual users from effective ones:

  1. Plan mode (Shift+Tab until plan, or start a prompt with /plan) — Claude reads your project and proposes a strategy without editing anything. Use this when you need to think through a problem.
  2. Execute (Auto or Manual) — Claude builds, edits, and runs commands. This is where the work happens.
  3. The rhythm: Plan → think → approve → build → checkpoint → repeat. The back-and-forth between planning and executing IS the skill.

Context is finite

After extended sessions, Claude starts losing earlier context. Two tools help:

  • /compact — condenses the conversation, preserving key decisions and dropping noise. Use when responses start getting less accurate.
  • /clear — fresh start for a new task. Always commit your work before clearing.

Checkpoint constantly

Between major steps, save your work with git (covered in Module 7):

Terminal window
git add -A && git commit -m "checkpoint: feature X working"

Git is your safety net. If Claude makes a mess in the next step, you can always roll back. Don’t worry about this command yet — you’ll learn exactly what it does in Module 7.

Investing in Your Tools

Claude Code is a professional tool, and the most effective way to use it involves a subscription. Here’s how to think about the cost:

Max 5x ($100/month) or Max 20x (a higher fixed-cost tier — see claude.com/pricing for current rates): generous Claude Code usage, Opus 5 by default, 1M-token context, and access to Fable 5.1 — the model Anthropic positions for demanding reasoning and long-horizon agentic work (released 2026-09-01; the fable alias now resolves to it, and it needs Claude Code 2.1.255 or later) — subject to current plan terms. The predictable monthly cost makes it easier to experiment and iterate. You can experiment freely, iterate without watching a meter, and build the habits that make you productive. This is what most serious users should consider once they see the value.

The ROI framing: If Claude Code saves you 5 hours per month on tasks you’d do manually, the subscription has paid for itself many times over. Anyone who bills by the hour can run that arithmetic against their own rate. Researchers who can prototype analyses in hours instead of weeks. Students investing in a skill that compounds across their career.

API key ($5-50/month typical): Pay per token. Good for light or occasional use. Use /usage to monitor spending during a session.

No free Claude Code tier: Claude Code requires a Pro, Max, Team, or Enterprise plan (or an API key). The free claude.ai chat plan does not include Claude Code access. If you want to evaluate before committing, the cheapest path is one month of Pro at $20.

Useful Claude Code commands

Once inside a Claude Code session, these are helpful:

CommandWhat it does
/helpShow available commands
/clearClear the conversation
/usageShow your plan usage and session cost (/cost is an alias)
/planStart a prompt with it to get a plan before any edits
/compactCondense conversation to free context window
/effortSet thinking depth (low / medium / high / xhigh / max, or auto)
/rewindStep back to an earlier checkpoint — it can even undo a /clear
/initGenerate a CLAUDE.md project memory file
/permissionsManage allow/deny rules and your default mode
/doctorInteractive checkup that can fix install and config problems
/themeSwitch color theme (light / dark)
@Reference a file or folder by path — tab-completes as you type
#At the start of a line, save a note to CLAUDE.md mid-session (see below)
!At the start of a line, run a shell command without leaving Claude (see below)
Shift+TabCycle permission modes: Auto → Manual → Accept edits → Plan
EscInterrupt Claude’s current action without exiting the session
Ctrl+OToggle the verbose view of what Claude is doing
Ctrl+CExit Claude Code

Tips for effective use

  1. Start in your project directory. Always cd into your project folder before running claude. This gives it access to your files.

  2. Be specific. “Make it look nice” → vague. “Use a dark theme with #09090b background, rounded corners, and subtle border” → specific and predictable.

  3. Iterate. Don’t try to get everything right in one prompt. Start with the basic structure, then refine: “Now add a navigation bar” → “Make the nav sticky” → “Add a mobile hamburger menu.”

  4. Let it run. In Manual mode Claude will often plan multiple steps and ask for confirmation. When it asks “Should I proceed?”, say yes unless something looks wrong. In Auto mode it only stops for the risky steps — read those prompts carefully.

Power features

Once you are comfortable with the basics, these features make Claude Code significantly more capable.

Plan mode

Press Shift+Tab until the status bar says plan (or start any prompt with /plan). In this mode, Claude reads your project and proposes a strategy without editing any files. This is useful when you want to think through an approach before committing to changes. Press Shift+Tab again to cycle back to an executing mode and let it build. Especially valuable for beginners: use plan mode first to understand what Claude would change and why before letting it touch your files.

Extended thinking

Use /effort to control how deeply Claude thinks before responding:

LevelBest for
lowQuick edits, renaming, simple questions
mediumLighter tasks where speed matters more than depth
highGeneral tasks — the default on every current model
xhighHard reasoning — available on Sonnet 5, Opus 5, Opus 4.8, Opus 4.7, Fable 5, and Fable 5.1
maxThe hardest architecture decisions and large refactors (session-only)

/effort auto puts it back to the model’s default. Haiku 4.5 has no effort control.

Context management

Long conversations can cause the AI to forget earlier decisions. Use /compact to condense a conversation (keeping key context), /clear to start fresh, or /init to generate a CLAUDE.md project memory file. These are all listed in the command table above.

The .claude directory

Claude Code stores configuration and project memory in a .claude directory in your project root and in ~/.claude for global settings. The /init command generates a CLAUDE.md file that captures your project’s conventions — Claude reads this at the start of every session.

Inline shortcuts: @, #, and !

Three single-character prefixes speed up everyday work inside a session:

  • @ — reference a file or folder by path. Type @src/ and Claude tab-completes; the file is pulled into context exactly when needed instead of you pasting it.
  • # — start a line with # to tell Claude to remember something. It appends the note to your CLAUDE.md automatically, so it persists into future sessions. This is the lowest-friction way to grow your project memory: when you catch Claude doing something the wrong way, correct it once with # and it sticks.
  • ! — start a line with ! to run a shell command without leaving Claude. The command runs locally and its output goes into the context window, so Claude can act on it next turn. Handy for long-running commands or pulling specific output into the conversation.

Two keys are worth muscle memory too: Esc interrupts whatever Claude is doing without killing the session — use it to course-correct mid-action instead of Ctrl+C, which exits entirely — and Ctrl+O toggles the verbose view so you can see exactly which files and commands Claude is touching.

Working from images and mocks

Claude Code is multimodal. You can hand it an image — a design mock, a screenshot, a diagram, an error dialog — and have it work from what it sees:

  • Drag and drop an image file into the terminal session
  • Paste an image straight from your clipboard
  • Point to a path: “Implement the layout in ./designs/dashboard.png”

This is one of the fastest ways to go from idea to working UI: drop in a mock, say “build this,” then iterate. It also speeds up debugging — paste a screenshot of a broken layout and ask what’s wrong.

Autonomous mode

Running claude --dangerously-skip-permissions lets Claude execute without asking for confirmation on file edits or commands. The name is intentional — it is dangerous. Use it only for throwaway prototypes in a fresh directory, never near important code or data. (Auto mode is the safer everyday alternative: it approves the routine steps and still asks about the risky ones.)

⚠Two safety nets, not one

In autonomous mode, Claude can create, edit, and delete files and run commands without asking. Two layers of protection:

  • /rewind — Claude Code keeps in-session checkpoints, so you can step back to an earlier state of files and conversation without leaving the session.
  • Git commits — for changes that survive past the session (or past /clear), commit your work before autonomous runs so you can roll back at the repo level.

Newer features worth knowing about

These capabilities have been added in recent releases. You don’t need them on day one, but they’re good to know about:

  • Desktop app — Claude’s desktop app (macOS, Windows, Linux beta) bundles Claude Code in a “Code” tab: no terminal and no install required, same CLAUDE.md and settings.
  • Voice mode (/voice) — Hold spacebar to speak commands instead of typing. Great for non-developers who think faster than they type, or for describing complex ideas conversationally.
  • Auto-Memory — Claude automatically saves project notes in a MEMORY.md index (check the /memory command), so it remembers key decisions and patterns across sessions without you having to repeat yourself.
  • Skills — Reusable workflows defined as markdown files in .claude/skills/. Think of them as saved recipes Claude can follow (the older .claude/commands/ files still work — they’ve been merged into skills).
  • Remote control — Monitor and interact with your local Claude Code sessions from claude.ai or the mobile apps. Useful for kicking off long tasks and checking on progress from your phone.
  • Claude Code on the Web — A cloud-hosted version at claude.ai/code that connects to your GitHub repos for full project editing in the browser, no local install needed.
  • Import from other tools — claude import codex or claude import gemini pulls MCP servers and settings over from Codex CLI or Gemini/Antigravity, handy once you run more than one tool.
🧬In Your Field: Biotechclick to expand

Claude Code’s context window (up to 1M tokens) makes it especially useful for bioinformatics work. You can point it at a directory full of Python analysis scripts and ask questions like “Which of these scripts handles FASTQ quality trimming?” or “Add error handling to the alignment pipeline script.” It reads your entire project, so it understands how your scripts connect to each other — ideal for the kind of multi-step pipelines common in genomics and proteomics workflows.

📊In Your Field: MIS / Businessclick to expand

For MIS and business analytics projects, Claude Code shines at tasks like “Read the CSV export from our ERP system and create a Python script that generates a monthly summary report.” Because it can see your full project, it understands your data schemas, existing scripts, and naming conventions. It’s particularly effective when you need to transform data between formats (Excel to database, JSON API to CSV) or scaffold dashboard components.

Verify it works

If you already ran claude --version during installation and saw a version number, you’re set. Now confirm Claude Code can actually reach the API:

Terminal window
claude

Type a simple question like “What is 2 + 2?” and you should get a response. If you do, congratulations — Claude Code is fully working. Press Ctrl+C to exit. You’ll use it for real projects starting in the next module.

🔧

When Things Go Wrong

Use the Symptom → Evidence → Request pattern: describe what you see, paste the error, then ask for a fix.

Symptom
Claude Code says 'API key not found' after install
Evidence
Error: Could not find API key. Set ANTHROPIC_API_KEY or authenticate via 'claude auth login'
What to ask the AI
"I installed Claude Code but it can't find my API key. I set ANTHROPIC_API_KEY in my terminal. How do I verify the key is set correctly and troubleshoot authentication — or should I just log in with my Claude subscription instead?"
Symptom
'claude: command not found' after the installer finishes
Evidence
bash: claude: command not found
What to ask the AI
"The Claude Code native installer finished but my terminal can't find the 'claude' command. It installs a launcher to ~/.local/bin — how do I check whether that's on my PATH and fix it? I'm on WSL/macOS/Linux."
Symptom
npm install -g @anthropic-ai/claude-code warns about Node version or fails
Evidence
npm WARN EBADENGINE Unsupported engine … required: { node: '>=22' }
What to ask the AI
"npm is complaining about my Node version when installing Claude Code. Should I upgrade Node with nvm, or just switch to the native installer (curl -fsSL https://claude.ai/install.sh | bash)? Which is simpler on my system?"
Symptom
Claude Code hangs or is very slow to respond
Evidence
Cursor blinking for 30+ seconds with no response after typing a prompt
What to ask the AI
"Claude Code seems frozen — it's not responding after I type my prompt. I'm on a university network. Could this be a network issue? How do I check if the API endpoint is reachable, and does 'claude doctor' help here?"
KNOWLEDGE CHECK

What's the best practice when starting Claude Code for a project?

💬This is an investment in your relevance

Setting up a CLI tool might feel like just another install step. It’s not. Every hour you spend learning to direct AI agents compounds — next month you’ll be faster, next quarter you’ll be building things that used to be impossible for you. The specific tool will evolve. Your ability to orchestrate it won’t. If the subscription saves you 5 hours this month, it’s already paid for itself in time alone. The career optionality is the real return.


Key Takeaways

  • Install with curl -fsSL https://claude.ai/install.sh | bash (no Node needed) and verify with claude --version
  • Authenticate with your Claude subscription (easiest) or an API key (pay per token; handy for remote/SSH)
  • Always start from your project directory — Claude Code reads the files around it to understand context
  • Know your mode — Auto approves the routine steps, Manual asks about everything, Plan touches nothing; Shift+Tab cycles them
  • Use it as a conversation — describe what you want, refine with follow-ups, don’t try to one-shot everything
  • The real workflow: plan → think → execute → checkpoint → repeat
  • Invest in your tools — Max subscriptions remove per-token anxiety and let you experiment freely
Search lessons