Home / Session 1
session-1.md — ~/hacking-with-ai
1

First Contact

What Claude Code is, how to wield it, and your first build

45 min Claude Code Fundamentals Loading...
Session 1 of 8

// Overview

Ground yourself in what LLMs actually are, learn what makes Claude Code different from every other AI tool, pick up the power moves that separate beginners from pros, then watch a feature get built from scratch — live.

Learning Objectives

// Theory

What is an LLM?

5 min

Large Language Models are the engine behind Claude Code. Understanding the mechanics — and the failure modes — makes you a better operator. You don't need to know how to build one, but you need to know where they break.

Key Concepts

  • An LLM is fundamentally two files: a parameters file (neural network weights) and a run file (inference code). Llama 70B = 140GB of parameters + ~700 lines of C (Karpathy's llama2.c). Self-contained — no internet needed at inference.
  • Training is compression. Trillions of tokens from the internet are compressed into parameters. Think of it as a lossy zip of the internet — patterns, not exact text.
  • The core operation is next-token prediction: given all tokens so far, predict the next one. 'The cat sat on the' → 'mat' (high probability). This is all it does — emergent capabilities arise from scale.
  • Jagged intelligence: LLMs can write a compiler but struggle to count letters in 'strawberry'. They ace coding interviews but hallucinate API signatures. Best when your problem matches training data patterns.
  • LLMs are empirical artifacts, not traditional software. We don't fully understand their internals. This means unexpected capabilities AND unexpected failures — stay in the loop.
diagram
LLM = Two Files
================
┌─────────────────────────┐
│  parameters.bin         │  ← Neural network weights
│  (140 GB for 70B model) │     Compressed internet knowledge
└─────────────────────────┘
┌─────────────────────────┐
│  run.c                  │  ← Inference code
│  (~700 lines of C)      │     Matrix multiplications + sampling
└─────────────────────────┘

Next-Token Prediction
=====================
Input:  "The cat sat on the ___"
Output: { "mat": 0.42, "floor": 0.15, "roof": 0.08, ... }

This single operation, at scale, produces:
  ✓ Code generation    ✓ Translation
  ✓ Reasoning          ✓ Summarization

Jagged Intelligence
===================
  ✓ Write a compiler           ✗ Count letters in "strawberry"
  ✓ Refactor 500-line class    ✗ Guarantee correct import paths
  ✓ Design system architecture ✗ Do precise arithmetic
  ✓ Explain complex code       ✗ Know your private APIs

What is Claude Code?

5 min

Claude Code isn't a chatbot with a code plugin. It's an autonomous agent that lives in your terminal, reads your files, runs your tests, and iterates on its own work. Understanding the architecture helps you use it effectively.

Key Concepts

  • Agentic loop: Claude Code operates in a Read → Think → Act cycle. It reads your code, reasons about what to do, takes an action (edit a file, run a command), then loops back to evaluate the result. Not one-shot — it iterates.
  • Terminal-native: runs directly in your repo. It sees your file tree, git state, test output, and build errors. No copy-pasting into a browser — it has the full context of your project.
  • Tool use under the hood: Claude Code has built-in tools — Read (view files), Write/Edit (modify files), Bash (run commands), Search (find code). Every action you see it take is a tool call.
  • vs ChatGPT/Gemini: those are conversations in a browser. Claude Code is an agent in your terminal. It doesn't just suggest code — it writes files, runs tests, and fixes its own mistakes.
  • vs Copilot: Copilot does line-level autocomplete from local context. Claude Code understands your entire codebase, plans multi-file changes, and executes end-to-end. Autocomplete vs architect.
  • IDE integrations exist: VS Code extension and JetBrains plugin bring Claude Code into your editor. VS Code features include a Spark icon in the activity bar that lists all Claude Code sessions, full markdown document view for plans with comment support, and native MCP management via /mcp in the chat panel. But the terminal CLI remains the primary interface (and the focus of this workshop) — it's the most powerful and flexible way to use Claude Code.
diagram
Claude Code: Agentic Loop
==========================
         ┌──────────┐
    ┌───→│  READ    │ ← files, git, errors, test output
    │    └────┬─────┘
    │         ▼
    │    ┌──────────┐
    │    │  THINK   │ ← reason about what to do next
    │    └────┬─────┘
    │         ▼
    │    ┌──────────┐
    └────│  ACT     │ ← edit file, run command, search
         └──────────┘
         (loop until done)

Comparison Table
================
Feature          │ Claude Code  │ ChatGPT     │ Copilot
─────────────────┼──────────────┼─────────────┼──────────
Runs in terminal │ ✓            │ ✗ (browser) │ ✗ (IDE)
Sees full repo   │ ✓            │ ✗           │ partial
Runs commands    │ ✓            │ ✗           │ ✗
Multi-file edits │ ✓            │ ✗           │ limited
Iterates on work │ ✓            │ ✗           │ ✗
Autocomplete     │ ✗            │ ✗           │ ✓

Tips & Power Moves

10 min

These are the shortcuts, modes, and patterns that separate a beginner from a power user. Learn them now and they'll pay dividends in every session that follows.

Key Concepts

  • Model selection: Opus 4.6 is the recommended default (most capable). Opus 4 and 4.1 have been removed — users are auto-migrated to Opus 4.6. Sonnet 4.6 is fast & capable with 1M context (released Feb 2026). Sonnet 4.5 users on Pro/Max/Team are automatically migrated to Sonnet 4.6. Use /fast for 2.5x faster output (same model, lower latency) — Opus 4.6 fast mode now includes the full 1M context window. Opus 4.6 defaults to medium effort for Max/Team subscribers. Effort levels (low|medium|high) control reasoning depth — set via /model picker, settings, or CLAUDE_CODE_EFFORT_LEVEL env var. Use the 'ultrathink' keyword to enable high effort for the next turn. Model aliases: 'opusplan' uses Opus for planning and auto-switches to Sonnet for execution; 'sonnet[1m]' selects Sonnet with 1M context window. Switch models with Alt+P or /model. The model picker now shows human-readable labels + upgrade hints. Haiku for quick questions, Sonnet for cost-sensitive pipelines.
  • Keyboard shortcuts: Shift+Tab (cycle modes: Normal → Auto-Accept → Plan), Shift+Enter (newline — zero setup in iTerm2/WezTerm/Ghostty/Kitty; run /terminal-setup for others), \+Enter (universal newline — works in all terminals), Ctrl+C (stop generation), Ctrl+D (exit Claude Code), Ctrl+G (text editor mode), Ctrl+L (clear screen), Ctrl+O (toggle verbose output), Ctrl+R (reverse search history), Ctrl+V (paste image from clipboard), Ctrl+B (background tasks panel), Ctrl+T (task list), Alt+T (toggle thinking visibility), Esc (cancel input), Esc+Esc (opens rewind/summarize menu), Shift+Down (cycle teammates), Up Arrow (previous prompt), Ctrl+U on empty bash prompt (!) exits bash mode (matches Escape and Backspace). Prompt suggestions: grayed-out auto-suggestions appear from git history — press Tab to accept.
  • @ file references: type @ and get autocomplete for files in your repo. @src/main/java/com/example/MyService.java focuses Claude on exactly that file. Reduces hallucination, increases accuracy.
  • ! bash mode: prefix any message with ! to run it as a shell command. !git status, !./mvnw test, !curl localhost:8080/health — no need to leave Claude Code.
  • Slash commands: /memory (edit project memory), /model (switch model), /compact (compress context), /clear (reset conversation), /init (bootstrap CLAUDE.md), /fast (toggle fast mode), /effort (set reasoning depth), /copy (interactive code block picker — select and copy specific blocks from the last response), /debug (attach debugger), /teleport (resume web session locally), /simplify (review changed code for reuse, quality, and efficiency), /batch (run operations across multiple files), /theme (customize terminal colors — reset with /theme default), /remote-control (serve local environment to claude.ai — supports custom names: /remote-control My Project), /claude-api (built-in skill for building with the Claude API and Anthropic SDK), /mcp (manage MCP servers), /btw (ask a side question without polluting context), /diff (interactive diff viewer for uncommitted changes), /doctor (diagnose environment issues), /export (export conversation), /fork (fork conversation into new branch), /insights (show usage insights), /install-github-app (install Claude GitHub app), /keybindings (show keyboard shortcuts), /output-style (set output style: Default, Explanatory, Learning, or custom), /plugin (manage plugins), /pr-comments (review PR comments), /release-notes (generate release notes), /rewind (restore code and conversation states), /sandbox (toggle OS-level sandboxing), /security-review (review code for security issues), /stats (show session statistics), /tasks (manage scheduled tasks), /loop (recurring prompts on interval), /desktop (open Desktop app), /plan (enter plan mode), /vim (vim keybindings), /status (show session status), /cost (show cost breakdown), /usage (show usage info), /permissions (manage tool permissions), /hooks (manage hooks), /agents (manage agent teammates). Sandboxing: Claude Code supports OS-level sandboxing (macOS Seatbelt, Linux bubblewrap) and auto-allow mode — toggle with /sandbox. PR status: clickable PR link with color-coded review state appears in the footer.
  • Prompt patterns: be specific ('add a GET endpoint' not 'make an endpoint'), say what NOT to do ('do not use Lombok'), reference existing patterns ('follow the pattern in HealthController').
diagram
Power User Cheat Sheet
======================

Models:
  Opus 4.6     → Recommended default (full 1M context, 128K output)
  Sonnet 4.6   → Fast & capable (1M context, released Feb 2026)
  Haiku 4.5    → Quick questions, cheap
  opusplan     → Opus plans, Sonnet executes
  sonnet[1m]   → Sonnet with 1M context window
  Alt+P        → Switch model mid-session
  /fast        → Toggle 2.5x faster output (full 1M context)
  /effort      → Set reasoning depth (low/medium/high)
  "ultrathink" → Enable high effort for next turn
  Opus 4.6 defaults to medium effort (Max/Team)

Shortcuts:
  Shift+Tab    →  Cycle modes (Normal → Auto-Accept → Plan)
  Shift+Enter  →  Newline (zero setup: iTerm2/WezTerm/Ghostty/Kitty)
  \+Enter      →  Universal newline (works in all terminals)
  Ctrl+C       →  Stop generation
  Ctrl+D       →  Exit Claude Code
  Ctrl+G       →  Text editor mode
  Ctrl+L       →  Clear screen
  Ctrl+O       →  Toggle verbose output
  Ctrl+R       →  Reverse search history
  Ctrl+V       →  Paste image from clipboard
  Ctrl+B       →  Background tasks panel
  Ctrl+T       →  Task list
  Alt+T        →  Toggle thinking visibility
  Esc          →  Cancel input
  Esc+Esc      →  Opens rewind/summarize menu
  Shift+Down   →  Cycle teammates
  Up Arrow     →  Previous prompt
  Ctrl+U       →  Exit bash mode (on empty ! prompt)
  Tab          →  Accept prompt suggestion (from git history)

Context:
  @ + filename  →  Reference a file (autocomplete)
  ! + command   →  Run shell command inline

Core Commands:
  /memory         →  Edit project memory (CLAUDE.md)
  /model          →  Switch model
  /fast           →  Toggle fast mode (2.5x speed)
  /effort         →  Reasoning depth (low/medium/high)
  /compact        →  Compress conversation context
  /clear          →  Reset conversation
  /init           →  Bootstrap CLAUDE.md
  /copy           →  Interactive code block picker
  /debug          →  Attach debugger
  /teleport       →  Resume web session locally
  /simplify       →  Review code for reuse & quality
  /batch          →  Run ops across multiple files
  /theme          →  Customize terminal colors
  /remote-control →  Serve env to claude.ai
  /claude-api     →  Build with Claude API / SDK
  /mcp            →  Manage MCP servers

Extended Commands:
  /btw              →  Side question without polluting context
  /diff             →  Interactive diff viewer
  /doctor           →  Diagnose environment issues
  /export           →  Export conversation
  /fork             →  Fork conversation into new branch
  /insights         →  Show usage insights
  /output-style     →  Set output style (Default/Explanatory/Learning)
  /plugin           →  Manage plugins
  /pr-comments      →  Review PR comments
  /release-notes    →  Generate release notes
  /rewind           →  Restore code & conversation states
  /sandbox          →  Toggle OS-level sandboxing
  /security-review  →  Review code for security
  /stats            →  Show session statistics
  /loop             →  Recurring prompts on interval
  /plan             →  Enter plan mode
  /vim              →  Vim keybindings
  /status           →  Show session status
  /cost             →  Show cost breakdown
  /usage            →  Show usage info
  /permissions      →  Manage tool permissions
  /hooks            →  Manage hooks
  /agents           →  Manage agent teammates
  /desktop          →  Open Desktop app
  /install-github-app → Install Claude GitHub app
  /keybindings      →  Show keyboard shortcuts
  /tasks            →  Manage scheduled tasks

Sandboxing:
  macOS Seatbelt / Linux bubblewrap
  /sandbox → toggle on/off, auto-allow mode

Prompt Patterns:
  ✓ "Add GET /v1/health following HealthController pattern"
  ✓ "Do NOT use Lombok. Use Java records."
  ✗ "Make an endpoint" (too vague)
  ✗ "Write some code" (no direction)

PR Status: clickable PR link with color-coded review state in footer

// Setup

Clone and run the demo application

bash
git clone <my-full-app-repo>
cd my-full-app
docker-compose up -d
./mvnw spring-boot:run -pl my-full-app-web
Verify: curl http://localhost:8080/v1/health

// Challenge

Live Demo: Build a currency conversion calculator endpoint

15m

Watch (or follow along) as the facilitator builds a currency conversion calculator endpoint using Claude Code and the EPCT workflow. The endpoint uses the existing FxExchangeRate MicroType and CurrencyPair, following TestController patterns. No keyboard coding — only prompts.

✓ Success Criteria

  • Used EPCT: explored TestController and existing endpoints first
  • Used Plan Mode before implementation
  • Follows TestController patterns (parameter validation, @WithStandardErrorResponses)
  • Uses FxExchangeRate and CurrencyPair from the existing codebase
  • Endpoint returns 200 OK with JSON response
  • Tests pass
⚠ Hints (click to reveal)
  • Facilitator drives — follow along if your environment is set up
  • Watch the agentic loop in action: Read → Think → Act
  • Notice how Claude explores TestController patterns before writing code

Code Playground

Interactive

Try These Prompts

E - Explore
What REST endpoints exist in this project? Look at TestController. How does it use FxExchangeRate and CurrencyPair? What patterns does it follow for parameter validation and error responses?
Let Claude explore autonomously — watch the agentic loop
Expected: Claude searches for @RestController annotations, finds TestController, and analyzes its patterns
P - Plan
Plan adding a GET /v1/convert endpoint that takes sourceCurrency, targetCurrency, and amount parameters. Follow TestController patterns including @WithStandardErrorResponses. Use FxExchangeRate and CurrencyPair from the existing codebase.
Press Shift+Tab to enter Plan Mode first
Expected: Claude creates a structured implementation plan referencing existing patterns
C - Code
Implement the plan you created for the detailed health endpoint.
Claude follows its own plan — trust the agentic loop
Expected: Claude implements following the plan and existing patterns
T - Test
Write tests for the detailed health endpoint and run them to verify everything works.
Always verify — let Claude run the tests
Expected: Claude creates tests, runs them, fixes any failures
! Bash Mode
!curl -s http://localhost:8080/v1/health/detailed | jq .
The ! prefix runs shell commands inline — no need to leave Claude Code
Expected: Runs curl directly and shows formatted JSON response

Code Examples

Expected Response
{
  "name": "my-full-app",
  "version": "1.0.0",
  "uptime": "PT2H30M",
  "components": {
    "database": "UP",
    "kafka": "UP"
  }
}
EPCT Workflow
EPCT Workflow
=============

E - Explore
    "What patterns exist for X?"
    Let Claude read the codebase first.

P - Plan
    Shift+Tab → Plan Mode
    Claude designs before it builds.

C - Code
    "Implement the plan"
    Claude follows its own plan.

T - Test
    "Run the tests to verify"
    Claude runs tests and fixes failures.

Why EPCT works:
  → Explores before assuming
  → Plans before coding
  → Tests before shipping
Power Moves Quick Reference
Power Moves
============

Shortcuts:
  Shift+Tab    →  Toggle Plan Mode
  Shift+Enter  →  Newline (zero setup: iTerm2/WezTerm/Ghostty/Kitty)
  \+Enter      →  Universal newline (all terminals)
  Ctrl+C       →  Stop generation
  Ctrl+D       →  Exit Claude Code
  Ctrl+G       →  Text editor mode
  Ctrl+L       →  Clear screen
  Ctrl+O       →  Toggle verbose output
  Ctrl+R       →  Reverse search history
  Ctrl+V       →  Paste image from clipboard
  Ctrl+B       →  Background tasks panel
  Ctrl+T       →  Task list
  Alt+T        →  Toggle thinking visibility
  Esc          →  Cancel input
  Esc+Esc      →  Opens rewind/summarize menu
  Shift+Down   →  Cycle teammates
  Up Arrow     →  Previous prompt
  Alt+P        →  Switch model mid-session
  Ctrl+U       →  Exit bash mode (on empty ! prompt)
  Tab          →  Accept prompt suggestion

Modes:
  Plan Mode    →  Read-only exploration
  Normal Mode  →  Full read/write access
  /fast        →  2.5x faster output (full 1M context)
  /effort      →  Reasoning depth (low/medium/high)
  "ultrathink" →  Enable high effort for next turn

Model Aliases:
  opusplan     →  Opus plans, Sonnet executes
  sonnet[1m]   →  Sonnet with 1M context

Core Commands:
  /memory         →  Edit CLAUDE.md
  /model          →  Switch model (Opus/Sonnet/Haiku)
  /fast           →  Toggle fast mode
  /effort         →  Set reasoning depth
  /compact        →  Compress context when long
  /clear          →  Fresh conversation
  /init           →  Bootstrap CLAUDE.md
  /copy           →  Interactive code block picker
  /debug          →  Attach debugger
  /teleport       →  Resume web session locally
  /simplify       →  Review code for reuse & quality
  /batch          →  Run ops across multiple files
  /theme          →  Customize terminal colors
  /remote-control →  Serve env to claude.ai
  /claude-api     →  Build with Claude API / SDK
  /mcp            →  Manage MCP servers

Extended Commands:
  /btw             →  Side question (no context pollution)
  /diff            →  Interactive diff viewer
  /output-style    →  Set output style
  /plugin          →  Manage plugins
  /rewind          →  Restore code & conversation states
  /sandbox         →  Toggle OS-level sandboxing
  /loop            →  Recurring prompts on interval
  /plan            →  Enter plan mode
  /vim             →  Vim keybindings
  /agents          →  Manage agent teammates
  /desktop         →  Open Desktop app

Pro Tips:
  @ + file  →  Focus on specific file
  ! + cmd   →  Run shell command inline
  Tab       →  Accept prompt suggestion (from git history)
  Be specific in prompts
  Say what NOT to do
  Reference existing patterns

// Key Takeaways

// Resources

Claude Code Overview Claude Code Best Practices CLI Reference Interactive Mode Model Configuration Deep Dive into LLMs like ChatGPT (Karpathy) How I Use LLMs (Karpathy)