tools-reference
# Claude Code Tools Reference
What this skill does
# Claude Code Tools Reference
Complete reference for every built-in tool available in Claude Code.
## File Tools
### Read
Read file contents from the filesystem.
```
Parameters:
file_path: string (required) — Absolute path to file
offset: number (optional) — Start line number
limit: number (optional) — Number of lines to read
pages: string (optional) — Page range for PDFs (e.g., "1-5")
Capabilities:
- Text files with line numbers (cat -n format)
- Image files (PNG, JPG, etc.) — rendered visually
- PDF files — max 20 pages per request
- Jupyter notebooks (.ipynb) — all cells with outputs
- Lines >2000 chars are truncated
- Default: up to 2000 lines from start
- Max token limit: 25000 tokens per read
```
### Write
Create or overwrite files.
```
Parameters:
file_path: string (required) — Absolute path
content: string (required) — File content
Rules:
- Overwrites existing files
- Must Read file first before overwriting existing files
- Prefer Edit for modifications to existing files
- Never create documentation files unless explicitly requested
```
### Edit
Make targeted string replacements in files.
```
Parameters:
file_path: string (required) — Absolute path
old_string: string (required) — Text to find
new_string: string (required) — Replacement text
replace_all: boolean (optional, default: false) — Replace all occurrences
Rules:
- Must Read file first
- old_string must be unique in file (or use replace_all)
- Preserves exact indentation from file
- Never include line number prefixes in old_string/new_string
```
### Glob
Find files by pattern matching.
```
Parameters:
pattern: string (required) — Glob pattern (e.g., "**/*.ts")
path: string (optional) — Directory to search in
Patterns:
- "**/*.ts" — All TypeScript files recursively
- "src/**/*.test.ts" — Test files in src
- "*.json" — JSON files in current directory
- "{src,lib}/**/*.{ts,tsx}" — Multiple patterns
Returns: File paths sorted by modification time
```
### Grep
Search file contents with regex (powered by ripgrep).
```
Parameters:
pattern: string (required) — Regex pattern
path: string (optional) — File/directory to search
glob: string (optional) — Glob filter for files
type: string (optional) — File type filter (js, py, etc.)
output_mode: "files_with_matches" | "content" | "count"
-A: number — Lines after match
-B: number — Lines before match
-C / context: number — Lines around match
-i: boolean — Case insensitive
-n: boolean — Show line numbers (default: true)
multiline: boolean — Enable multiline matching
head_limit: number — Limit output lines
offset: number — Skip first N entries
Notes:
- Uses ripgrep syntax (not grep)
- Escape literal braces: interface\{\}
- Default output_mode: files_with_matches
```
## Shell Tools
### Bash
Execute shell commands.
```
Parameters:
command: string (required) — The command to execute
description: string (required) — What the command does
timeout: number (optional) — Timeout in ms (max 600000 / 10 min)
run_in_background: boolean (optional) — Run async
dangerouslyDisableSandbox: boolean (optional) — Disable sandbox
Rules:
- Working directory persists between calls
- Shell state (variables, aliases) does NOT persist
- Always quote paths with spaces
- Use absolute paths when possible
- Prefer dedicated tools over bash equivalents
- Use && to chain dependent commands
- Use ; when order matters but failure doesn't
- Never use -i flag (interactive) with git
```
## Web Tools
### WebFetch
Fetch and analyze web content.
```
Parameters:
url: string (required) — URL to fetch
prompt: string (required) — What to extract
Notes:
- Auto-upgrades HTTP to HTTPS
- Converts HTML to markdown
- Summarizes large content
- 15-minute cache
- For GitHub URLs, prefer gh CLI
```
### WebSearch
Search the web.
```
Parameters:
query: string (required) — Search query
allowed_domains: string[] (optional) — Domain whitelist
blocked_domains: string[] (optional) — Domain blocklist
Notes:
- Returns search results with URLs
- Must include Sources section in response
- US-only availability
```
## Agent Tools
### Agent
Spawn specialized sub-agents.
```
Parameters:
prompt: string (required) — Task description
subagent_type: string (required) — Agent specialization
description: string (required) — 3-5 word summary
run_in_background: boolean (optional) — Async execution
isolation: "worktree" (optional) — Git worktree isolation
mode: string (optional) — Permission mode
resume: string (optional) — Resume previous agent by ID
name: string (optional) — Agent name
Returns: Agent result text (not visible to user automatically)
```
### TodoWrite
Track tasks and progress.
```
Parameters:
todos: array (required) — Todo items
- content: string — Task description (imperative)
- status: "pending" | "in_progress" | "completed"
- activeForm: string — Present continuous form
Rules:
- Only one task in_progress at a time
- Mark complete immediately after finishing
- Use for 3+ step tasks
- Don't use for single trivial tasks
```
## Notebook Tools
### NotebookEdit
Edit Jupyter notebook cells.
```
Parameters:
notebook_path: string (required) — Absolute path to .ipynb
new_source: string (required) — New cell content
cell_id: string (optional) — Cell ID to edit
cell_type: "code" | "markdown" (optional)
edit_mode: "replace" | "insert" | "delete" (optional)
Notes:
- cell_number is 0-indexed
- insert adds after specified cell
- Must specify cell_type for insert
```
## Interactive Tools
### AskUserQuestion
Ask the user questions during execution.
```
Parameters:
questions: array (required, 1-4 items)
- question: string — The question text
- header: string — Short label (max 12 chars)
- options: array (2-4 items)
- label: string — Display text
- description: string — Explanation
- preview: string (optional) — Preview content
- multiSelect: boolean — Allow multiple selections
Notes:
- Users can always select "Other" for custom input
- Use for gathering preferences, not plan approval
- In plan mode, use ExitPlanMode for plan approval
```
### Skill
Invoke slash commands.
```
Parameters:
skill: string (required) — Skill name (e.g., "commit")
args: string (optional) — Arguments
Notes:
- Only for skills listed in user-invocable skills
- Don't guess skill names
- Don't use for built-in CLI commands
```
## Tool Best Practices
1. **Prefer dedicated tools** — Use Read instead of `cat`, Edit instead of `sed`
2. **Read before editing** — Always Read a file before Edit or Write
3. **Parallel calls** — Make independent tool calls in the same message
4. **Sequential dependencies** — Wait for results before dependent calls
5. **Glob before Read** — Find files first, then read specific ones
6. **Agent for research** — Use agents to keep main context clean
7. **Background for long tasks** — Use `run_in_background` for slow operations
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.