23. Leave It Cleaner
See something messy in the code—even if you didn't write it? Leave it cleaner than you found it. Small, safe improvements compound into durable quality.

As a tech lead, I review a lot of code. I often run into things that aren't tidy but were already in the code before the changes I'm reviewing. When I comment on it, I sometimes hear: "That was already there before I started." That's exactly the issue.
Thesis: if you see something that's wrong or needlessly complex —even if you didn't write it— you leave it cleaner. Small where possible (better names, remove dead code, simplify flow). Bigger when needed (split functions, eliminate duplication). If it truly doesn't fit now, leave a clear trail (TODO + ticket) with context. ✍️📌
Why this works
- Readability prevents bugs. ✅
- You read code more than you write it; cleanliness keeps you fast. ⚡
- Small improvements compound into durable quality. 📈
What "cleaner" means
- Names that match intent (one name per concept). 🧩
- Remove dead code and noise (redundant comments, duplication). 🧽
- Simpler control flow (shorter, flatter, clearer). 🔀
- Consistent standards (linting, formatting, strict types). 📏
- A small test where things are fragile. 🧪
Pragmatic guardrails
- Separate functional changes and cleanup into distinct commits/PRs. 🗂️
- Keep cleanup small (~10–15% of your ticket time). ⏱️
- Add a safety net first if there are no tests. 🛟
- Note briefly in your PR what you cleaned up and that behavior is unchanged. 📝
- Larger refactors? Create a ticket with context, impact, and a proposal. 🚧
Team practices that help
- A concrete style/coding guide with examples. 📚
- Pre-commit hooks (lint, typecheck, format). 🔧
- A "cleanup" label for small maintenance tasks. 🏷️
- Definition of Done: "If you touch code, leave it cleaner." ✅
This is how I work—also when joining projects that weren't run as tightly before. If standards don't exist yet, I propose them and explain the why. Cleanliness isn't a luxury; it's the foundation of stable, scalable software.
What's your take? Do you fix small messes immediately, or do you leave them? 💬
Need more structure and cleanliness in your codebase? Send me a message—I'm happy to help. ✉️
TL;DR
See a mess? Leave it cleaner today than you found it. Small, safe improvements create big long-term gains. 🌱


