Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Java Boy Scout

ASecurity

Applies the Boy Scout Rule to Java — leave every file a little cleaner than you found it, with small safe improvements made alongside the change you were asked for. Use when fixing, editing, debugging, or extending existing Java code, and when the user says "while you're at it", "any quick wins", "tidy this up", "improve this a bit", or you are already editing a file that has obvious small problems nearby.

2 stars
0 votes
0 copies
1 views
Added 9/19/2026
developmentgojavadebuggingapi

Works with

cliapi

Security Analysis

A100/100

Scanned 9/19/2026

$npx -y skills add CasLubbers/code-design-skills --skill java-boy-scout --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Java Boy Scout?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Java Boy Scout
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/caslubbers-java-boy-scout/badge)](https://www.skillsdirectory.com/skills/caslubbers-java-boy-scout)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: java-boy-scout
description: Applies the Boy Scout Rule to Java — leave every file a little cleaner than you found it, with small safe improvements made alongside the change you were asked for. Use when fixing, editing, debugging, or extending existing Java code, and when the user says "while you're at it", "any quick wins", "tidy this up", "improve this a bit", or you are already editing a file that has obvious small problems nearby.
---

# 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 own change, and mention them instead of doing them:

- Changing behaviour, or anything a test does not cover
- Restructuring a class hierarchy or moving code between packages
- Changing a public API or method signature others call
- Upgrading a dependency or a framework annotation style
- Reformatting a whole file — it buries the real change in the diff

## Keep the diff readable

The reviewer must be able to see the actual change. If the cleanup is bigger than the fix, split it into a second commit: `fix: reject zero-amount transfers`, then `refactor: extract validateAmount`. Two small commits review faster than one mixed one.

Never mix a cleanup with a behaviour change in the same commit. When something breaks, the bisect must land on one or the other.

## When you find something too big

Say it, do not silently absorb it:

> Fixed the rounding bug. `PaymentProcessor` also builds its own `HttpClient` in three places and can't be tested without a network — worth a follow-up, too big for this change.

## Run the tests

A cleanup that breaks a test was not a cleanup. Run the suite before and after; if a rename touched a reflection-based framework binding, the compiler will not catch it.

Attribution

CasLubbersCasLubbers
View sourceSee grades on GitHubMore from CasLubbers →
SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

285172 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

10311 votes
View all in development →