Claude Code — First Contact
Your AI coding partner is online
Objective
Install Claude Code, run your first session, and understand the core interaction model.
Deliverable
Claude Code installed and configured. First working script built entirely through Claude Code with a CLAUDE.md file.
Topics
- Installing Claude Code
- Authentication: API key vs. Claude Pro/Max subscription
- Anatomy of a session: prompt → plan → execute → review
- Plan mode: always start here
- Reading diffs: understanding what Claude changed
- Essential commands: /help, /compact, /clear, /model, /context
- Introduction to CLAUDE.md
- Understanding context window and token usage
Activities
- Install Claude Code and authenticate
- Run your first session: ask Claude to build a simple to-do list app
- Practice Plan mode: describe what you want before Claude codes
- Review a diff and understand every change
- Use /compact during a long session
- Create your first CLAUDE.md file
Skills You'll Gain
Claude Code basics, Plan mode, diff reading, /compact, CLAUDE.md creation
Learning Objectives
By the end of this week, you will be able to:
- Install and authenticate Claude Code on your computer
- Explain the session model: prompt → plan → execute → review
- Write effective prompts that give Claude clear context and constraints
- Read a diff to understand exactly what Claude changed in your files
- Use essential slash commands (/help, /compact, /clear, /model) and create a CLAUDE.md file
Lesson
What Is Claude Code?
Claude Code is an AI coding assistant that lives in your terminal. Unlike ChatGPT or Claude.ai (where you chat in a browser window and copy-paste code), Claude Code can directly read, write, and run code on your actual computer. When you ask Claude Code to "create a to-do list app," it does not just show you the code — it creates the actual files, writes the actual code, and can even run it for you.
Think of it this way:
- Claude.ai = a smart friend you text. They give advice, but you do all the work.
- Claude Code = a smart colleague sitting at your computer. You describe what you want, they do the work, and you review it.
This makes Claude Code incredibly powerful — and is also why we spent Weeks 1 and 2 learning the terminal and Git. You need to understand the environment Claude Code works in.
Installing Claude Code
Make sure Node.js is installed (you did this in Week 1). Then run:
$ claude install
If that does not work, you can also install via npm:
$ npm install -g @anthropic-ai/claude-code
Verify the installation:
$ claude --version
If you see a version number, you are ready.
Authentication: Getting Permission to Use Claude
Claude Code needs to know you have permission to use it. There are two ways:
- API Key — A personal password from Anthropic. Go to https://console.anthropic.com, create an account, and generate an API key. Then set it:
$ export ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxx
- Claude Pro/Max Subscription — If you have a paid Claude subscription, you can authenticate directly:
$ claude auth login
This opens a browser window where you log in. Once authenticated, Claude Code connects to your account automatically.
Your First Session
Navigate to your project folder and launch Claude Code:
$ cd ~/my-first-project
$ claude
You will see a welcome screen with a blinking cursor. This is where you type your prompts — plain English descriptions of what you want Claude to do.
Try this prompt:
Create a simple HTML page called index.html that says "Hello World"
with a heading and a paragraph describing what this project is about.
Watch what happens. Claude will:
- Think about what you asked (you might see it planning)
- Create the file
index.html - Write the HTML code into it
- Show you what it did (a diff — the changes it made)
The Session Model: Prompt → Plan → Execute → Review
Every interaction with Claude Code follows this cycle:
You write Claude thinks Claude makes You check
a prompt → and plans → the changes → the result
"Create a "I'll create Creates files, You see a diff
to-do app" index.html with writes code, showing what
React components" runs commands changed
Step 1: Prompt — You describe what you want in plain English. Be specific:
- Vague: "Make an app" (Claude does not know what kind)
- Better: "Create a to-do list where I can add and remove tasks"
- Best: "Create a to-do list using HTML and JavaScript where I can add tasks with a text input, mark them as complete with a checkbox, and delete them with a button"
Step 2: Plan — Claude thinks about your request and decides what to do. In Plan mode (which we will cover next), it tells you its plan before doing anything.
Step 3: Execute — Claude creates files, writes code, and runs commands on your computer.
Step 4: Review — Claude shows you a diff — a before-and-after view of what changed. You approve or ask for changes.
Plan Mode: Think Before You Code
Plan mode is one of the most important features of Claude Code. When you start in Plan mode, Claude tells you what it plans to do before making any changes. You can review the plan, ask questions, and request modifications before Claude writes a single line of code.
To enter Plan mode, use the slash command:
/plan
Or start Claude with Plan mode:
$ claude --permission-mode plan
In Plan mode, Claude will analyze your request and present a plan like:
I'll create a to-do list app. Here's my plan:
1. Create index.html with the page structure
2. Add a text input and "Add Task" button
3. Create a task list that displays tasks
4. Add JavaScript to handle adding, completing, and deleting tasks
5. Style it with CSS to look clean and professional
Shall I proceed?
You can then say "yes," or modify the plan: "Sounds good, but use a modern design with rounded corners and a dark mode."
Rule of thumb: Always use Plan mode for anything non-trivial. It prevents Claude from going in a direction you did not want.
Reading Diffs: Understanding What Changed
When Claude makes changes, it shows you a diff. This is the same format Git uses:
+ Added lines appear in green with a + prefix
- Removed lines appear in red with a - prefix
Unchanged lines appear normally (for context)
Example diff:
--- a/index.html
+++ b/index.html
@@ -1,3 +1,5 @@
<html>
<body>
- <h1>Hello</h1>
+ <h1>Hello World</h1>
+ <p>This is my first project.</p>
</body>
</html>
Reading this diff: The line <h1>Hello</h1> was removed (red), and two new lines were added (green): <h1>Hello World</h1> and <p>This is my first project.</p>.
Learning to read diffs is essential. Every time Claude makes a change, you should read the diff to understand what happened. If something looks wrong, you can say "Undo that" or "Change the heading back."
Essential Slash Commands
Slash commands are special instructions you type during a Claude Code session. They start with /:
| Command | What It Does |
|---|---|
/help | Shows all available commands |
/compact | Compresses the conversation to save memory. Use this during long sessions when Claude starts to slow down or forget earlier context |
/clear | Clears the entire conversation and starts fresh |
/model | Switch between AI models (Opus, Sonnet, Haiku) mid-session |
/context | Shows how much of Claude's memory (context window) is being used |
/cost | Shows how many tokens (and dollars) this session has used |
/init | Creates a CLAUDE.md file for your project |
The Context Window: Claude's Working Memory
Claude has a limited "working memory" called the context window. Think of it like a desk — Claude can only keep so many documents on the desk at once. As the conversation gets longer, older information falls off the desk.
This is why /compact is important. When you run /compact, Claude summarizes the conversation so far, freeing up space on the desk without losing important information.
Signs you need to use /compact:
- Claude starts forgetting things you told it earlier
- Claude repeats work it already did
- The
/contextcommand shows usage above 80%
CLAUDE.md: Project Memory
CLAUDE.md is a special file that Claude reads at the start of every session. It is your project's instruction manual for Claude. Create one with:
/init
Or create it manually. Here is a starter template:
# CLAUDE.md
## Project Overview
This is a to-do list application built during the Claude Code Mastery course.
## Tech Stack
HTML, CSS, JavaScript
## Commands
- Open index.html in a browser to view the app
- No build step needed
## Architecture
- index.html — Main page with app structure
- style.css — Styling
- app.js — Application logic
## Conventions
- Use clear variable names
- Add comments explaining complex logic
Why does this matter? Without CLAUDE.md, Claude starts every session knowing nothing about your project. With CLAUDE.md, Claude immediately understands what your project is, how it is organized, and what conventions to follow.
Token Usage and Cost
Every interaction with Claude uses tokens — small units of text. Longer conversations use more tokens, and tokens cost money (if you are on API billing). Use /cost to check:
/cost
Session tokens: 12,450
Estimated cost: $0.12
Tips for managing token usage:
- Use
/compactduring long sessions - Be specific in your prompts (less back-and-forth = fewer tokens)
- Use Plan mode to avoid wasted work
- Switch to a cheaper model (Haiku) for simple tasks with
/model
Practice Exercises
Exercise 1 (Guided): Your First Claude Code Session
Follow these steps exactly:
$ cd ~/my-first-project
$ claude
At the Claude prompt, type:
Create a file called index.html with a simple webpage that has:
- A heading that says "My First Project"
- A paragraph introducing yourself
- A list of three things you are learning
After Claude creates the file:
- Read the diff Claude shows you — identify what was added
- Type
/costto see token usage - Type
/contextto see context window usage - Open the file in a browser to see the result (on Mac:
open index.html)
Verification: index.html should exist with the content you described. The browser should display a formatted webpage.
Exercise 2 (Independent): Plan Mode Practice
Goal: Use Plan mode to build a simple to-do list.
- Start Claude in Plan mode:
claude --permission-mode plan - Ask: "Create a to-do list app where I can add tasks, mark them complete, and delete them. Use HTML, CSS, and JavaScript in separate files."
- Review Claude's plan carefully before approving
- After Claude builds it, test it in your browser
- Ask Claude to make one improvement (your choice — better styling, a search feature, etc.)
Hints:
- If the plan seems too complex, ask Claude to simplify it
- If you do not understand part of the plan, ask Claude to explain
- After testing, commit your changes with Git:
git add . && git commit -m "Add to-do list app"
Verification: Three files should exist (.html, .css, .js). The app should work in the browser. Git log should show a new commit.
Exercise 3 (Challenge): Create Your CLAUDE.md
Write a complete CLAUDE.md for your my-first-project that includes:
- Project overview (what it does)
- Tech stack (what technologies it uses)
- File structure (what each file does)
- How to run the project
- Any conventions you want Claude to follow
Test it by starting a new Claude session and asking: "What do you know about this project?" Claude should be able to describe your project accurately based on CLAUDE.md.
Self-Assessment Quiz
1. What is the difference between Claude.ai and Claude Code?
2. What is Plan mode, and why should you use it?
3. In a diff, what do lines starting with + and - mean?
4. What is CLAUDE.md, and why is it important?
5. When should you use the /compact command?
Answers:
Claude.ai is a chat interface in your browser — you type questions and get text responses that you copy-paste manually. Claude Code runs in your terminal and can directly create, edit, and run files on your computer. Claude Code is an active collaborator; Claude.ai is an advisor.
Plan mode makes Claude describe its plan before making any changes. You should use it for anything non-trivial so you can review, modify, and approve the plan before Claude writes code. This prevents wasted work and misunderstandings.
Lines starting with
+are additions (new content that was added). Lines starting with-are deletions (old content that was removed). Lines without a prefix are unchanged context lines.CLAUDE.md is a file in your project root that Claude reads at the start of every session. It tells Claude about your project: what it does, what technologies it uses, how files are organized, and what conventions to follow. Without it, Claude starts each session knowing nothing about your project.
Use
/compactwhen your session is getting long and Claude starts to slow down, forget earlier context, or repeat itself. Check with/context— if usage is above 80%, it is time to compact.
Current Model Lineup (June 2026)
| Model | Released | Model ID | Best For |
|---|---|---|---|
| Claude Fable 5 | Jun 2026 | claude-fable-5 | Creative coding, frontier reasoning, novel problem-solving |
| Claude Opus 4.8 | May 2026 | claude-opus-4-8 | Complex agentic coding, large refactors, multi-step reasoning |
| Claude Opus 4.7 | Apr 2026 | claude-opus-4-7 | Coding, agents, vision, multi-step tasks |
| Claude Opus 4.6 | Feb 2026 | claude-opus-4-6 | Agentic coding, tool use, deep reasoning |
| Claude Sonnet 4.6 | Feb 2026 | claude-sonnet-4-6 | Everyday coding, balanced speed/capability |
| Claude Haiku 4.5 | Oct 2025 | claude-haiku-4-5-20251001 | Quick tasks, high-volume operations, cost-sensitive workflows |
- Fable 5 is a Mythos-class model — Anthropic’s most capable publicly available model, exceeding all prior Claude models. It represents a new model family beyond the Opus/Sonnet/Haiku tiers.
- Opus 4.8 brings stronger performance across coding, agentic tasks, and professional work with improved consistency. Fast mode (
/fast) is available on Opus 4.8, 4.7, and 4.6. - Sonnet 4.6 delivers frontier performance at lower cost than Opus. The best choice for everyday Claude Code work.
- Haiku 4.5 is used internally by Claude Code for fast subagent operations. Best for rapid iteration and cost-sensitive workflows.
Key takeaway: Switch models mid-session with /model or set ANTHROPIC_MODEL. The latest and most capable models are Fable 5 and the Claude 4.x family. Fast mode (/fast) gives Opus faster output without downgrading to a smaller model.
Exercise: Run the same prompt with Fable 5, Opus 4.8, and Sonnet 4.6. Compare response time, token cost, and output quality. Identify which tasks benefit from Fable’s extra capability vs where Sonnet is sufficient.
References:
Claude Code Feature Updates (Feb 2026)
Task Management System:
A new task management system with dependency tracking was added (v2.1.16). Tasks can be created, updated, and tracked with blockedBy/blocks relationships. Disable with CLAUDE_CODE_ENABLE_TASKS=false to use the old system temporarily.
Auto Memory:
Claude now automatically records and recalls memories as it works (v2.1.32). Memories persist in ~/.claude/ and are loaded into the system prompt for future sessions.
Session Resume: On exit, Claude Code now shows a session resume hint so you can continue your conversation later (v2.1.31).
Exercise:
- Toggle
/fastmode and compare response speed vs. quality - Let Claude build up auto memories across a few sessions, then review what it stored in
~/.claude/ - Use the task management system on a multi-step project to track progress
Claude Code Surfaces: Beyond the Terminal
Claude Code runs everywhere — not just the terminal. Every surface connects to the same engine, so your CLAUDE.md files, settings, and MCP servers work across all of them.
| Surface | What It Is | When to Use |
|---|---|---|
| Terminal CLI | The full-featured command-line interface | Daily development, scripting, CI/CD |
| Desktop App | Standalone app (Mac/Windows) with visual diffs and multi-session | Reviewing diffs visually, running sessions side by side, scheduled tasks |
| Web App | Browser-based at claude.ai/code, no local setup | Long-running tasks, working from any device, parallel sessions |
| VS Code / JetBrains | IDE extensions with inline diffs and @-mentions | When you prefer staying in your editor |
| Chrome Extension | Debug live web apps directly | Frontend debugging, inspecting live pages |
Cross-device workflows:
- Remote Control — Continue a terminal session from your phone or another device
- Teleport — Start a task on the web or iOS, then pull it into your terminal with
claude --teleport - Dispatch — Message a task from your phone and open the session it creates on your desktop
- Channels — Push events from Telegram, Discord, or iMessage into a Claude Code session
- Slack — Mention @Claude in Slack with a bug report and get a pull request back
Routines — Cloud-scheduled recurring tasks that run on Anthropic’s infrastructure (no computer needed). Create from the web, Desktop app, or /schedule in the CLI. Use for daily PR reviews, overnight CI analysis, or weekly dependency audits.
Exercise:
- Try Claude Code in the Desktop app or at claude.ai/code
- Start a session in the terminal, then continue it from another device using Remote Control
- Create a Routine that runs a weekly task (e.g., dependency audit) without your computer being on
Token Usage Awareness
- Opus 4.6 uses more tokens than previous models due to deeper planning and longer autonomous runs. Monitor your usage with
/costduring sessions. - Community reports suggest token consumption can spike significantly when using Opus 4.6 for design-heavy or test-heavy workflows.
- Tip: Use Sonnet 4.5 or Haiku 4.5 for routine tasks, and reserve Opus 4.6 for complex architecture and multi-step reasoning where quality matters most.
Choosing the Right Model
With six models available, picking the right one matters for both quality and cost:
- Fable 5 — Your most challenging tasks. Novel architecture, complex multi-system problems, creative solutions. Highest capability, highest cost.
- Opus 4.8/4.7/4.6 — Complex agentic coding, large refactors, multi-step reasoning. The workhorse for serious development. Fast mode (
/fast) available. - Sonnet 4.6 — Everyday coding: bug fixes, feature implementation, code review. Best balance of speed and capability.
- Haiku 4.5 — Rapid iteration, simple edits, high-volume operations. Used automatically by subagents.
Exercise: Try the same refactoring task with Sonnet 4.6 and Opus 4.8. Note the difference in planning depth, then try it with Fable 5 to see if it finds a fundamentally different approach.
System Prompt Changes in v2.1.48–2.1.49
Recent Claude Code releases included significant system prompt updates:
- v2.1.48: Removed 1,082 tokens from the system prompt, including the old MCP CLI instructions (replaced by native MCP integration).
- v2.1.49: Added the
EnterWorktreetool description (237 tokens) to the system prompt, enabling Claude to create git worktrees mid-session.
Why this matters: Claude Code’s system prompt defines what tools and behaviors are available. Tracking these changes helps you understand what Claude can and can’t do in each version.
New CLI Features (2026)
/cdcommand (v2.1.169) — Move a session to a new working directory without breaking the prompt cache. Useful when you need to switch projects mid-session.--safe-mode(v2.1.169) — Disables all customizations (hooks, CLAUDE.md, MCP servers) for troubleshooting. Use when Claude Code behaves unexpectedly and you want to rule out configuration issues./schedule— Create cloud-based Routines directly from the CLI. Routines run on Anthropic’s infrastructure and keep working when your computer is off.
Opencode: Claude Subscription Support Removed
Opencode, a third-party open-source CLI for Claude, has dropped support for Claude subscriptions (Pro/Max). This means you can no longer use your Anthropic subscription credentials with Opencode.
- Impact: If you were using Opencode as an alternative to Claude Code, you now need an API key instead.
- Recommendation: Use the official Claude Code CLI (
@anthropic-ai/claude-code) which fully supports both API keys and Claude subscriptions.
Takeaway: Third-party tools can change their integration support at any time. The official Claude Code CLI is the most reliable way to access Claude from the terminal.
Claude Opus 4.7 (April 2026)
Anthropic released Opus 4.7 with stronger performance across coding, agents, vision, and multi-step tasks. Key improvements over 4.6:
- Greater thoroughness and consistency on complex, multi-file tasks
- Improved vision capabilities for working with screenshots and diagrams
- Better handling of long-context sessions
- Model ID:
claude-opus-4-7
Claude Opus 4.8 (May 2026)
Opus 4.8 is the latest in the Opus family, with the strongest coding and agentic performance to date:
- Improved consistency on professional work and complex reasoning
- Better autonomous operation in long sessions
- Fast mode (
/fast) available — gives faster output without downgrading to a smaller model - Model ID:
claude-opus-4-8
Claude Fable 5 (June 2026)
Fable 5 is a Mythos-class model — a new model family that exceeds the capabilities of any previously available Claude model. This is not an incremental Opus/Sonnet update; it represents a generational leap.
- Model ID:
claude-fable-5 - Available in Claude Code since v2.1.170
- Excels at creative problem-solving, novel approaches, and frontier reasoning
- Use
/modelto switch to Fable 5 for your most challenging tasks
Exercise: Switch to Fable 5 with
/modeland try a task that previously stumped Opus. Compare the approach and output quality.