Lesson 1

18 Built-in Tools

Bash, Edit, Read, Grep, Task...

What Claude Code tools are

Tools are the set of actions the model can call to interact with your machine: reading and editing files, searching code, running terminal commands, fetching web pages, and planning work. On its own, a language model can only generate text. Tools are what turn Claude from a chatbot into an agent that actually changes the state of your project. When you give it a task, the model does not answer blindly — it picks a suitable tool, calls it with concrete arguments, observes the result, and decides what to do next. This loop of decide → call a tool → observe the result repeats until the task is done.

How the tool categories are organized

The built-in tools are grouped by purpose, and the interactive explorer below shows exactly those categories. File tools are Read (read a file), Edit (a targeted string replacement in an existing file), and Write (create or fully overwrite a file). Search tools are Glob, which finds files by a path pattern such as src/**/*.tsx, and Grep, which searches for text and regular expressions inside files. ExecutionBash runs terminal commands (tests, builds, git), while Task delegates work to a separate subagent with its own context. Web tools WebFetch and WebSearch pull in fresh information from the internet. Planning tools — AskUserQuestion, TaskCreate, and TaskUpdate — let the model ask a clarifying question and keep a task list.

When to use which, and common mistakes

The rule is simple: to change an existing file use Edit, not Write — Write overwrites the whole file and erases anything you did not mention. To find where code lives, use Grep and Glob rather than crawling files with Bash cat — it is both faster and cheaper in tokens. A heavy or isolated subtask is best handed off to Task: the subagent keeps the main conversation context clean. The biggest pitfalls are granting the model overly broad Bash access (dangerous commands like rm -rf should be blocked through permissions and hooks), and calling Edit on a file that has not been read with Read first: without fresh content the string replacement will not match and the call fails. A concrete working loop: Claude runs Grep for useAuth, finds the right component, Read opens the file, Edit swaps one function, and Bash runs npm test to confirm nothing broke.

🛠️ Claude Code has 18+ built-in tools. Each tool is a capability the agent can use. Understanding when to use which tool is key to effective work!

Tool Categories

Read

Files

Reads file contents. Supports text, images, PDF, Jupyter notebooks.

When to use: When you need to read a file before editing or to understand code

Edit

Files

Edits a file by replacing specified text with new text. Requires exact old_string match.

When to use: For making changes to existing files. Always read the file before Edit!

Write

Files

Creates a new file or completely overwrites an existing one.

When to use: Only when a new file is needed. Prefer Edit for modifying existing files!

Glob

Search

Finds files by pattern. Faster than find or ls.

When to use: When you need to find files by name or extension

Grep

Search

Searches text in files by regex. Built on ripgrep.

When to use: When you need to find where a function, variable, or pattern is used

Bash

Execution

Executes terminal commands. git, npm, docker, etc.

When to use: For system commands: git operations, package installation, running scripts

Task

Execution

Launches a sub-agent for complex tasks. Types: Explore, Plan, Bash, etc.

When to use: For codebase exploration, planning, or when task requires many steps

WebFetch

Web

Fetches web page content and analyzes it.

When to use: When you need information from documentation or a web page

WebSearch

Web

Web search for up-to-date information.

When to use: When you need current information beyond knowledge cutoff

AskUserQuestion

Planning

Asks the user a question when clarification is needed.

When to use: When requirements are unclear or need to choose between approaches

TaskCreate/TaskUpdate

Planning

Creates and updates task list for tracking progress.

When to use: For complex multi-step tasks to maintain context

💡 Best Practices

✅ Do

  • • Always Read before Edit
  • • Use Glob instead of find
  • • Use Grep instead of grep
  • • Parallel calls when possible

❌ Don't

  • • Edit without prior Read
  • • Bash for reading files (cat)
  • • Write instead of Edit for changes
  • • Guessing parameters

Frequently asked questions

What tools does Claude Code have

The built-in tools are grouped by category: file tools — Read, Edit, Write; search tools — Glob and Grep; execution — Bash and Task; web — WebFetch and WebSearch; planning — AskUserQuestion, TaskCreate, and TaskUpdate. Through them the model reads and changes files, searches code, runs commands, and reaches the internet.

What is the difference between Edit and Write in Claude Code

Edit makes a targeted string replacement in an existing file and keeps the rest intact, while Write creates a new file or fully overwrites one, erasing anything you did not mention. Use Edit to change existing code and Write only for new files.

Why use the Task tool in Claude Code

Task delegates a subtask to a separate subagent with its own context. This is useful for heavy or isolated work: the subagent does not clutter the main conversation, completes the task, and returns the result, saving the main agent's context and tokens.

How do I restrict dangerous Bash commands in Claude Code

Dangerous commands like rm -rf should be blocked through permission settings and hooks. That lets you control which Bash commands the model may run and prevents it from executing destructive actions without your confirmation.

Lesson Quiz

1 of 1

1.What permission model does Claude Code use for tool execution?

This lesson is part of a structured LLM course.

My Learning Path