Introduction to Claude Code
Independent educational resource, not an official Anthropic course. Facts about the API, prices and limits were checked against Anthropic's documentation on 15 November 2026 and the code was run against a local mock of the API, not the live service. Check the linked official pages before relying on a number, and test with your own key.
Most people meet Claude through a chat window, where it can discuss your code but can't touch it. Claude Code is the other way round. It runs next to your project, reads your files, edits them, runs your tests and talks to git, and it asks you before doing anything risky. This module teaches you to use it properly, and this first lesson explains what it is, how it works inside, and how it differs from the API you've been using so far.
What you'll learn
- What Claude Code is, and where it runs.
- The loop it works in: gather context, act, verify.
- What it can see and do on your machine.
- How it relates to the Claude API, CLAUDE.md, skills, hooks, subagents and MCP.
Before you start
What Claude Code is
Anthropic describes Claude Code as an agentic coding tool that reads your codebase, edits files, runs commands and integrates with your development tools. "Agentic" means it doesn't just answer; it takes steps, looks at what happened, and decides the next step. Give it "fix the failing tests" and it will typically run the test suite, read the errors, search for the relevant files, read them, edit them and run the tests again.
It's available in several places, and they all share the same engine:
- Terminal: the full-featured CLI, which this module focuses on.
- IDE extensions: VS Code (and Cursor) and JetBrains, with inline diffs and plan review.
- Desktop app: run several sessions side by side and review diffs visually.
- Web: claude.ai/code, for long tasks and repositories you don't have locally.
Because the engine is shared, your repository's CLAUDE.md files, settings and MCP servers work across all of these. Learn it once in the terminal and you can use it anywhere.
The agentic loop
Anthropic's own description is three phases that blend together: gather context, take action and verify results. A question about the codebase may only need the first. A bug fix cycles through all three repeatedly. You are part of the loop too, and can interrupt at any time to steer it.
your prompt
|
v
gather context -> take action -> verify --(not done)--+
(read, search) (edit, run) (tests, build) |
^ |
+---------------------------------------------------------+
you can press Esc at any point and redirect it
If this looks familiar, it should. It's the tool loop from module 4, where the model asks for a function, your code runs it, and the result goes back. Claude Code is that loop, plus a large, well-tested set of tools, plus the machinery around it. Anthropic calls that surrounding layer the harness: it provides the tools and manages what the model sees.
The tools it uses
The built-in tools fall into five groups:
- File operations: read, edit, create, rename.
- Search: find files by pattern, search contents with regular expressions.
- Execution: run shell commands, start servers, run tests, use git.
- Web: search the web, fetch documentation.
- Code intelligence: type errors after edits, go to definition, find references (needs a code-intelligence plugin).
There are also tools for starting subagents and asking you questions. Claude chooses which to use from your prompt and what it learns along the way. "Fix the failing tests" might run the suite, read the output, search for the source files, read them, edit them and run the tests again, six tool uses with no instructions from you about which.
What it can access
Run claude in a directory and it can reach:
- your project's files (and others, with your permission);
- your terminal: any command you could run, including git, build tools and package managers;
- your git state: branch, uncommitted changes and recent history;
- your
CLAUDE.md files and its own auto memory;
- whatever you've added: MCP servers, skills, subagents.
That breadth is why it's useful, and it's why permissions matter (lesson 5.7). A coding assistant that can run any command on your machine needs rules about which ones it may run without asking.
Models, sessions and checkpoints
Models. Claude Code uses Claude models. Anthropic's guide says Sonnet handles most coding tasks well and Opus gives stronger reasoning for complex architectural decisions; switch with /model during a session or start with claude --model <name>. The model choice lessons from module 1 apply here too.
Sessions. Each conversation is saved locally, and every session starts with a fresh context window. Nothing carries over automatically, except what you put in CLAUDE.md and what Claude saves to its own auto memory. You can resume (claude --continue or claude --resume) or fork a session.
Checkpoints. Before Claude edits a file, it snapshots the contents, so pressing Esc twice (or asking it to undo) rewinds the changes. Checkpoints cover file edits only. Anything that touches a remote system, such as a database, an API call or a deployment, can't be undone this way, which is why those are governed by permissions.
Claude Code versus the API
| Claude API (modules 2 to 4) | Claude Code |
| What you build | Your own application that calls the model | Nothing: you use a finished tool on your own code |
| The agent loop | You write it, or use the tool runner | Built in |
| Tools | The ones you define | Files, search, shell, web and more, ready to use |
| Safety rules | Yours to design | Permission modes, rules, hooks, checkpoints |
| Billing | Per token on your API account | A Claude subscription or a Console account |
They're related rather than competing. If you want your own product to use Claude, you use the API. If you want Claude to help you write that product, you use Claude Code. There's also an Agent SDK for building your own agents on top of Claude Code's tools, which module 6 touches on.
Try it: a first session
You haven't installed it yet (lesson 5.2 does that), but this is what a first session looks like. From a project folder:
cd /path/to/your/project
claude
Then, at the prompt, try questions before changes. Anthropic's quickstart suggests exactly this sort of thing:
what does this project do?
where is the main entry point?
explain the folder structure
Once you trust what it says about your code, give it a small change:
add a hello world function to the main file
Claude Code finds the file and shows the change, and asks for approval before making it (depending on your permission mode, lesson 5.7). Press Shift+Tab to cycle between modes, and type /help to see commands.
Real-world use case (illustrative scenario)
This scenario is an invented example to show how the ideas fit together. It is not a case study and its details are not measured results.
A developer inherits a Laravel shop built by someone else. On day one, instead of reading hundreds of files, they start Claude Code in the repository and ask, "give me an overview of this codebase", then "how is checkout handled?" and "trace what happens when an order is paid". Claude searches and reads files and answers with file names the developer can open and verify. By afternoon they've asked it to add a missing validation rule and run the tests. The first hours went into understanding, which is where most newcomers to a codebase spend their time.
Mistakes to avoid
- Treating it as a chatbot. It acts on your machine. Read what it proposes.
- Vague first requests. "Fix it" gets a worse result than "fix the login bug where users see a blank screen after wrong credentials".
- Assuming it remembers last week. Each session starts fresh. Put lasting facts in
CLAUDE.md.
- Assuming checkpoints undo everything. They cover file edits, not database changes or deployments.
- Skipping verification. A tool that says "done" isn't evidence. Ask for the test output.
Security notes
Claude Code can run commands as you. Start in a project you understand, keep the default of asking for approval on commands you haven't allowed, and be careful with projects from strangers (the trust prompt exists for that reason). Don't paste secrets into prompts, and protect files like .env with deny rules (lesson 5.7). Anthropic's own note on the highest-risk setting is blunt: only use bypassPermissions in isolated environments such as containers or VMs.
Cost and speed
Usage depends on how you sign in: a Claude subscription draws on your plan's limits, while a Console account is billed per token like any API use. Long sessions cost more because every request carries the conversation so far, so lesson 5.9 covers keeping context small.
Key takeaways
- Claude Code is an agentic coding tool that reads, edits and runs things in your project, in the terminal, an IDE, the desktop app or the web.
- It works in a loop of gather context, act and verify, using built-in tools, and you can interrupt at any time.
- Sessions start fresh; lasting knowledge belongs in
CLAUDE.md and auto memory. Checkpoints undo file edits only.
- It's built on the same ideas as the API tool loop; you use it, you don't build it.
Lesson recap: the agentic loop, and what carries over between sessions.
Quick quiz
- What three phases make up Claude Code's agentic loop?
- Name three of the five built-in tool categories.
- Does a new session remember the previous one's conversation?
- What do checkpoints cover, and what can't they undo?
- When would you use the Claude API instead of Claude Code?
Answers and explanations
- Gather context, take action and verify results, repeating until done.
- Any three of file operations, search, execution, web and code intelligence.
- No. Each session starts with a fresh context window. Only
CLAUDE.md and auto memory carry knowledge across sessions.
- File edits made with Claude's file tools. They can't undo changes to remote systems such as databases, APIs or deployments.
- When you're building your own application that calls the model. Claude Code is for working on code with Claude's help.
Official references and further reading
Related tutorials