Two things that worked for me. Put ‘Make the smallest change that does the job, never reformat code you weren’t asked to touch’ in CLAUDE.md at the project root. And ask it to tell you the plan before it edits, then say go. The second one alone cut most of the drive-by rewrites.
Sep 12Sofia L., Zaina, Yoon and others agree
Also check whether it’s actually your formatter. Mine was rewriting the whole file because it ran black after every edit and my file had never been through black. Looked like Claude, was the formatter.
YesterdaySung-min and Victor O. agree
Commit before every ask. Then when it does the big rewrite you just git checkout the file and try again with a narrower prompt. Cheaper than arguing with it.
YesterdayZaina agrees
It was both. CLAUDE.md line plus it was running my formatter on save. Thanks.
Yesterday