code-polish
Rule
Polish is a behavior-preserving rewrite of the current change set into the version a careful senior engineer would have written on the first try. Not a feature pass, not a refactor of the codebase, not a bug hunt — a pass that makes the diff about to be committed look intentional.
The benchmark for every hunk in the diff is one question:
If I were solving this problem fresh, knowing what I know now, would I write this line?
If no, it goes or it gets rewritten. Iteration history — "tried X, didn't work, added Y on top, then Z fixed it" — must not survive into the commit. Only Z survives, written cleanly, at the right place.
Work through the steps below in order. Each step is a separate lens over the same diff; don't skip ahead to "documentation" while debris is still lying around, because half of what you'd document is about to be deleted.