Building Module 6 · CLI Tools Setup

Claude Code

Install Anthropic's terminal-first AI agent and run your first task

What is Claude Code?

Claude Code is Anthropic’s command-line AI agent. It runs in your terminal, reads your entire project, and can plan, write, edit, and debug code across multiple files autonomously.

Key features:

  • Understands your full codebase through long context (200K tokens)
  • 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

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/Max subscription: If you have a Claude Pro or Max subscription at claude.ai, Claude Code can use that directly. Follow the prompts to log in with your Anthropic account.

Authentication

Claude Code requires authentication with an Anthropic account. Your instructor will provide access details. You can authenticate via an API key or through a Claude Pro/Max subscription.

💡Authenticating over SSH or on a remote server

If you’re working on a remote server (SSH, VS Code Remote), the browser-based login won’t work directly. Instead, use 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 so it persists across sessions.

Your first interaction

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

Step 1: Create a project folder

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

Step 2: Start Claude Code

Terminal window
claude

Step 3: Give it a task

Type this into Claude Code:

Create 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: Check the result

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 describing what you wanted in plain English.

Useful Claude Code commands

Once inside a Claude Code session, these are helpful:

CommandWhat it does
/helpShow available commands
/clearClear the conversation
/costShow how much this session has cost
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.

KNOWLEDGE CHECK

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