The Read / Edit / Write Loop
How Claude Code safely changes your files.
Why a Loop, Not a Magic Wand
Claude Code never silently rewrites your files from memory. It changes code through a disciplined cycle of three built-in tools: Read, Edit, and Write.
This loop exists for one reason: safety. The model only edits text it has actually loaded, so changes are grounded in the real file on disk, not in a hallucinated version of it.
In this lesson you will learn how each tool behaves, when Claude picks one over another, and the failure modes the exam expects you to recognize.
The Built-in Tool Family
Claude Code ships with a small, deliberate set of file tools. Each has a sharp purpose:
- Glob — find files by pattern, e.g.
**/*.test.tsx - Grep — search file contents
- Read — load one file into context
- Edit — make a precise, unique-match change
- Write — create a file (or fully replace one)
- Bash — run shell commands
The write loop is the heart of this set: you Read to ground, then Edit or Write to change.
All lessons in this course
- What Is Claude Code
- Interactive vs Headless
- The Read / Edit / Write Loop
- Memory & Compact Commands