I came across ‘The Boy Scout Rule’ in a technical book years ago (the exact source escapes me). The rule says:
“Leave the campground cleaner than you found it.”
I was amazed by the beauty and simplicity of the idea, and it has been my guiding principle on software development ever since. Those who have worked with me know that I always make a point to apply this principle whether I review merge requests, write some code or pair with a colleague.
Refactoring, documenting and simplifying aren’t difficult to do if they are part of your daily workflow.
I am positive that the small improvements that you can casually do whenever you write a new feature to accommodate for the new code, are the ones with the highest returns on software quality. They pave the way for an organically clean and maintainable codebase that can evolve almost effortlessly.