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 Clean Names

ASecurity

Enforces naming in Java 21+ — descriptive names, names matched to scope, no Hungarian notation or I-prefixed interfaces, no meaningless suffixes like Manager or Helper, and names that reveal side effects. Use when naming or renaming variables, fields, methods, classes, records, interfaces, or packages in Java, and when the user asks "rename this", "better name", "what should I call this", or the code shows cryptic identifiers, `Impl` suffixes, or getters that mutate.

2 stars
0 votes
0 copies
0 views
Added 9/19/2026
developmentgojava

Security Analysis

A100/100

Scanned 9/19/2026

$npx -y skills add CasLubbers/code-design-skills --skill java-clean-names --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Java Clean Names?

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

Security grade badge for Java Clean Names
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/caslubbers-java-clean-names/badge)](https://www.skillsdirectory.com/skills/caslubbers-java-clean-names)

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-clean-names
description: Enforces naming in Java 21+ — descriptive names, names matched to scope, no Hungarian notation or I-prefixed interfaces, no meaningless suffixes like Manager or Helper, and names that reveal side effects. Use when naming or renaming variables, fields, methods, classes, records, interfaces, or packages in Java, and when the user asks "rename this", "better name", "what should I call this", or the code shows cryptic identifiers, `Impl` suffixes, or getters that mutate.
---

# Clean names in Java

## Reveal intent

If a name needs a comment to explain it, the name is wrong.

```java
// Bad
int d;
List<int[]> theList;

// Good
int elapsedDays;
List<Cell> flaggedCells;
```

```java
// Bad — what does this return?
public List<User> get(int x) { ... }

// Good
public List<User> findUsersOlderThan(int minimumAge) { ... }
```

## Name at the right level of abstraction

The name describes what the caller gets, not how it is stored.

```java
// Bad — leaks the implementation
Map<String, List<Order>> getOrderHashMapByCustomerId()

// Good
Map<String, List<Order>> ordersByCustomer()
```

Changing a `HashMap` to a `TreeMap` should not require renaming anything.

## Length matches scope

Short names are fine in short scopes and wrong at class or package level.

```java
// Good — lifetime is one line
orders.forEach(o -> total = total.add(o.amount()));

// Good — visible everywhere, so it earns its length
private static final Duration DEFAULT_CONNECTION_TIMEOUT = Duration.ofSeconds(30);

// Bad — a field nobody can interpret
private int max;
```

`var` shifts weight onto the name — with the type gone from the left, the right side must carry it.

```java
var result = process(input);              // bad — two mysteries
var settledInvoices = process(input);     // good
```

## No encodings

Modern tooling makes type prefixes noise.

```java
// Bad
String strName;
List<User> lstUsers;
private int m_count;
interface IUserRepository {}
class UserRepositoryImpl implements IUserRepository {}

// Good
String name;
List<User> users;
private int count;
interface UserRepository {}
class JdbcUserRepository implements UserRepository {}
```

`Impl` says nothing. Name the implementation after what makes it different: `JdbcUserRepository`, `InMemoryUserRepository`, `CachingUserRepository`.

## Avoid noise words

`Manager`, `Processor`, `Helper`, `Util`, `Data`, `Info`, `Service` attached to everything stop distinguishing anything. `UserData`, `UserInfo` and `User` cannot be told apart by a reader deciding which to use.

If a class is genuinely a bag of static methods, the name should say what they operate on (`Durations`, `Collectors`) — a plural noun, not `DurationUtils`.

## Names describe side effects

```java
// Bad — a getter that mutates
public Config getConfig() {
    if (config == null) {
        config = loadFromDisk();   // hidden write
    }
    return config;
}

// Good
public Config getOrLoadConfig() { ... }
```

A method named `validate` that also saves is a bug waiting for a reader. Either rename it or split it.

## Follow the conventions

Classes and records are `PascalCase` nouns. Methods are `camelCase` verbs. Constants are `UPPER_SNAKE_CASE`. Packages are lowercase, singular, no underscores. Booleans read as predicates: `isActive`, `hasExpired`, `canRetry`.

Records make the accessor convention explicit — a record component `amount()` has no `get` prefix. Follow that in new domain types generally: `order.total()` reads better than `order.getTotal()`, and `get` earns its place only where a framework requires it.

## Use one word per concept

Pick `find`, `fetch`, or `retrieve` and use it everywhere for the same operation. Three synonyms across three classes force the reader to check whether the difference is meaningful.

Conventional pairs, used consistently: `create`/`delete`, `add`/`remove`, `start`/`stop`, `open`/`close`, `first`/`last`.

Attribution

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

Get any skill into Claude in one click.

Download any skill as a ZIP for Claude.ai, Claude Desktop, or .claude/skills. $9/mo.

See Pro

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 Directory ProSkills Directory

Get any skill into Claude in one click.

Download any skill as a ZIP for Claude.ai, Claude Desktop, or .claude/skills. $9/mo.

See Pro

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 →