Claude-skill-registry coding-standard-java
Enforce Java coding standards including camelCase variables, PascalCase classes, and PascalCase filenames matching class names.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/coding-standard-java" ~/.claude/skills/majiayu000-claude-skill-registry-coding-standard-java && rm -rf "$T"
manifest:
skills/data/coding-standard-java/SKILL.mdsource content
Java Coding Standards
When reviewing or generating Java code, follow these rules:
File Naming
- Source files: PascalCase matching the public class name (e.g.,
)UserService.java - One public class per file: File name must match the public class name exactly
- Test files: Class name with
suffix (e.g.,Test
)UserServiceTest.java - Interface files: PascalCase (e.g.,
,Comparable.java
)UserRepository.java
Package Naming
- Packages: All lowercase, dot-separated (e.g.,
,com.example.service
)org.project.utils - No underscores or hyphens in package names
- Follow reverse domain name convention
Variable Naming
- Local variables: camelCase (e.g.,
,userName
,isActive
)totalCount - Instance variables: camelCase (e.g.,
,userId
)createdAt - Constants: UPPER_SNAKE_CASE with
(e.g.,static final
,MAX_RETRIES
)DEFAULT_TIMEOUT - Boolean variables: Prefix with
,is
,has
,can
(e.g.,should
,isEnabled
)hasPermission
Method Naming
- Methods: camelCase, verb or verb phrase (e.g.,
,calculateTotal()
)getUserById() - Getters:
prefix (e.g.,get
,getName()
)getId() - Setters:
prefix (e.g.,set
,setName()
)setId() - Boolean getters:
oris
prefix (e.g.,has
,isActive()
)hasChildren() - Factory methods:
,create
,of
,from
(e.g.,valueOf
,createInstance()
)of()
Class/Interface Naming
- Classes: PascalCase, noun or noun phrase (e.g.,
,UserService
)OrderProcessor - Interfaces: PascalCase, adjective or noun (e.g.,
,Comparable
)UserRepository - Abstract classes: PascalCase, optionally prefix with
(e.g.,Abstract
)AbstractHandler - Exception classes: PascalCase with
suffix (e.g.,Exception
)InvalidInputException - Enums: PascalCase for type, UPPER_SNAKE_CASE for values
Generics
- Type parameters: Single uppercase letter (e.g.,
,T
,E
,K
)V - Meaningful names: When clarity needed (e.g.,
)<Key, Value>
Organization
- Package statement first
- Import statements (java., javax., third-party, project imports)
- Class declaration with fields, constructors, methods
- Public methods before private methods