The Price of One Sentence: 「Clean Up the Temp Files」
Last month I asked our cleanup bot to 「clear out the temp files we don't use」. It was diligent and deleted every folder with temp in its name. The catch: one of them was a working folder that had never been saved to history. It wasn't in the recycle bin either, so I spent half a day rebuilding it.
Only Two Changes
1. Save a snapshot (a commit) right before any risky action
2. Lock that habit into CLAUDE.md as a single line
Try It Yourself
Step 1. Turn on git once in your project folder. Type these three lines in the terminal.
git init
git add -A
git commit -m 'snap: first record'
Step 2. Add this sentence to CLAUDE.md.
Before deleting files or changing many files at once, create a snapshot commit first, show me the list of what will be deleted, and wait for my answer.
Step 3. If something goes wrong, don't panic. Tell Claude Code 「restore the deleted folder from the last snapshot」. Under the hood, git restore does the work.
The Result
For the following month the same accident happened 0 times, and about 20 snapshots piled up. Once a file really did vanish, and recovery took 3 minutes. The bigger effect was a surprise: 「show me the list first」. When the bot puts the delete list in front of me, I can say 「skip this one」. It creates a spot where a human does the final check.
A bot does exactly what you ask. So putting a safety catch in front of the instruction is the cheapest fix.