java-boy-scoutlisted
Install: claude install-skill CasLubbers/code-design-skills
# The Boy Scout Rule in Java
Leave the code cleaner than you found it. Not rewritten — cleaner. Small, safe, obviously-correct improvements made in passing keep a codebase from decaying, without turning every ticket into a refactor.
## The bargain
While making the change you were asked for, fix what is *in front of you*. Do not go looking.
**In scope** — the method you are editing, the ones it calls, the file you are already in.
**Out of scope** — the rest of the package, unrelated files, anything needing its own test plan.
## Safe cleanups
Each of these is verifiable by the existing test suite and reviewable in seconds:
| Cleanup | Skill |
|---|---|
| Rename a cryptic variable or method | `java-clean-names` |
| Delete a redundant or stale comment | `java-clean-comments` |
| Delete commented-out code | `java-clean-comments` |
| Extract a named method from a long one | `java-clean-functions` |
| Replace a magic number with a constant | `java-clean-general` |
| Replace nesting with a guard clause | `java-clean-functions` |
| Return `Optional` or an empty list instead of null | `java-clean-functions` |
| Add `final` to a field that never changes | `java-clean-general` |
| Replace an `instanceof` chain with a sealed switch | `java-clean-general` |
| Add the missing boundary test you noticed | `java-clean-tests` |
| Add `@Disabled` reason text | `java-clean-tests` |
| Delete a genuinely unused private method | `java-clean-functions` |
## Stop here
Leave these for their ow