Ambient Improvement
Finish the job. Then, if it costs you only a minute, leave one thing clearer than you found it.
You open a file to fix a bug. The bug is on line 47. But on your way
there you notice a variable called tmp2, a dead import, and
a comment that describes what the code did two refactors ago.
You can ignore all three. You can also fix them in about ninety seconds.
This is not a refactoring crusade. It is not an excuse to expand scope. It is the same instinct that makes you sand the underside of a shelf—nobody will see it, but you’ll know.
The habit
Do the primary task first. Ship the feature, fix the bug. Then, while the file is open and the context is loaded in your head, look for one small thing:
- Rename a misleading variable.
- Delete a dead import.
- Tighten a conditional you just had to re-read three times.
- Add the comment that would have saved you five minutes.
One thing. Not a cleanup pass. Not “while I’m here I might as well…”—that way lies a three-day yak shave.
Why it compounds
Every intervention leaves traces. Most traces are friction: a hastily renamed variable, a TODO that will never be done, a workaround that outlives the thing it worked around. Ambient improvement flips the sign. The traces you leave reduce friction for the next person—who is usually you, six months from now, with no memory of what you were thinking.
A codebase shaped by this habit drifts toward clarity. Intent surfaces. Edges soften. One day you open a module expecting to wrestle with it and instead it just… makes sense.
A codebase without it drifts the other way. Slowly. Invisibly.
Three rules
- Never delay the primary task. The improvement rides along; it doesn’t steer.
- Keep it local and reversible. If the reviewer can’t tell your cleanup from your fix, scope it smaller.
- Let the diff speak. No commit message essays. The renamed variable is its own argument.
The goal is not heroics. The goal is positive residue.