Claude Code 101
Installing Claude Code, the agentic loop, CLAUDE.md, permissions, MCP and a first real workflow.
Series Claude Academy: Start your journey Part 2 of 5
A walkthrough of the Claude Academy course Claude Code 101 (Start your journey track, 12 lessons + quiz). Each lesson is summarised with my own tables and examples; take the course for the full lessons. All the courses are listed in the Claude Academy course index.
Note: Detailed content expanded from course outline and public lesson pages; verify against lessons.
Prerequisites: Basic familiarity with a code editor and the command line; a Claude account (Pro, Max, Team, or Enterprise) or an API key. No prior AI-tool experience assumed.
Audience: New developers who want AI-assisted workflows from day one, and experienced engineers who haven’t yet worked with coding agents (or found earlier assistants underwhelming).
Module 1 — What is Claude Code? (2 lessons)
What is Claude Code?
- An agentic coding tool: understands your codebase, edits files, runs commands, and integrates with dev tools.
- Available in the terminal, VS Code, JetBrains IDEs, Claude Desktop, and the web.
- Difference from Claude.ai chat: direct access to your files, terminal, and codebase — no copy/paste; it does the work itself.
- Agent = software that interacts with its environment and takes actions toward a goal; an LLM running in a loop with access to tools, services, or other agents.
- What it can do: read/explain code and trace bugs · edit across files (e.g., refactor + update all references) · run builds/tests/installs and act on output · search the web for docs.
- Three things to keep in mind:
- Context window = working memory; Claude searches strategically rather than loading everything.
- You control permissions — hands-on or hands-off.
- It can make mistakes — misunderstand intent, introduce bugs, over-engineer. Stay in the loop.
How Claude Code works
- The agentic loop: prompt → gather context → take action (edit file, run command) → verify results → done, or loop again. You can add context, interrupt, or steer at any point.
- Context: conversation, file contents, command outputs all occupy the window; near the limit Claude Code auto-compacts (summarizes/removes).
- Tools: the backbone of agents — let Claude decide when to execute something (read file, web search, etc.) and how to use the output.
- Permission modes:
| Mode | Behavior |
|---|---|
| Manual | Asks before every file edit or shell command |
| Auto-accept | File edits + common FS commands (mkdir, mv, rm) auto-approved; other commands still ask |
| Plan mode | Reads files / runs exploratory commands, no source edits; produces a plan first |
| Auto mode | No routine prompts; a background classifier screens actions, blocking irreversible/destructive/out-of-environment ones |
- Modes configurable in your settings file. Skipping permissions = mistakes harder to catch.
Module 2 — Your first prompt (2 lessons)
Installing Claude Code
- Terminal: macOS/Linux/WSL → one-line
curlinstaller (or Homebrew — no auto-update by default). Windows → PowerShellInvoke-RestMethod, CMDcurl, orwinget(no auto-update). - Run in your project directory:
First run: pick theme, sign in (Pro/Max/Team/Enterprise) or use an API key. Claude has access to that directory and its subfolders.cd my-project claude - VS Code: install “Claude Code” extension by Anthropic (verified check) → Command Palette → “Claude Code: Open in New Tab” or click the Claude logo.
- JetBrains: install plugin from Marketplace, restart, click Claude logo.
- Desktop: “Code” tab — work in a folder, change permissions, run in a cloud environment.
- Web:
claude.ai/code— GitHub repositories only.
| Surface | Best for |
|---|---|
| Terminal | Cutting edge — features ship here first |
| IDE (VS Code / JetBrains) | Nearly identical experience, tied into editor |
| Desktop | Letting Claude run in the background |
| Web | Remote work on GitHub repos |
Your first prompt
- Shift + Tab cycles permission modes (manual → auto-accept → plan, plus auto if enabled).
- Plan Mode: analyzes the codebase, asks clarifying questions, returns a detailed plan to approve. Great for complex multi-step changes or safe code review.
- Example prompt (in plan mode):
My app needs a dark mode implemented across the entire app. Can you create a toggle switch on the header… find a good contrast color that works based on my existing light theme.
- Be as descriptive as possible; review the plan, accept, then watch it execute.
Module 3 — Daily workflows (3 lessons)
Explore → Plan → Code → Commit
The single most important workflow — avoids jumping straight to code and course-correcting later.
| Step | What happens | Tips |
|---|---|---|
| Explore | Claude reads relevant files, searches docs | Use Plan Mode or the explore subagent |
| Plan | Proposes an approach | Cheapest place to course-correct — no code written yet |
| Code | Executes plan under your permission mode | Define success criteria; add tools (e.g., Claude in Chrome for UI testing); provide a reliable test suite |
| Commit | You test, then commit | Run a subagent reviewer (fresh context), have Claude write the commit message in your style |
- Tip: if Claude keeps hitting the same issue, ask it to save the fix to
CLAUDE.md.
Context management
- Everything — prompts, file reads, tool calls/results — consumes context. Auto-compaction can lose details.
| Command | Effect | Use when |
|---|---|---|
/compact |
Summarizes the session so far | Same feature, nearing the limit |
/clear |
Wipes context completely | Starting a new feature (avoid bias) |
/context |
Shows size, top categories, visual breakdown | Diagnosing what’s eating space |
- Save context by: being specific (vague prompts cause more exploration), pruning MCP servers you don’t need, using subagents for “just give me the answer” tasks.
Code review
- The session that wrote the code isn’t the best judge of it. Review yourself, then get a clean-context review.
/diff— interactive viewer of uncommitted changes (and per-turn changes). Requires git.- Always check for: unrequested changes, weakened tests (skipped/deleted/loosened), new packages and hard-coded values (URLs, keys).
/rewind(or Esc twice on empty prompt) → restore code and conversation. Limit: changes from shell commands (e.g., package installs) are not rolled back./code-review— runs in background in a clean context, reports findings, edits nothing unless asked./code-review low(high-confidence only) vs/code-review high(wider net); level is remembered.- Triage each finding: Fix now · Ask why · Leave it (batch small ones later). Ask for evidence with fixes:
Fix the first finding… Then run the tests and show me the output.
- Do a human + Claude review when a change is bigger than you can hold in your head, sensitive/destructive, or going to a teammate.
- Claude Code Review (separate product) posts findings on GitHub PRs; not needed for this lesson.
Module 4 — Customizing Claude Code (5 lessons)
The CLAUDE.md file
- Markdown file at project root, read automatically every session — an onboarding script for your codebase (appended to your prompt).
# Project Next.js 15 app using the App Router, Tailwind, and Drizzle ORM. # Commands - Dev server: `pnpm dev` - Run tests: `pnpm test` # Code Style - 2-space indentation; prefer named exports - Use server actions instead of API routes where possible - Project-level (repo root, commit it, shared) vs user-level (your config folder, all projects, personal prefs).
- Ask Claude to save repeated corrections to memory; reference docs with
@README.md. - Recommended: start without one, notice what you keep correcting, then run
/initto generate a compact file.
Subagents
- Delegated workers with their own isolated context window; run in parallel and return just a summary to the main agent.
- Defined as Markdown + YAML frontmatter. Easiest: ask Claude to create one.
Create a code-reviewer subagent in .claude/agents/ that reviews code for bugs and readability. Make it read-only.
- Locations:
.claude/agents/(project) ·~/.claude/agents/(all projects). Restart if the folder was new. - Extras: persistent memory; preload skills via a
skillskey (whole skill loaded into the subagent’s context).
Skills
- A skill = folder with a
SKILL.md(plus optional scripts/resources) that teaches Claude a task once. - The description decides activation — Claude matches your request against skill descriptions.
- Locations:
~/.claude/skills(personal) ·.claude/skillsin repo (team, cloned with the repo).
| Mechanism | Loads | Triggered by |
|---|---|---|
| CLAUDE.md | Every conversation | Always |
| Skill | Name + description only, full content on demand | Claude recognizing the situation |
| Slash command | When typed | You |
- Rule of thumb: if you explain the same thing repeatedly, it’s a skill waiting to be written.
MCP (Model Context Protocol)
- Open standard connecting Claude Code to external tools/data (e.g., Linear issues, Context7 docs).
claude mcp add ... # add a server /mcp # in-session: view status, disable servers - Types: HTTP (remote, hosted by provider) · stdio (local process).
- Scopes: Local (this project, just you) · User (all your projects) · Project (
.mcp.jsonchecked into git). - Context cost: each server adds tool names/instructions; tool search (on by default) defers full definitions. Prefer CLIs (
gh,aws) when available; pair servers with a skill.
Hooks
- Commands run at lifecycle points — deterministic (always run), unlike prompt instructions.
- Uses: auto-format after edits, compliance logging, blocking dangerous ops, notifications.
- Configured in
settings.json(event + optional matcher + command);/hooksshows a read-only list.
| Event | Fires |
|---|---|
PreToolUse |
Before a tool call (can block) |
PostToolUse |
After a tool call |
UserPromptSubmit |
When you submit a prompt |
Stop |
When Claude finishes responding |
Notification |
When Claude sends a notification |
- PreToolUse gets tool name + input as JSON on stdin. Exit 0 = proceed · 2 = block (stderr fed back to Claude) · other = non-blocking error.
{ "hooks": { "PostToolUse": [ { "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/format.sh" }] } ] } } - Put project hooks in
.claude/settings.jsonand commit; use$CLAUDE_PROJECT_DIRfor script paths. - “If something needs to happen every time without fail, don’t put it in a prompt. Put it in a hook.”
Quick-Review Flashcards
- Q: What are the three phases of the agentic loop? → A: Gather context, take action, verify results (repeat until done).
- Q: Key shortcut to cycle permission modes? → A: Shift + Tab.
- Q: What does Plan Mode prevent? → A: Editing source files — it explores and produces a plan first.
- Q: Name the four-step workflow. → A: Explore → Plan → Code → Commit.
- Q:
/compactvs/clear? → A:/compactsummarizes and keeps going on the same task;/clearwipes everything for a new task. - Q: Why review with
/code-reviewinstead of the same session? → A: It runs in a clean context without the authoring session’s bias. - Q: Three things to check in every diff? → A: Unrequested changes, weakened tests, new packages/hard-coded values.
- Q: CLAUDE.md vs skills? → A: CLAUDE.md loads every session; skills load on demand when their description matches.
- Q: Where do project-scoped MCP servers live? → A:
.mcp.json, checked into version control. - Q: What exit code makes a PreToolUse hook block an action? → A: Exit code 2 (stderr is fed back to Claude).
- Q: Why use a subagent for exploration? → A: Its separate context does the heavy lifting and returns only a summary.
- Q: What doesn’t
/rewindundo? → A: File changes made by shell commands (e.g., package installs).
Practice Ideas
- Install Claude Code in both the terminal and your IDE; compare the experience on the same repo.
- Take a small feature through Explore → Plan → Code → Commit using Plan Mode, a test suite, and a generated commit message.
- Run
/contextduring a long session, then try/compactand compare. - Make a deliberate change, inspect it with
/diff, run/code-review, and triage findings into fix/ask/leave. - Work a week without CLAUDE.md, log your corrections, then run
/initand trim the result. - Create a read-only code-reviewer subagent in
.claude/agents/. - Write a
SKILL.mdfor your team’s commit-message or PR-review format. - Add a docs or issue-tracker MCP server; check its context cost with
/context. - Add a PostToolUse formatter hook and a PreToolUse hook that blocks
rm -rf.