The Boy Scout Rule
Updated 2026-07-30
Summary
Leave the campground cleaner than you found it.
Definition
"Leave the campground cleaner than you found it." In programming, it means that every time you modify code, you should also fix a bit of the surrounding messy code, rather than just doing the current task. Scaffold use: a micro-habit against entropy. Don't wait for a "big cleanup"; through small optimizations during each action, continuously repay technical debt or management debt, maintaining the long-term health of the system.
Introduction
How to use
A micro-habit against entropy. Don't wait for a "big cleanup"; through small optimizations during each action, continuously repay technical debt or management debt, maintaining the long-term health of the system.
Mechanism
The Boy Scout Rule advocates that every time you leave a piece of code (or system), make it a little cleaner than when you arrived. Through continuous micro-improvements rather than a centralized big cleanup, it curbs system entropy and gradually repays technical debt.
Practice
In progress 0/1Practice this model in one real situation:
Cases
- A developer refactors a nearby function while modifying a feature; the team cleans up a TODO during each review, keeping long-term debt manageable.
Common pitfalls
- Using "fix as you go" to make large changes, causing unrelated modifications and regression risks. Waiting for "free time" to do a unified cleanup, debt keeps accumulating.
Sources
Source support: Explicit
- lawsofsoftwareengineering.comhttps://lawsofsoftwareengineering.com/laws/boy-scout-ruleverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS