Chapter 13
Built-in Tools
One job per tool, Grep-first investigation, and what to do when Edit has nothing unique to match.
13.1
Tool selection
Six tools, one job each. Scenario questions here are really asking which job you are doing.
| tool | the job | example |
|---|---|---|
| Glob | find files by name or pattern | **/*.test.tsx, src/components/**/*.ts |
| Grep | search inside files | a function name, an error message, an import |
| Read | load a file in full | read it once you know it matters |
| Write | create a file from scratch | a new module, a new config |
| Edit | change an existing file precisely | replace a snippet matched by unique text |
| Bash | run a shell command | git, npm, tests, build |
13.2
Investigate in steps, not in one gulp
Search narrows, read confirms, search again from what you learned. Never read everything first.
13.3
When Edit cannot match
Edit needs unique text. If the snippet appears twice, it fails — and retrying it fails identically.
Readfull contents
→modifyprogrammatically
→Writethe updated version
Recall in 60 seconds
- Glob finds files by name; Grep searches inside them.
- Read loads a file in full — after a search told you it matters.
- Edit replaces a snippet matched by unique text; Write creates a file.
- Bash is for shell commands — git, npm, tests, builds.
- Investigate incrementally: Grep entry points → Read → Grep usages → Read consumers → repeat.
- Never read every file up front; each Read should be earned by a match.
- Edit fails on a non-unique match — fall back to Read, modify, Write.