java-conventions

java-conventions is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 106 tokens per session (2,125 once invoked), scanned A, original, Apache-2.0.

A set of rules for adding or changing Java code in an existing project. It covers modern Java style, immutable data, Spring Boot dependency setup, and JUnit 5 with Mockito tests.

In plain words
What is it for?
Use it when implementing Java tickets, fixing Java builds, designing data classes, handling optional values, or adding unit tests.
Why use it?
It reduces the risk of code that compiles but conflicts with the project's Java version, structure, formatting, or testing habits.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when implementing Java tickets, fixing Java builds, designing data classes, handling optional values, or adding unit tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/java-conventions
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tmj-90/gaffer --skill java-conventions
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for java-conventions

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/java-conventions/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/java-conventions)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/java-conventions"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/java-conventions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for java-conventions

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/java-conventions"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/java-conventions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,125 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00106 $0.02125
Opus 5.5 $0.00042 $0.00850
Sonnet 5.5 $0.00021 $0.00425
Haiku 4.5 $0.00011 $0.00213

Measured 16d ago against content hash 6700748fb289, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

java-conventions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 16d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

runner/skills/java-conventions/SKILL.md · 127 lines

How it starts

The opening of the file, as written. The whole thing — 127 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Write idiomatic, modern Java

Java stays correct when data is immutable, resources close themselves, absence is typed and shared state is guarded. For the builder and the reviewer of a Java diff; the repo's config and existing code win over it.

Procedure

  1. Discover the repo's conventions first. Call search_lore for Java conventions. Read the build file (pom.xml maven.compiler.release, or build.gradle(.kts) toolchain) for the Java version — features below are gated on it — and the wrapper (mvnw/gradlew: always use it). Find the style and analysis tools: Spotless / google-java-format, Checkstyle, Error Prone + NullAway, SpotBugs, PMD, and the nullness annotations in use (JSpecify @NullMarked, JetBrains, jakarta). Note whether the repo uses Lombok (lombok.config) — follow the repo, do not mix styles. Copy a sibling class and its test.
  2. Pin the exact commands from CI (the run-tests and run-lint skills). Use the defaults below only when the repo defines none.
  3. Write the change with the idioms below, then walk the concurrency section for every executor, shared field, stream, connection and file you touched.
  4. Test each acceptance criterion's own behaviour. One JUnit 5 test (or @ParameterizedTest case) per AC that fails without your change, plus its error path. If the AC involves shared state or persistence, add a test that runs N concurrent callers (an ExecutorService plus a CountDownLatch start gate) and asserts the invariant. Use Testcontainers for real databases where the repo does.
  5. Verify, then stop. Done when: the formatter check and static analysis are clean, the build's verify/check goal is green with the repo's coverage gate, and every AC has a test. Record the output with the record-evidence skill; the runner submits the work.

Commands

  • Maven: ./mvnw -B verify (compile, tests, coverage, checks); one test: ./mvnw -Dtest='ClassTest#method' test; format: ./mvnw spotless:check.
  • Gradle: ./gradlew check (or build); one test: ./gradlew test --tests 'pkg.ClassTest'; format: ./gradlew spotlessCheck; coverage: ./gradlew jacocoTestReport.
  • Dependencies: a new or bumped dependency is a blocker, not an edit to the build file (the dependency-upgrade skill); ./gradlew dependencies or ./mvnw dependency:tree shows what is already on the classpath.

Read the full file on GitHub · 127 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 16d ago Changed · +41 lines · +17 tokens per session 6700748fb289
  2. 1mo ago First seen · 86 lines · 89 tokens per session scan A 557947f285d9

Subscribe to this mod's changes

java-conventions is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 106 tokens to every session and 2,125 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

junit-testing

JUnit 5 testing patterns including annotations, Mockito mocking, Spring Boot test slices, MockMvc, Testcontainers integration, and parameterized tests. Use when the user is writing Java tests, setting up test infrastructure, mocking dependencies, testing Spring controllers, or running integration tests with real…

VersoXBT/claude-initial-setup · 86 tokens

rust-testing

Rust testing patterns including unit tests, integration tests, async testing, property-based testing, mocking, and coverage. Follows TDD methodology.

affaan-m/ECC · 31 tokens

cpp-testing

Use only when writing/updating/fixing C++ tests, configuring GoogleTest/CTest, diagnosing failing or flaky tests, or adding coverage/sanitizers.

affaan-m/ECC · 34 tokens

golang-testing

Go testing best practices including table-driven tests, test helpers, benchmarking, race detection, coverage analysis, and integration testing patterns. Use when writing or improving Go tests.

affaan-m/ECC · 37 tokens

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

java-affected-tests

Use before opening or updating an OpenMetadata PR that changes Java, a JSON schema, an index mapping, a SQL migration, seed data or a pom — PR CI no longer runs the Java integration tests (they run only in the merge queue) and the JavaUIIT/search-it suites run only nightly, so this selects the unit tests and…

open-metadata/OpenMetadata · 120 tokens