Skip to content

Chapter 13: Claude Code Built-in Tools

13.1 Tool Selection Reference

TaskToolExample
Find files by name/patternGlob**/*.test.tsx, src/components/**/*.ts
Search within filesGrepFunction name, error message, import
Read a file in fullReadLoad a file for analysis
Write a new fileWriteCreate a file from scratch
Edit an existing file preciselyEditReplace a specific snippet via unique text match
Run a shell commandBashgit, npm, run tests, build

13.2 Incremental Investigation Strategy

Do not read all files at once. Build understanding incrementally:

1. Grep: find entry points (function definition, export)
2. Read: read the found files
3. Grep: find usages (import, calls)
4. Read: read consumer files
5. Repeat until you have a complete picture

13.3 Fallback: Read + Write Instead of Edit

When Edit fails due to a non-unique text match:

  1. Read — load the full file content
  2. Modify the content programmatically
  3. Write — write the updated version