In the previous lesson, I described the agentic loop: gather, plan, act, verify. But what does "act" actually mean in practice? What can Claude Code physically do on your machine?
The answer is tools. Claude does not just generate text. It calls tools — specific functions that read files, write code, run commands, and search the web. Understanding these tools is not optional. It directly affects how you work with the agent.
The five categories
Read
Read files, Glob (find files by pattern), Grep (search content by regex). This is how Claude explores your codebase. Every gather phase starts here.
Write
Write new files from scratch, Edit existing files with surgical string replacement. Edit does not rewrite the whole file — it finds a specific string and replaces it. Precise and context-efficient.
Execute
Bash commands. Anything you can run in a terminal: build, test, lint, git, npm, curl, custom scripts. This is the most powerful and most dangerous category.
Search
WebSearch and WebFetch. Look up documentation, check npm packages, read external resources. Claude is not limited to what is in your repo.
Orchestrate
Agent tool (spawn subagents for isolated tasks), TodoWrite (track multi-step progress). These let Claude manage complexity by breaking work into pieces.
Let me break each one down with what I have learned using them daily.
Read tools: the foundation
Three tools, three purposes:
- Read opens a specific file and returns its contents. You know the path, you want the content. Simple.
- Glob finds files by pattern.
**/*.tsxfinds all TypeScript React files.src/**/test*finds test files anywhere under src. This is how Claude discovers what exists. - Grep searches file contents by regex. "Where is
handleSubmitused?" — Grep answers that in milliseconds across your entire codebase.
The read tools are the cheapest tools in terms of risk — they change nothing. But they are the most expensive in terms of context. Reading a 2000-line file dumps all 2000 lines into the context window. Even with a 1 million token context window, careless reads add up fast. Read enough big files and you have consumed a significant chunk of your budget.
Write tools: surgical precision
Claude has two write tools, and the distinction matters.
Write creates a new file or completely overwrites an existing one. The entire file content is specified. Use this for new files.
Edit is the precision instrument. It takes an old_string and a new_string. Claude specifies exactly which text to find and what to replace it with. The old string must be unique in the file — if it is not, the edit fails and Claude has to be more specific.
Edit file: src/components/Button.tsx
old_string: "className=\"bg-blue-500\""
new_string: "className=\"bg-blue-500 hover:bg-blue-600 transition-colors\""
Edit is dramatically more context-efficient than Write. Instead of sending the entire file, Claude sends only the changed portion. On a 500-line file where you are changing 2 lines, Edit uses roughly 1% of the context that Write would.
This is not just an implementation detail. It affects how you structure prompts. If you ask Claude to "rewrite the entire component," it will use Write and burn context. If you ask Claude to "add hover styles to the Button," it will use Edit. Same result, very different cost.
Execute: the double-edged sword
Bash is the most powerful tool Claude has. It can run anything your terminal can run:
pnpm build # Check if the project compiles
pnpm lint # Run the linter
pnpm test # Run the test suite
git diff # See what changed
git log --oneline -5 # Check recent history
npx tsc --noEmit # Type check without building
Bash is what makes the verify phase possible. Without it, Claude would have no way to check its own work. But Bash is also the tool that can cause real damage. rm -rf, git push --force, a destructive database migration — these are all valid bash commands that Claude could theoretically run.
That is why Claude Code has a permission system. By default, every Bash command requires your approval. You see the command, you approve or reject it. As you build trust, you can allowlist safe commands like pnpm build and pnpm lint so they run without prompting. We cover this in Chapter 6.
Hooks: automated rules around tool calls
Here is what gets interesting. You do not have to watch Bash commands forever. You can write hooks — scripts that fire automatically before or after tool calls — that enforce rules for you:
Block hanging commands
A pre-bash hook detects dev server commands (pnpm dev, npm start) and blocks them from running inside Claude's session — where they would hang indefinitely and waste your context. Instead, it redirects them to a tmux session.
Review before pushing
A pre-bash hook catches git push and adds a reminder to review changes first. Not a blocker — a nudge at exactly the right moment.
Auto-format on edit
A post-edit hook runs your formatter (Biome, Prettier) after every file change. Claude never submits unformatted code, and you never have to ask.
These are hooks — automated rules that fire before or after tool calls. You will learn to build them in Chapter 5. For now, the point is: the execute phase does not have to be manual supervision. It can be a system.
Search: reaching beyond the repo
WebSearch and WebFetch let Claude look things up on the internet. This sounds minor, but it solves a real problem: documentation drift.
When Claude needs to use an API it has not seen recently — a new version of a library, an unfamiliar service — it can search for the current docs instead of guessing from training data. I have seen Claude WebFetch the Supabase documentation to check a function signature it was unsure about, then use the correct API on the first try.
The limitation is context cost. A web page dumped into context can be thousands of tokens. Claude is usually selective — it fetches a specific documentation page, not a whole site. But be aware that heavy web searching eats into your context budget.
Orchestrate: managing complexity
Two tools here, both underused by most developers.
Agent spawns a subagent — a separate Claude instance with its own context window. The main Claude delegates a task ("research how this library handles authentication"), the subagent does the work, and only the summary comes back to the main context.
This is enormously powerful for research-heavy tasks. Instead of reading 20 files in the main context (burning 20 files worth of tokens), Claude spawns a subagent that reads the files in its own isolated context and returns a 200-token summary.
TodoWrite tracks multi-step progress. On complex tasks, Claude creates a todo list and checks items off as it completes them. This helps the model stay organized when a task has many parts.
We dive deep into subagents in Chapter 4. For now, just know they exist and that they solve the context management problem.
Every tool has a cost
This is the key insight most people miss. Every tool call consumes context.
- Reading a file: the entire file content enters the context window
- Running a Bash command: the command output enters the context window
- A WebFetch: the page content enters the context window
- Even an Edit: the old and new strings enter the context window
MCP: extending the toolbox
Beyond the built-in tools, Claude Code supports MCP (Model Context Protocol) servers. These add new tools that connect to external services:
- Supabase MCP: Run SQL, manage migrations, list tables directly from Claude
- GitHub MCP: Create PRs, review code, manage issues
- Playwright MCP: Run browser tests, take screenshots
- Context7 MCP: Fetch up-to-date library documentation
Each active MCP adds its tool descriptions to the context. A Supabase MCP might add 15 tools, each with a description that costs tokens. Ten MCPs with 10 tools each means 100 tool descriptions loaded into every session.
I run three MCPs on my main project: Supabase, Context7, and GitHub. That covers database operations, documentation lookup, and PR management — the three things I cannot do with built-in tools alone.
Three more worth knowing about:
- Context7 — feeds Claude live, up-to-date documentation for any library. Instead of guessing from training data, Claude gets the current API. No more deprecated method suggestions.
- Playwright — Claude opens an actual browser, navigates pages, and verifies things visually. Not screenshots you take and paste — Claude does it autonomously during the verify phase.
- Sequential-Thinking — structured chain-of-thought reasoning for architecture decisions. When a problem is too complex for a single pass, this MCP forces Claude through a deliberate reasoning process.
Each one extends what the agent can do. But each one costs context. That tradeoff — capability versus context budget — will come up again and again.
Guiding better tool choices
Now that you understand the tools, you can start guiding Claude toward better choices. Here are three patterns I use daily:
These three patterns are free. You can start using them today. But they are manual — you have to remember them every session, and Claude has to follow guidance it might forget after compaction.
In Chapter 2, you encode them in CLAUDE.md so they load automatically. In Chapter 4, skills make Claude follow entire workflows — not just three patterns, but dozens — without being reminded. The gap between "I know the right patterns" and "the system enforces them" is what Chapters 2 through 7 close.