Building Module 6 · Your Agent In Depth: Desktop App & CLI

Claude Code (Desktop & CLI)

Last reviewed

Beginner

What you'll learn

~15 min
  • Know what the Claude desktop app's Chat, Cowork and Code tabs are for
  • Install and sign in to Claude Code (skip if you did it in Lesson 1.2)
  • Run the build loop (plan, approve, build, check, keep) with Claude's modes
  • Use key commands like /help, /clear, /plan, /code-review, /rewind, and /resume

This is the in-depth lesson for Claude Code. If Claude is the tool you installed in Lesson 1.2, you are set up already: use this page for its modes, its memory file, its plans and its power features. Not your tool? Pick another from the Module 6 hub; one tool is enough.

Desktop app or CLI

Claude’s desktop app runs Claude Code with no terminal and no separate install: download it from Anthropic for macOS or Windows (Linux is in beta). It needs a Pro plan or higher, like the CLI (see the Paying box below).

The app has three tabs. Chat is an ordinary conversation, the same as claude.ai. Cowork works through longer knowledge-work tasks on your files, such as documents and research. Code is Claude Code itself: you pick a local folder and a permission mode (Plan is one of them), then review visual diffs and a preview of what it built. The Code tab reads the same CLAUDE.md, skills and MCP servers as the CLI, so everything below applies to both. Anthropic’s desktop quickstart covers the app.

Claude Code is Anthropic’s agent for your own files: it reads your project, plans with you, edits files, runs commands and iterates on errors, using a 1M-token context window on current models.

ℹCloud Equivalent

Claude Code Web at claude.ai/code offers Claude Code’s capabilities without a 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.

Install & sign in (skip if you already set this up in Lesson 1.2)

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.

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).

WSL:

Terminal window
curl -fsSL https://claude.ai/install.sh | 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. claude doctor prints a read-only health check of the install if anything looks off. If you already manage tools with Node, npm install -g @anthropic-ai/claude-code still works (Node 22 or newer; never use sudo with it); the hub’s Advanced section covers npm.

Sign in

Start Claude Code for the first time and it walks you through signing in:

Terminal window
claude
  • Claude subscription (easiest): with a Pro, Max, Ultra, 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.
  • API key (pay per token): run claude (or /login) and choose the Anthropic Console account. Sign in with your Console account is recommended and creates no key; a key from the Claude Console works as ANTHROPIC_API_KEY.

Over SSH, in WSL 2 or in a container, the browser shows a login code instead of bouncing back: paste it at the Paste code here if prompted prompt. To skip the browser entirely, set the key before starting:

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

Add the export to ~/.bashrc (or ~/.zshrc) to keep it. For scripts and CI on a subscription, claude setup-token mints a long-lived login token.

ℹPaying for Claude Code
  • Pro ($20/month): the entry plan for Claude Code, in the CLI and the desktop app. Opus 5.5 is the default model; Fable is available but paid with usage credits.
  • Max ($100/month) and Ultra ($200/month): more usage, with Anthropic’s top reasoning model, Fable 5.2, included up to half your weekly limit.
  • Team / Enterprise: per-seat plans with admin controls. API key: pay per token (API pricing).

There is no free Claude Code tier, so the cheapest way to evaluate it is one month of Pro. /usage shows your limits and /model your models; usage credits keep you working past a limit (costs). Prices for every tool are in the Cloud Sandbox Cheat Sheet.

Your first build

Already built welcome.html in Lesson 1.2? You’re set. If you are trying Claude as a second tool, run Lesson 1.2’s Step 2 in your ai-class folder.

The build loop in Claude Code

Every lesson from here on uses one rhythm: plan, approve, build, check, keep. Claude’s modes map onto it:

  1. Plan: open Claude in your project folder, switch to plan mode (Shift+Tab until the bar says plan, or send /plan on its own), and describe the goal in one or two sentences. Claude reads your files and asks what it needs.
  2. Approve: read the plan, answer its questions, and approve it.
  3. Build: Claude edits files and runs commands.
  4. Check: open the result yourself, or ask Claude to show you what changed. /code-review reviews your current changes.
  5. Keep: ask Claude to save a checkpoint (Module 7 explains what that does). If the next step goes wrong, you can go back.

Permission modes

Press Shift+Tab to cycle the modes; the current one shows in the status bar.

  • Auto: the starting mode in a terminal or the VS Code extension, from v2.1.283 onward. A built-in classifier approves routine reads and edits and stops to ask about anything risky. A good default for everyday work.
  • Manual: Claude asks before every file edit and command. Pick it for work you care about and want to see step by step. It is also the starting mode for claude -p and the Agent SDK.
  • Accept edits: file edits go through without asking; commands still ask.
  • Plan: Claude reads your project and proposes a strategy before it builds. Use it for anything non-trivial. Started with approval prompts off, plan mode is an instruction Claude follows, not a lock. How firmly each tool waits is in the tool modes table.

claude --dangerously-skip-permissions (it has no short alias) turns the approval prompts off. This course starts practice sessions with it; Autonomous mode says exactly what it does.

Ask before you build

On an unfamiliar project, ask Claude to explain first (“Where is the checkout total calculated?”). It reads your files and git history to answer, a low-risk way to learn what it can do.

Keep the session tidy

Claude Code compacts long conversations on its own. Three habits help:

  • /clear: a fresh start for an unrelated task. Save a checkpoint first.
  • /compact: condenses the conversation at a natural boundary, with a note of what to keep: /compact keep the decisions about the database schema.
  • Resume: claude --continue (-c) reopens your most recent conversation; claude --resume (-r) or /resume picks an earlier one. Name a session with /rename.

Keep: save a checkpoint

Between major steps, ask Claude: “Save a checkpoint called ‘contact form working’.” It uses git for you, and Module 7 explains what that means. If Claude makes a mess in the next step, you can roll back.

Useful Claude Code commands

CommandWhat it does
/helpShow available commands
/usageShow your plan usage and session cost
/planSwitch to plan mode on its own turn, then send the request as the next message
/compactCondense the conversation; add what to keep
/resumePick an earlier session to continue
/code-reviewReview your current changes (/review is the same command)
/effortSet thinking depth (low / medium / high / xhigh / max, or auto)
/rewindStep back to an earlier checkpoint of code, conversation, or both
/initGenerate a CLAUDE.md project memory file
/memoryEdit CLAUDE.md or toggle auto memory; or ask Claude to “add this to CLAUDE.md”
Ctrl+CInterrupt; on an empty prompt, press twice to exit (or type /exit)

Power features

Plan mode

Press Shift+Tab until the status bar says plan (or send /plan alone). Claude reads your project and proposes a strategy before it edits files; press Shift+Tab again to let it build. Especially valuable for beginners: you see what Claude would change and why. Started with approval prompts off, plan mode is an instruction, not a lock.

Project memory: CLAUDE.md

/init generates a CLAUDE.md file that captures your project’s conventions, and Claude reads it at the start of every session. If your repository already has an AGENTS.md (the brief file Codex, Antigravity and Copilot read; see Anthropic’s memory docs), Claude Code reads it when the project has no CLAUDE.md; if it has one, add the line @AGENTS.md to it. To remember a rule, say “add this to CLAUDE.md” and correct Claude once; it sticks.

Autonomous mode

claude --dangerously-skip-permissions lets Claude edit files and run commands without asking (deny rules in permissions.deny still block). Anthropic documents it for isolated containers and VMs (permission modes). It can reach anything your account can, not only your practice folder. To be asked more often, start with plain claude.

⚠Two safety nets, not one

Whenever Claude Code edits without asking (Auto, Accept edits, or the skip-permissions flag), files change before you see them:

  • Git checkpoints first. Ask Claude to save a checkpoint before each task. Git records every change in the folder, whoever made it.
  • /rewind (or Esc twice on an empty prompt): Claude Code saves a checkpoint before each prompt, and you restore the code, the conversation, or both. Changes made by shell commands, such as an rm, are not tracked (checkpointing), so git is your net for those.
More power features: effort, images, review, newer features

Effort (how much Claude thinks)

/effort controls how deeply Claude thinks before responding: low for quick edits and simple questions, medium for everyday work (the default on Opus, Sonnet and Haiku 5.5), high for harder tasks, xhigh for hard reasoning on current models, and max for the hardest architecture decisions (session-only). /effort auto restores the model’s default.

Inline shortcuts and the transcript

@src/ pulls a file into context; ! runs a shell command and puts its output in context; Esc interrupts; Ctrl+O opens the transcript viewer to see which files and commands Claude is touching.

Working from images and mocks

Drag an image into the session, paste one, or point to a path, then say “build this” and iterate. A screenshot of a broken layout also speeds up debugging.

Review before you ship

Run /code-review bare: it reads your current changes and lists findings. It takes an effort level and a target (a PR number, branch or path), not a free-text instruction, so put a request like “check this against our checklist” in an ordinary prompt afterwards. /diff shows what changed, and /security-review reviews the branch against the remote’s default branch (commands).

Newer features worth knowing about

  • Desktop hand-off (/desktop) moves a terminal session into the Code tab; voice mode (/voice) lets you speak instead of type.
  • Skills are reusable workflows in .claude/skills/; auto memory keeps notes in MEMORY.md.
  • Remote control monitors local sessions from claude.ai or mobile (Pro and above; docs).
  • claude import codex, claude import gemini or claude import cursor pulls MCP servers and settings across.
  • /fast trades price for speed (fast mode); /loop repeats a prompt in your session, and headless runs are in Module 19.
🧬In Your Field: Biotechclick to expand

Point Claude at a directory of analysis scripts and ask “Which of these handles FASTQ quality trimming?” Its large context window lets it see how the scripts connect.

Verify it works

If claude --version printed a version number and Claude answered a question in a session, Claude Code is fully working. Type /exit (or press Ctrl+C twice) to leave.

🔧

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
Claude Code asks you to log in again, or reports an authentication error, even though ANTHROPIC_API_KEY is set (the wording varies by version)
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
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?"

Key Takeaways

  • Two ways in: the desktop app’s Code tab (no terminal), or the CLI: curl -fsSL https://claude.ai/install.sh | bash (or irm https://claude.ai/install.ps1 | iex in PowerShell), verified with claude --version
  • Sign in with your Claude subscription (easiest) or an API key (pay per token; handy for remote/SSH)
  • Open your project folder first: Claude Code reads the files around it
  • Know your mode: Auto approves the routine steps, Manual asks about everything, Plan proposes before it builds; Shift+Tab cycles them
  • The build loop: plan, approve, build, check, keep
  • Pay for what you use: Pro is the entry plan; Max or Ultra give more room to experiment
Search lessons