# Section 1 — Foundations + Claude Code CLI

> **Summary — what this page covers**
> The conceptual + setup foundation. Attendees build a working mental model of how Claude Code
> behaves (tokens, context window, turns, grounding), install and authenticate, learn the core
> CLI/REPL, write their first CLAUDE.md, understand the permission model, and explore an
> unfamiliar .NET codebase. Pair this page with **Lab 1**.

**9:00 – 10:30 AM · 90 min** — 40 min lecture/demo + 50 min lab

## Learning objectives

- Articulate what separates Claude Code from autocomplete tools and copilots
- **Explain how LLMs work** — tokens, context windows, turns, temperature, grounding — **and use
  that model to make practical decisions** (when to read before writing, how to budget context,
  when to start a fresh session)
- Install on Windows (WSL2), macOS, Linux; authenticate via API key or subscription
- **Operate Claude Code from the terminal** (REPL + one-shot); know that the same agent runs in
  **VS Code and JetBrains** (set up in Section 3)
- Author a meaningful CLAUDE.md
- Use the permission model safely
- Explore a real, unfamiliar .NET project

## Content

### Block 1A — The landscape (≈25 min)

**Why this moment is different: tools that *assist* → agents that *execute*.** Autocomplete and
copilots suggest the next line *while you type*; you stay the driver, accepting or rejecting
tokens. Claude Code is an **agent**: you hand it a goal, and it plans, reads files, runs commands,
edits code, checks the result, and corrects itself — across many steps — before handing control
back. The unit of work moves from "a suggested completion" to "a completed task." That shift is why
the rest of the day is about *steering* a worker, not *prompting* a text box.

**The developer's mental model.** You don't need the math behind LLMs, but five mechanics explain
almost everything Claude Code does:

- **Tokens** — text is processed in tokens, roughly ¾ of a word in English. Everything you and
  Claude exchange is counted in tokens, and tokens cost money and space.
- **The context window** — the model's *working memory*. Your system prompt, CLAUDE.md, every file
  Claude reads, the conversation so far, and every tool result all share one finite budget. It's
  large, but not infinite — when it fills, older content gets summarized (compacted) or pushed out.
- **Turns** — a turn is your prompt plus Claude's response, and that response is usually a **loop**:
  read a file → run a command → read the output → edit → re-check, then reply. Expect an agent
  working, not a single answer appearing.
- **Temperature** — how random the output is. For code you want consistency, so Claude Code runs at
  a **low temperature** — the same request tends to produce the same, predictable result.
- **Grounding vs. recall** — an LLM predicts *plausible* text. Ask about code it hasn't seen and it
  may produce something plausible but wrong (a hallucination). Show it the real file and the output
  is **grounded** in fact. The rule of the day: *if Claude can't see it, it may invent it — tell it
  to read before it writes.*

**From mechanics to decisions** *(this is the outcome: apply the model to real choices)*. Each
mechanic above implies a practical habit:

- *The context window is finite* → **budget it.** Keep CLAUDE.md lean, `/clear` between unrelated
  tasks, and push heavy, noisy work into a subagent (Section 2) so it doesn't crowd your main
  window.
- *Grounding beats recall* → **make Claude read first.** Point it at the relevant files before
  asking it to edit; don't rely on its memory of your codebase.
- *Turns are a loop with tools* → **expect iteration.** Let it run the build, see the error, and try
  again — that loop is the feature, not a detour.
- *Model tiers exist* → **match the model to the job.** Haiku for fast, mechanical work;
  Sonnet/Opus for real reasoning — a lever you'll pull for subagents in Section 2 and the API in
  Day 2.

**Three products, one brand.** Don't confuse the surfaces:

- **Claude.ai** — the web/desktop chat app (and Projects, Artifacts). Conversation, not your repo.
- **Anthropic API** — the models exposed programmatically; what you build *against* in **Day 2**.
- **Claude Code** — the agent that lives in your terminal and IDE and acts on your real
  codebase. That's **today**.

Same underlying models; very different ways to use them.

### Block 1B — Installation & configuration (≈35 min)

- **Install paths.** macOS/Linux use a one-line npm install; Windows runs everything inside WSL2.
  If you completed [Before You Begin](01-before-you-begin.md), this is already done — we'll only
  troubleshoot stragglers here.
- **Authentication options.** Sign in with your **Claude.ai subscription** via browser OAuth
  (recommended today) *or* export an **API key** (`ANTHROPIC_API_KEY`, pay-as-you-go — the Day 2
  path). See [Before You Begin](01-before-you-begin.md#install--authenticate-claude-code) for both.
- **Operate from the terminal.** Two ways to run the same agent:
  - the **interactive REPL** — type `claude`, then converse and iterate across turns;
  - **one-shot mode** — `claude "prompt"` runs a single request and exits, ideal for scripts.

  Useful from the start: `/help` lists commands, and `claude --continue` resumes your last session.
  *Same agent, three surfaces — VS Code and JetBrains (Rider/IntelliJ) integration comes in
  Section 3.* The [Command Reference](12-command-reference.md) collects the rest.
- **CLAUDE.md basics (teaser).** A `CLAUDE.md` at your repo root is **loaded at session start and
  becomes part of the system prompt** — your project's standing briefing for Claude. Bootstrap one
  with `/init`, and append a fact mid-session by starting a line with `#`. *That's enough to get
  going;* the deep treatment — "keep it under 200 lines; it's a map, not a junk drawer" — lives in
  [Section 2](05-section-2-steering.md).
- **The permission model.** Claude Code asks **before** it does anything consequential — running a
  command, editing a file — with an interactive prompt you approve or deny. You can **allow-list**
  trusted actions so it stops asking about routine ones, and run **headless** (non-interactive) for
  automation. The point: you stay in control of what touches your machine.

### Block 1C — First real session demo (≈20 min)

A live exploration of [BookTracker](02-booktracker-app.md) — Claude reading the solution, mapping
the projects, and answering "how does this app work?" grounded in the actual files. This previews
exactly what you'll do hands-on next, so watch *how* the agent reads before it answers. (Instructor
demo prompts live in `_instructor/demo-plan.md`.)

## Demos referenced here

- **Installation Walk-Through** · **CLAUDE.md Creation** · **Live Codebase Exploration**
  [Instructor scripts live in `_instructor/demo-plan.md`.]

## Key takeaways

- **Claude Code is an agent, not autocomplete** — you hand it a goal, it executes a multi-step loop.
- **Context is power — read before you write.** Grounding in real files beats the model's memory.
- **CLAUDE.md is your project briefing** — loaded every session, it tells Claude how your code works.
- **The LLM mechanics aren't trivia — they drive decisions:** what to read, what to keep in context,
  which model to use, and when to `/clear` and start fresh.
- **You hold the permissions.** Nothing consequential happens without your approval.

→ Continue to [**Lab 1**](04-lab-1-explore.md).
