Understand git history first
Learn the context behind code before you change it.
Official basis Point Claude to sources — including git history — for context. docs ↗
The prompt
Look through the git history of <file> and summarize how its API evolved and why, before we refactor it. Flag any change that looks like it was made to fix a specific bug. Why it works
Code often looks arbitrary until you see why it got that way. History surfaces the bug-fix commits and design turns that a naive refactor would happily undo.
Fill in
<file>— the file you’re about to refactor.
Follow-ups
- “Given that history, which parts are risky to touch? Refactor around them.”