agentleFS
saemihemmasaemihemma/lead-producer-oss/.claude/skills/role-java-engineer/SKILL.md

role-java-engineer

Skill2 starsChanged 3 months agoMITView on GitHub

Java code review: modern Java (14+), records, sealed classes, immutability, JUnit 5 + AssertJ patterns, and Spring Boot conventions. Use when reviewing or writing Java code.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check formatting (google-java-format or Checkstyle) compliance.

    line 24
  2. Distinctive:

    Verify modern Java usage: records for value types, sealed classes for closed hierarchies, switch expressions.

    line 25
  3. Distinctive:

    Check Optional discipline: return-only (never as field/parameter), functional methods.

    line 27
  4. Distinctive:

    Verify test quality: JUnit 5 + AssertJ, Mockito for mocking, Testcontainers for integration.

    line 28
  5. Distinctive:

    Prefer unchecked exceptions with context-rich messages

    line 38

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Java Engineer

Use When

  • Reviewing or writing Java code
  • Assessing modern Java feature usage, test quality, or Spring patterns
  • Evaluating immutability, Optional handling, or error strategy

Do NOT Use When

  • Problem is architecture-level, not language-level
  • Code is Kotlin (different idioms on same platform)

What You Own

  • Modern Java enforcement (14+: records, sealed classes, pattern matching, text blocks)
  • Immutability discipline (final fields, defensive copies, records for value types)
  • Optional handling (return-only, functional methods)
  • JUnit 5 + AssertJ test quality
  • Spring Boot conventions when applicable

Working Method

  1. Check formatting (google-java-format or Checkstyle) compliance.
  2. Verify modern Java usage: records for value types, sealed classes for closed hierarchies, switch expressions.
  3. Inspect immutability: final fields default, List.copyOf() for defensive copies.
  4. Check Optional discipline: return-only (never as field/parameter), functional methods.
  5. Verify test quality: JUnit 5 + AssertJ, Mockito for mocking, Testcontainers for integration.
  6. Produce verdict with highest-risk issues first.

Key Idioms

  • record for value types (Java 16+)
  • sealed classes for closed hierarchies (Java 17+)
  • Pattern matching with instanceof (Java 16+)
  • Switch expressions (Java 14+)
  • Optional.map(), flatMap(), orElseThrow() — never Optional.get() without isPresent()
  • Stream pipelines: max 3-4 operations for readability
  • Prefer unchecked exceptions with context-rich messages
  • One public top-level type per file

Testing Standards

  • Framework: JUnit 5 + AssertJ for fluent assertions
  • Mocking: Mockito with @ExtendWith(MockitoExtension.class)
  • Parameterized: @ParameterizedTest with @CsvSource
  • Integration: Testcontainers for real database testing
  • Naming: methodName_scenario_expectedBehavior() with @DisplayName
  • Coverage: 80%+ via JaCoCo, prioritize domain/service logic
  • Structure: mirror src/main/java in src/test/java

Default Output

JAVA REVIEW
===========
Standards: Java version, modern feature usage, formatting
Patterns: immutability, Optional handling, error strategy
Quality Risks: mutable state leaks, weak assertions, test gaps
Recommendation: highest-leverage fixes

Anti-Drift Rules

  • Optional.get() without guard is a finding. Use orElseThrow().
  • Stream pipelines beyond 4 operations hurt readability. Break them up.
  • Route architecture questions to role-software-architect.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.