Claude
Cursor
Skill
java-conventions
Java code conventions covering Java 17+ records and sealed classes, formatting/static analysis, Maven/Gradle, JUnit 5, exception handling, constructor injection, streams, and security. Load when writing or reviewing Java code.
Virus-scanned
Reviewed automatically before listing.
Download
goldziher-ai-rulez-internal_builtins_languages_java_skills_java-conventions-ca967ad.zip · 0 KB
Install
skills CLI
npx skills add https://github.com/Goldziher/ai-rulez/tree/main/internal/builtins/languages/java/skills/java-conventions
Claude Code
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install goldziher-ai-rulez@llmmart
Git
git clone https://github.com/Goldziher/ai-rulez.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole goldziher/ai-rulez collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
- Java 17+ LTS, records for immutable data, sealed classes for restricted hierarchies, pattern matching.
- A consistent style guide and auto-formatter (e.g., Google Java Style + google-java-format). Static analysis (e.g., Error Prone + SpotBugs).
- Build: Maven or Gradle with wrapper scripts (
mvnw/gradlew). Commit wrapper files. - Testing: JUnit 5 with
@ParameterizedTest, an assertion library (e.g., AssertJ), a coverage tool (e.g., JaCoCo) at 80%+. - Benchmarking: JMH for microbenchmarks — never use
System.nanoTime()loops. - Error handling: specific exceptions only, never
catch (Exception), use try-with-resources forAutoCloseable. varfor obvious types,Optional<T>for returns (never params/fields),finalfields by default.- Prefer constructor injection over field injection for DI. Immutable collections:
List.of(),Map.of(). - Streams for collection transforms,
instanceofpattern matching, switch expressions. - Security: OWASP
dependency-checkMaven/Gradle plugin for CVE scanning. - Dependencies: commit lock files, use BOM for version alignment, avoid
SNAPSHOTin releases. - Anti-patterns: public fields, mutable static state, raw types, checked exceptions in lambdas.
Files (ai-rulez)
-
SKILL.md 1.5 KB
--- name: java-conventions description: Java code conventions covering Java 17+ records and sealed classes, formatting/static analysis, Maven/Gradle, JUnit 5, exception handling, constructor injection, streams, and security. Load when writing or reviewing Java code. --- - Java 17+ LTS, records for immutable data, sealed classes for restricted hierarchies, pattern matching. - A consistent style guide and auto-formatter (e.g., Google Java Style + google-java-format). Static analysis (e.g., Error Prone + SpotBugs). - Build: Maven or Gradle with wrapper scripts (`mvnw`/`gradlew`). Commit wrapper files. - Testing: JUnit 5 with `@ParameterizedTest`, an assertion library (e.g., AssertJ), a coverage tool (e.g., JaCoCo) at 80%+. - Benchmarking: JMH for microbenchmarks — never use `System.nanoTime()` loops. - Error handling: specific exceptions only, never `catch (Exception)`, use try-with-resources for `AutoCloseable`. - `var` for obvious types, `Optional<T>` for returns (never params/fields), `final` fields by default. - Prefer constructor injection over field injection for DI. Immutable collections: `List.of()`, `Map.of()`. - Streams for collection transforms, `instanceof` pattern matching, switch expressions. - Security: OWASP `dependency-check` Maven/Gradle plugin for CVE scanning. - Dependencies: commit lock files, use BOM for version alignment, avoid `SNAPSHOT` in releases. - Anti-patterns: public fields, mutable static state, raw types, checked exceptions in lambdas.
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.