java-clean-nameslisted
Install: claude install-skill CasLubbers/code-design-skills
# 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 imple