Building Module 6 · CLI Tools Setup

Claude Code

What you'll learn

~15 min
  • Install Claude Code globally via npm
  • Authenticate using an API key or Anthropic account
  • Run your first task and inspect the output
  • Use key commands like /help, /clear, and /cost

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 large context window (up to 1M tokens on Max/Enterprise plans; 200K on Pro)
  • 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

Terminal window
npm install -g @anthropic-ai/claude-code

WSL (recommended):

Terminal window
npm install -g @anthropic-ai/claude-code

Windows native (PowerShell or Git Bash):

Terminal window
npm install -g @anthropic-ai/claude-code

Claude Code has full Windows-native support as of early 2026. The install command is the same — just make sure Node.js is installed on your Windows side (not just in WSL).

Terminal window
npm install -g @anthropic-ai/claude-code

Verify it installed:

Terminal window
claude --version

You should see a version number.

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 — Anthropic Console (API key):

  1. Go to 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

Option B — Claude Pro or Max subscription: If you have a Claude Pro ($20/mo) or Max ($100/mo or $200/mo) subscription at claude.ai, Claude Code can use that directly. Follow the prompts to log in with your Anthropic account.

Paying for Claude Code

Claude Code can be used with a Pro subscription ($20/month, 200K context), Max 5x ($100/month, 1M context, Opus 4.6), or Max 20x ($200/month, 20x Pro usage, 1M context) — subscriptions mean no per-token anxiety. Alternatively, you can use an API key and pay per token (Opus 4.6: $5/$25 per million input/output tokens; typically $5-50/month for learning). Start with a free trial to evaluate, then upgrade when you see the value. Use /cost during a session to monitor API key spending.

💡Authenticating over SSH or on a remote server

If you’re working on a remote server (SSH, VS Code Remote), browser login may fail. The most reliable method is Option A (API key) — set the key as an environment variable before starting Claude:

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

This bypasses browser auth entirely. You can also add the export to your ~/.bashrc (or ~/.zshrc) so it persists across sessions.

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 — for careful work on code you care about. Claude asks for confirmation before editing files or running commands.
  • claude -d (short for --dangerously-skip-permissions) — for prototyping and learning. Removes confirmation prompts so you can move fast. Use this on throwaway projects, never 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.

The mode dance

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

  1. Plan mode (Shift+Tab or /plan) — Claude reads your project and proposes a strategy without editing anything. Use this when you need to think through a problem.
  2. Execute mode (default) — 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 ($200/month): Fixed cost, generous Claude Code usage with 1M token context and access to Opus 4.6. No per-token anxiety. 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. Developers billing $50-150/hr recoup the cost in their first afternoon. 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 /cost to monitor spending during a session.

Free trial: Start here to evaluate. Every new Anthropic account gets trial credits. Upgrade when you see the value — not before.

Useful Claude Code commands

Once inside a Claude Code session, these are helpful:

CommandWhat it does
/helpShow available commands
/clearClear the conversation
/costShow token usage and estimated session cost
/planEnter planning mode (read-only analysis)
/compactCondense conversation to free context window
/effortSet thinking depth (low / medium / high / max)
/initGenerate a CLAUDE.md project memory file
/voicePush-to-talk voice input (hold spacebar to speak)
/simplifyThree-agent code review of recent changes
/batchParallel changes across codebase
/btwQuick question without adding to context
/contextView context usage and optimization tips
/agentsManage custom subagents
Shift+TabToggle planning mode (may vary by terminal)
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. Claude Code will often plan multiple steps and ask for confirmation. When it asks “Should I proceed?”, say yes unless something looks wrong.

Power features

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

Plan mode

Type /plan to enter planning mode. 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. Type /plan again to exit and let it execute. (Shift+Tab also toggles planning mode in supported terminals.) 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
mediumGeneral tasks (default)
highMulti-file changes, debugging complex issues
maxArchitecture decisions, large refactors

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.

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.

Autonomous mode has no undo

In autonomous mode, Claude can create, edit, and delete files and run commands without asking. Always commit your work to git before using it, so you can roll back if needed.

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:

  • 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 file inside your .claude directory, 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 — useful once you find yourself repeating the same kinds of tasks.
  • 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.
🧬In Your Field: Biotechclick to expand

Claude Code’s long context window (up to 1M tokens on Max plans) 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'
What to ask the AI
"I installed Claude Code with npm 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?"
Symptom
npm install -g @anthropic-ai/claude-code fails
Evidence
npm ERR! code E404 or npm ERR! 404 Not Found
What to ask the AI
"I'm trying to install Claude Code with npm install -g but I get a 404 error. Is the package name correct? How do I check if my npm registry is configured properly?"
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?"
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 npm install -g @anthropic-ai/claude-code and verify with claude --version
  • Authenticate via API key (best for remote/SSH) or Anthropic account (easiest for local use)
  • Always start from your project directory — Claude Code reads the files around it to understand context
  • Use it as a conversation — describe what you want, refine with follow-ups, don’t try to one-shot everything
  • The real workflow: plan mode → think → execute → checkpoint → repeat
  • Invest in your tools — Max subscriptions remove per-token anxiety and let you experiment freely