Files
Bifrost/.claude/skills/java-best-practices/SKILL.md
T

1.5 KiB

name, description
name description
java-best-practices Use when writing or reviewing Java production code in this plugin, especially HTTP, validation, lifecycle, concurrency, or error handling.

Java best practices

  • Compile with Java 17 (maven.compiler.release=17), the baseline supported by the target plugin API.
  • Prefer immutable records for internal DTOs where compatible with JSON parsing; keep collections defensively copied.
  • Validate null, length, and format at service boundaries. Use named constants for bounds and timeouts.
  • Use try-with-resources for closeable resources; java.net.http.HttpClient is reusable and immutable.
  • Do not create static mutable state, swallow exceptions, catch Throwable, or catch broad Exception without translating a known boundary failure.
  • Keep errors actionable but never include authorization headers, tokens, or full secret-bearing URLs.
  • Use SLF4J host-provided logging; log operation context without credentials.
  • Keep packages under cc.tordais.sonar.bifrost; name types and methods in ASCII English.

Checklist

  • Java 17 compilation; immutable data and bounded inputs.
  • Exceptions translated at boundaries, not hidden.
  • No static mutable state or secret-bearing logs.
  • Resources and HTTP timeouts handled.

Sources

Not verified

  • No project-specific Sonar quality profile has been run yet.