Edit vs Write
People often think Write can change part of a file. It cannot. Write puts in a whole new file and throws the old text away. Edit swaps one exact piece of text and leaves the rest alone. So Claude uses Write for a new file and Edit for a small fix. A rule for Edit on a folder covers Write there too.
Edit Tool
The tool that swaps one exact piece of text in a file.
The Edit tool changes one part of a file. It takes a piece of old text and the new text to put in its place. The old text must match the file exactly, down to the spaces. It must also appear only once, unless Claude asks to replace every copy. Edit does not use patterns or guess. An Edit rule with a path also covers Write and NotebookEdit.
Write Tool
The tool that makes a new file or replaces a whole one.
The Write tool makes a new file, or replaces a whole file with new text. It does not add to the end or mix old and new. For a small change to a file that already exists, Claude uses Edit instead. Before Claude replaces a file that exists, it usually has to have read it in the same session. Write asks for permission before it runs, unless your mode or rules allow it.
In one line
- Edit Tool
- The tool that swaps one exact piece of text in a file.
- Write Tool
- The tool that makes a new file or replaces a whole one.