Start thinking of your daily work with coding agents as breath work. You breathe in, then you breathe out. It's the most natural thing in the world.
Inhale. Describe what you want. The agent writes a bunch of code. You figure out what you actually wanted by iterating over what the agent does. Expansion. Keep inhaling. Exploration is nearly free, so you give feedback, until it seems right. Very good. Keep inhaling. Eventually your lungs feel full, no more air fits. You're done with the inhale, but that's only half the work.
Now comes the next half, the exhale. Take what you created. Tell the agent to fold it back into what already existed before. A brand new flow turns out to be just like an old flow, except with one branch in it. Good. Refactor. Delete the new flow. Somewhere three directories over there's a helper that already does what the agent wrote out. Refactor. Delete the duplicate code, and use the helper. Contract. Contract. Contract. Exhale completely, until there is nothing left except the essence of the new functionality. The lungs are empty, but the oxygen entered the body. The breath is done.
Only now do you make the PR, no earlier! Both inhale and exhale, the expansion and the contraction of the code belong in the same pull request. A full breath, or nothing.
Begin to think about merging pre-contraction code as holding your breath. Its technical debt is carbon dioxide, retained. Fine for a minute, then uncomfortable. Unsustainable. Painful, and if not remedied, darkness.
Breathe in. Breathe out. Always.
--
h/t
@fractaledmind for the "always expand and contract in a single PR" idea that sparked this metaphor, along with the bout of bronchitis I managed to pick up in Austin at
@railsworld this year