The Scout Rule
Always leave the code better than you found it.
(Robert C. Martin (Uncle Bob))
Based on the "Scout Rule", which is "always leave the campground cleaner than you found it", the Scout Rule in programming is simply "always leave the code cleaner than you found it".
This was introduced in the first chapter of the book Clean Code by Bob Martin. The rule suggests that developers should perform 'optimistic refactoring', which means to endeavour to improve the overall quality of the code when you work on it. If you see a mistake, attempt to fix it or clean it up. However, when making changes to code which seems incorrect, it may be worth remembering Chesterton's Fence!
See also:
https://www.amazon.sg/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882