Claude Code is Anthropic's tool-based AI coding assistant that orchestrates complex development tasks through specialized sub-agents and a comprehensive tool ecosystem. This system emphasizes task delegation via the Task tool for multi-step operations, structured file editing workflows, and plan mode for complex implementations. Claude Code integrates with the local filesystem and shell environment to provide IDE-integrated development assistance.
For other IDE-integrated systems, see VSCode Agent, Windsurf Cascade, and Amp. For web-based platforms, see Web-Based Development Platforms.
Sources: Anthropic/Claude Code/Tools.json1-509
Claude Code provides 16 distinct tools organized into four functional categories: file system interaction, orchestration and execution, specialized content, and workflow management. The architecture prioritizes read-before-write operations, exact string matching for edits, and sub-agent delegation for complex tasks.
Tool Category Mapping
| Category | Tools | Primary Use Case |
|---|---|---|
| File System Interaction | Read, Edit, MultiEdit, Write, NotebookEdit, LS | Reading and modifying local files |
| Orchestration & Execution | Task, Bash, BashOutput, KillBash, ExitPlanMode | Delegating complex tasks and running commands |
| Search & Discovery | Grep, Glob | Finding files and code patterns |
| External Resources | WebFetch, WebSearch, TodoWrite | Web access and task tracking |
Sources: Anthropic/Claude Code/Tools.json1-509
Claude Code follows a hierarchical tool selection pattern where the appropriate tool depends on task complexity and search precision requirements:
Sources: Anthropic/Claude Code/Tools.json3-29 Anthropic/Claude Code/Tools.json62-81 Anthropic/Claude Code/Tools.json83-148
The Task tool is Claude Code's primary orchestration mechanism for delegating complex, multi-step operations to specialized sub-agents. Each sub-agent type has restricted tool access and operates autonomously to complete its assigned task.
The Task tool requires three parameters for sub-agent invocation:
| Parameter | Type | Description |
|---|---|---|
description | string | Short 3-5 word task description |
prompt | string | Detailed autonomous task instructions |
subagent_type | string | Agent specialization: general-purpose, statusline-setup, or output-style-setup |
Sources: Anthropic/Claude Code/Tools.json3-29
The Task tool should be used for:
Avoid using Task tool when:
Read or Glob directlyGlob insteadRead tool directlyUsage Pattern:
Sources: Anthropic/Claude Code/Tools.json3-29
Sub-agents are stateless and single-use:
Sources: Anthropic/Claude Code/Tools.json3-29
Claude Code enforces strict file editing workflows with mandatory read-before-write requirements and exact string matching. The system provides three editing tools for different use cases: Edit for single replacements, MultiEdit for sequential operations, and Write for new files or complete overwrites.
Sources: Anthropic/Claude Code/Tools.json193-217 Anthropic/Claude Code/Tools.json219-250 Anthropic/Claude Code/Tools.json252-297 Anthropic/Claude Code/Tools.json299-321
The Edit tool performs exact string replacement in files with mandatory uniqueness checking.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path | string | Yes | Absolute path to file |
old_string | string | Yes | Text to replace (must be unique) |
new_string | string | Yes | Replacement text (must differ from old_string) |
replace_all | boolean | No | Replace all occurrences (default: false) |
Critical Requirements:
Read tool before editing (enforced with error)old_string must be unique in file unless replace_all=trueRead output (after line number prefix)spaces + line number + tab (exclude from match strings)Sources: Anthropic/Claude Code/Tools.json219-250
The MultiEdit tool enables multiple edits to a single file in one atomic operation, with each edit operating on the result of the previous edit.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path | string | Yes | Absolute path to file |
edits | array | Yes | Array of edit operations (min 1) |
Edit Object Schema:
| Field | Type | Required | Description |
|---|---|---|---|
old_string | string | Yes | Text to replace |
new_string | string | Yes | Replacement text |
replace_all | boolean | No | Replace all occurrences (default: false) |
Key Characteristics:
Edit toolEdit calls for same fileold_string, subsequent edits modify created contentSources: Anthropic/Claude Code/Tools.json252-297
The Write tool completely overwrites file contents or creates new files.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path | string | Yes | Absolute path to file |
content | string | Yes | Complete file content |
Constraints:
Read first (enforced with error)Sources: Anthropic/Claude Code/Tools.json299-321
The NotebookEdit tool modifies Jupyter notebook (.ipynb) cells with support for replace, insert, and delete operations.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
notebook_path | string | Yes | Absolute path to .ipynb file |
cell_id | string | Yes | Cell ID to edit/reference |
new_source | string | Yes | New cell source content |
cell_type | string | No | "code" or "markdown" (required for insert mode) |
edit_mode | string | No | "replace" (default), "insert", or "delete" |
Edit Modes:
cell_idcell_id (or at beginning if cell_id not specified)cell_idSources: Anthropic/Claude Code/Tools.json322-365
Claude Code provides persistent shell session management through the Bash tool with support for background execution, output monitoring, and shell lifecycle control. The system enforces specific patterns for git operations and GitHub interactions.
Sources: Anthropic/Claude Code/Tools.json31-60 Anthropic/Claude Code/Tools.json467-488 Anthropic/Claude Code/Tools.json489-506
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | Shell command to execute |
timeout | number | No | Timeout in ms (default: 120000, max: 600000) |
description | string | No | 5-10 word description of command purpose |
run_in_background | boolean | No | Execute in background (default: false) |
Critical Requirements:
cd "path with spaces/file.txt"; or && to separate commands (NO newlines except in quoted strings)cd - use absolute paths instead for better session maintenancefind and grep - use Grep and Glob tools insteadcat, head, tail, ls - use Read and LS tools insteadgrep, STOP and use rg (ripgrep) which is pre-installed& at end when using run_in_background parameterSources: Anthropic/Claude Code/Tools.json31-60
When creating git commits, Claude Code follows a strict parallel execution pattern:
Commit Message Format (using HEREDOC):
Git Operation Constraints:
-i flag (interactive mode not supported)Sources: Anthropic/Claude Code/Tools.json31-60
Claude Code uses the gh CLI tool for all GitHub operations:
PR Body Format (using HEREDOC):
PR Constraints:
gh command for ALL GitHub operations (issues, PRs, checks, releases)Other GitHub Operations:
Sources: Anthropic/Claude Code/Tools.json31-60
BashOutput Tool - Monitor background shell output:
| Parameter | Type | Required | Description |
|---|---|---|---|
bash_id | string | Yes | Background shell ID to monitor |
filter | string | No | Regex to filter output lines |
Returns only new output since last check. Filtered-out lines are permanently discarded.
KillBash Tool - Terminate background shell:
| Parameter | Type | Required | Description |
|---|---|---|---|
shell_id | string | Yes | Shell ID to terminate |
Shell IDs can be found using the /bashes command.
Sources: Anthropic/Claude Code/Tools.json467-488 Anthropic/Claude Code/Tools.json489-506
The TodoWrite tool provides structured task tracking for coding sessions, enabling progress monitoring and demonstrating thoroughness. Tasks progress through three states: pending, in_progress, and completed.
Sources: Anthropic/Claude Code/Tools.json390-433
The tool takes a single parameter:
| Parameter | Type | Required | Description |
|---|---|---|---|
todos | array | Yes | Updated todo list with content, status, and id fields |
Todo Object Schema:
| Field | Type | Values | Description |
|---|---|---|---|
content | string | - | Task description (min 1 character) |
status | string | pending, in_progress, completed | Current task state |
id | string | - | Unique task identifier |
Sources: Anthropic/Claude Code/Tools.json390-433
Use TodoWrite proactively in these scenarios:
in_progress BEFORE beginningcompleted and add follow-up tasksSkip TodoWrite when:
Sources: Anthropic/Claude Code/Tools.json390-433
Task Completion Requirements:
ONLY mark task as completed when:
Keep task as in_progress when:
Task State Management Rules:
completed IMMEDIATELY after finishing (no batching)in_progress at any timeSources: Anthropic/Claude Code/Tools.json390-433
Example 1: Multi-step Feature Implementation
User: "Add dark mode toggle to settings. Run tests and build when done."
Assistant creates TodoWrite:
1. Create dark mode toggle component in Settings page (pending)
2. Add dark mode state management (context/store) (pending)
3. Implement CSS-in-JS styles for dark theme (pending)
4. Update existing components to support theme switching (pending)
5. Run tests and build process, addressing any failures (pending)
Example 2: Codebase-wide Refactor
User: "Rename getCwd to getCurrentWorkingDirectory across project"
Assistant first searches, finds 15 instances across 8 files, then creates TodoWrite:
1. Update src/utils/filesystem.ts (pending)
2. Update src/commands/init.ts (pending)
3. Update src/lib/paths.ts (pending)
[... one task per file requiring changes ...]
Example 3: Counter-example - NO TodoWrite
User: "Add a comment to the calculateTotal function"
Assistant uses Edit tool directly without TodoWrite.
Reason: Single, straightforward task with no tracking benefit.
Sources: Anthropic/Claude Code/Tools.json390-433
Claude Code provides three complementary search tools optimized for different discovery patterns: Grep for content search, Glob for file pattern matching, and LS for directory structure exploration.
Sources: Anthropic/Claude Code/Tools.json62-81 Anthropic/Claude Code/Tools.json83-148 Anthropic/Claude Code/Tools.json150-173
The Grep tool leverages ripgrep for powerful content searching with regex support, file filtering, and multiple output modes.
Parameters:
| Parameter | Type | Description |
|---|---|---|
pattern | string | Regex pattern (ripgrep syntax, not standard grep) |
path | string | File or directory to search (default: current directory) |
glob | string | File filter pattern (e.g., ".js", ".{ts,tsx}") |
output_mode | enum | "content", "files_with_matches" (default), "count" |
-B | number | Lines before match (content mode only) |
-A | number | Lines after match (content mode only) |
-C | number | Lines before and after match (content mode only) |
-n | boolean | Show line numbers (content mode only) |
-i | boolean | Case insensitive search |
type | string | File type filter (js, py, rust, go, java, etc.) |
head_limit | number | Limit output to first N lines/entries |
multiline | boolean | Enable multiline mode where . matches newlines |
Critical Requirements:
Grep tool for search - NEVER invoke grep or rg as Bash commandinterface\{\})multiline: true for cross-line patterns like struct \{[\s\S]*?fieldOutput Modes:
| Mode | Description | Supports Context (-A/-B/-C) | Supports head_limit |
|---|---|---|---|
content | Shows matching lines with context | Yes | Yes (limits output lines) |
files_with_matches | Shows only file paths | No | Yes (limits file paths) |
count | Shows match counts per file | No | Yes (limits count entries) |
Sources: Anthropic/Claude Code/Tools.json83-148
The Glob tool provides fast file pattern matching using glob syntax, sorted by modification time.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
pattern | string | Yes | Glob pattern (e.g., "/*.js", "src//*.ts") |
path | string | No | Directory to search (default: current directory) |
Key Characteristics:
Task tool insteadCommon Patterns:
**/*.js - All JavaScript files recursivelysrc/**/*.ts - All TypeScript files under src/**/test/*.py - All Python files in any test/ directoryconfig/*.json - All JSON files directly under config/Sources: Anthropic/Claude Code/Tools.json62-81
The LS tool lists files and directories at a specific path with optional glob pattern filtering.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Absolute path to directory (must be absolute, not relative) |
ignore | array | No | Array of glob patterns to ignore |
Usage Guidelines:
Glob and Grep tools if you know which directories to searchLS when you need to explore directory structure without specific patterns["node_modules", ".git"])Sources: Anthropic/Claude Code/Tools.json150-173
Sources: Anthropic/Claude Code/Tools.json62-81 Anthropic/Claude Code/Tools.json83-148 Anthropic/Claude Code/Tools.json150-173
Claude Code provides two tools for web interaction: WebFetch for retrieving and analyzing specific URLs, and WebSearch for discovering information across the web.
The WebFetch tool fetches web content, converts HTML to markdown, and processes it with an AI model to extract specific information.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string (URI) | Yes | Fully-formed valid URL to fetch |
prompt | string | Yes | Extraction prompt for AI model |
Characteristics:
Usage Pattern:
mcp__) if available (fewer restrictions)Sources: Anthropic/Claude Code/Tools.json366-389
The WebSearch tool performs web searches and returns formatted search results.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query (min 2 characters) |
allowed_domains | array | No | Only include results from these domains |
blocked_domains | array | No | Never include results from these domains |
Characteristics:
<env> for "Today's date")Usage Note: When user wants latest docs and <env> shows "Today's date: 2025-07-01", do NOT use 2024 in search query - use current year 2025.
Sources: Anthropic/Claude Code/Tools.json434-466
Claude Code includes a plan mode for complex implementation tasks, exited via the ExitPlanMode tool after presenting a concise plan for user approval.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
plan | string | Yes | Concise plan in markdown format |
Usage Guidelines:
When to use ExitPlanMode:
When NOT to use ExitPlanMode:
Examples:
| Task Type | Use ExitPlanMode? | Reason |
|---|---|---|
| "Search for and understand vim mode implementation" | NO | Research task, no coding |
| "Help me implement yank mode for vim" | YES | Implementation task requiring code |
| "Find all usages of DatabaseConnection" | NO | Search/discovery task |
| "Refactor authentication to use JWT tokens" | YES | Implementation task requiring code |
Plan Characteristics:
Sources: Anthropic/Claude Code/Tools.json175-192
Claude Code's architecture centers on three core mechanisms:
The system enforces critical operational constraints: mandatory file reading before editing, atomic MultiEdit operations, single in_progress task limits, parallel tool execution for independent operations, absolute path requirements, and preference for specialized tools (Grep, Glob) over Bash alternatives. Git workflows require HEREDOC message formatting and parallel information gathering, while search operations prioritize ripgrep-based Grep for content, Glob for file patterns, and LS for directory exploration.
Refresh this wiki