Skip to content

M01 Workshop: How LLMs Actually Work

Self-directed | 45–60 min | Requires: M01 study guide read beforehand


Prerequisites

  • M01 study guide read (theory + readings)
  • Claude Code installed (or allocate 10 min at the start)
  • A real project codebase open and ready (ideally 1K–10K lines, in any language — not a toy project)
  • Admin access to install software on your machine
  • A Claude account (free tier works; paid unlocks larger context windows)

What this workshop does The theory explains the mechanism. This workshop makes it tangible. You will see hallucinations happen on your own code, understand why, and learn the habits that prevent them from becoming a problem. By the end, you will have Claude Code working on a real project and have experienced the context-accuracy relationship firsthand.


  • Install and authenticate Claude Code
  • Run your first interaction with a real codebase
  • Practice essential shortcuts and commands
  • Complete a hands-on exercise: find, explain, and improve a function

Claude Code is a terminal-native agentic assistant — it reads your entire codebase, edits files directly, and runs commands on your machine. It’s not a chatbot you copy-paste to; it operates on your actual project.

As of early 2026, Claude Code contributes to roughly 4% of all public GitHub commits (~135k/day), and 90% of Anthropic’s own code is written with AI assistance.

AspectClaude CodeCursor/Copilot
Primary interfaceTerminal / CLIIDE-integrated
Context windowUp to 1M tokens (full codebase)Varies, typically smaller
AutonomyHigh — plans + executes multi-step tasksLower — mostly suggestions/completions
Best atLong-running autonomous tasks, complex refactoringDay-to-day inline editing, small completions

Available as: terminal CLI, VS Code/Cursor extension, desktop app (Mac/Windows), and browser (claude.ai/code).


Prerequisites: macOS 13+, Windows 10+ (1809), or Ubuntu 20.04+. Minimum 4GB RAM, stable internet, and Git installed.

Terminal window
# macOS
brew install claude-code
# Linux
curl -sSL install.claude.ai/linux | bash
# Windows (via winget)
winget install Anthropic.ClaudeCode
# Or download installer from claude.ai, run as administrator
# Verify
claude --version

Authenticate when prompted — a browser window will open for Claude account login. Credentials are stored locally in ~/.claude/.


Part 2 — First Interaction with a Real Codebase

Section titled “Part 2 — First Interaction with a Real Codebase”

Work in your own project for this section. 1K–10K lines is ideal — real, but not overwhelming.

Terminal window
cd your-project
claude /init

This creates a CLAUDE.md at the project root. Don’t edit it yet.

Ask Claude:

“Explain the overall architecture of this project in 2–3 sentences.”

Review the output. Consider: did it get it right? What clues did it use? What did it miss?

Step 3 — Deliberate hallucination trigger

Section titled “Step 3 — Deliberate hallucination trigger”

Ask Claude:

“Find the main entry point and show me the first 50 lines.”

Edit CLAUDE.md to add 2–3 lines of real project facts:

Main entry point: src/main.ts
Architecture: Express backend + React frontend
Key folders: /api (routes), /components (UI), /lib (shared utilities)

Ask the same question again. Observe the difference in specificity and accuracy.

Key learning: Claude’s reliability depends entirely on the context it has. This is why CLAUDE.md exists — you will build it properly in M04, but the principle starts here.


Part 3 — Essential Shortcuts and Commands

Section titled “Part 3 — Essential Shortcuts and Commands”

Try each of these in your session as you read through them.

ShortcutWhat it does
EscStop Claude mid-generation (keeps context)
Esc EscRewind to a checkpoint
Shift+TabCycle: Normal → Plan Mode → Auto-Accept
!commandRun a shell command directly (e.g., !git status)
Ctrl+B / Cmd+BOpen file browser / send agent to background
Ctrl+L / Cmd+LFocus the input field
CommandWhat it does
/initGenerate a starter CLAUDE.md from the codebase
/effort low|medium|high|maxControl reasoning budget (more effort = slower, more accurate)
/model sonnet|opus|haikuSwitch models mid-session
/clearWipe conversation history
/contextShow token usage breakdown

Run /context now and review the breakdown: system prompt, tools, conversation history, free space. This is what is consuming your context window before you have done anything significant. You will manage this actively in M04.


Part 4 — Hands-on Exercise: Find, Explain, Improve

Section titled “Part 4 — Hands-on Exercise: Find, Explain, Improve”

Find a function in your project that:

  • Is real and in active use (not dead code)
  • Is 20–60 lines
  • Has at least one obvious improvement: missing error handling, an inefficiency, a naming issue, or an undocumented edge case

Add the function’s file path to CLAUDE.md:

## Key function to explore today
File: src/services/auth.ts — validateToken() function

Ask Claude:

“List all parameters of [your function] and what each one does.”

Observe: does it get the parameter names right? If it hallucinates:

  • Add the actual function signature to CLAUDE.md
  • Ask again and compare the quality of the answer

Ask Claude:

“Explain the logic of [your function] step by step. What would happen if [a realistic edge case] occurred?”

If Claude gives a generic answer, try:

“Use /effort high and try again.”

Notice the difference in reasoning depth.

Ask Claude:

“This function doesn’t handle [the edge case you identified]. Show me what a fix would look like.”

Do not execute the change yet. Review it:

  • Is the logic correct?
  • Does it understand how this function connects to the rest of the codebase?

Then ask:

“Show me all the callers of [your function]. Would this change break any of them?”

Observe whether Claude searches the codebase or guesses.


Before finishing, take a moment to consider:

  1. Where did Claude get it right, and what enabled that? — Look for: good context, well-named code, common patterns.
  2. Where did it hallucinate or struggle, and why? — Look for: missing context, unusual naming, code that doesn’t match common patterns.
  3. What one thing would you add to CLAUDE.md right now to improve your next session?

Everything you observed — the hallucinations, the improvement when context was added, the deeper reasoning with higher effort — all follows from the same mechanism: statistical pattern matching against training data. You now have the mental model that explains Claude’s behaviour. Every module from here builds on this.


  • Claude Code installed and authenticated
  • A CLAUDE.md at the project root with at least 3 real project facts
  • Run /context at least once and noted the token breakdown
  • Experienced at least one hallucination and one recovery via added context

Installation fails on corporate machine — IT policies may block npm or the installer. Try npm install -g @anthropic-ai/claude-code as a fallback.

Claude keeps getting the architecture right even without context — Use a less-common file structure, or ask about something highly specific to the project (internal utility names, unusual patterns). The hallucination behaviour will arise naturally in the exercise.

Your codebase is too large — Direct Claude to a specific subdirectory: cd src/services && claude. Or update CLAUDE.md to explicitly scope the session: “Focus only on the /auth module for today.”

“My code is proprietary — I’m not comfortable with this” — Claude Code runs locally and reads files directly without uploading them to a server. For teams with strict data policies, the enterprise plan offers zero-retention guarantees.