java-rules

java-rules is a skill for Claude Code from softspark/ai-toolkit. It costs 46 tokens per session (2,847 once invoked), scanned A, original, Apache-2.0.

A set of coding rules for Java projects, covering naming, modern language features, types, security, testing, and common frameworks. Java is a programming language often used for backend applications.

In plain words
What is it for?
Use it when writing or reviewing Java files, Maven or Gradle builds, Spring applications, database code, JUnit tests, and related project structure.
Why use it?
It helps keep Java code consistent, readable, and aligned with safer implementation practices. It also gives agents project conventions to follow during coding or review.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the ai-toolkit plugin — 113 skills, 44 agents, 14 hooks shipped together

Good fit Use it when writing or reviewing Java files, Maven or Gradle builds…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/softspark/ai-toolkit/java-rules
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 softspark/ai-toolkit --skill java-rules
Clone the repo
git clone --depth 1 https://github.com/softspark/ai-toolkit

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 113 skills, 44 agents, 14 hooks.

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-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/softspark/ai-toolkit/java-rules.svg)](https://agentmods.dev/skills/softspark/ai-toolkit/java-rules)
Your own site
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/java-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/java-rules.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,847 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.00046 $0.02847
Opus 5 $0.00023 $0.01424
Sonnet 5 $0.00009 $0.00569
Haiku 4.5 $0.00005 $0.00285

Measured 3d ago against content hash 02fb15f89242, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

java-rules 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 3d 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.

app/skills/java-rules/SKILL.md · 274 lines

How it starts

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

Java Rules

These rules come from app/rules/java/ in ai-toolkit. They cover the project's standards for coding style, frameworks, patterns, security, and testing in Java. Apply them when writing or reviewing Java code.

Java Coding Style

Naming

  • PascalCase: classes, interfaces, enums, records, annotations.
  • camelCase: methods, variables, parameters.
  • UPPER_SNAKE: constants (static final).
  • Package names: lowercase, dot-separated, reverse domain (com.company.project).
  • No Hungarian notation. No I prefix on interfaces.

Modern Java (17+)

  • Use record for immutable data carriers. No need for Lombok in most cases.
  • Use sealed classes/interfaces for restricted hierarchies.
  • Use pattern matching: if (obj instanceof String s) instead of cast.
  • Use switch expressions with arrow syntax and exhaustiveness.
  • Use text blocks (""") for multiline strings (SQL, JSON, HTML).

Types

  • Use var for local variables when the type is obvious from the right-hand side.
  • Use Optional<T> for return types that may be absent. Never for fields or params.
  • Prefer List.of(), Map.of(), Set.of() for immutable collections.
  • Use Stream for collection transformations. Avoid streams for simple iterations.

Classes

  • Prefer composition over inheritance. Use interfaces for abstraction.
  • Keep classes focused: single responsibility.
  • Use final on classes not designed for extension.
  • Use private constructors + static factory methods for controlled instantiation.
  • Records over POJOs for value types. Lombok only if records are insufficient.

Methods

  • Max 20-30 lines per method. Extract when longer.
  • Use @Override on every overridden method.
  • Return empty collections over null. Use Collections.emptyList() or List.of().
  • Avoid checked exceptions for programming errors. Use runtime exceptions.

Formatting

  • Use project formatter (Google Java Format or IDE-configured).
  • Use @SuppressWarnings sparingly and with specific warning names.
  • Use final for parameters and local variables where practical.

Read the full file on GitHub · 274 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. 3d ago First seen · 274 lines · 46 tokens per session scan A 02fb15f89242

Subscribe to this mod's changes

java-rules is a skill published in the GitHub repository softspark/ai-toolkit (170 stars, last pushed 2d ago), licensed Apache-2.0. It adds 46 tokens to every session and 2,847 once invoked, about $0.0002 per session on Opus 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-09-03.

Related

Other skills, from other repositories

go-code-reviewer

Review Go code with a defect-first approach using repository policy (constitution.md first, then AGENTS.md fallback). Use for code review, PR review, quality checks, risk analysis, and regression detection.

johnqtcg/awesome-skills · 45 tokens

go-review-lead

Orchestrate a comprehensive Go code review by triaging code changes, dispatching vertical review skills (security, concurrency, error, logic, performance, quality, test, observability) as parallel agents, then consolidating results into a unified report. Use for full Go PR review or comprehensive code review. Replaces…

johnqtcg/awesome-skills · 80 tokens

go-concurrency-review

Review Go code for concurrency safety and goroutine lifecycle issues including race conditions, deadlocks, goroutine leaks, mutex misuse, and context propagation. Trigger when code contains go func, channels, sync primitives, WaitGroup, errgroup, or goroutine lifecycle management. Use for concurrency-focused review of…

johnqtcg/awesome-skills · 67 tokens

go-error-review

Review Go code for error handling correctness, nil safety, and failure-path integrity including ignored errors, missing wrapping, panic misuse, SQL/HTTP resource lifecycle, and transaction patterns. Trigger when code contains error returns, panic calls, sql.Rows, transactions, HTTP client/server code, or nil-sensitive…

johnqtcg/awesome-skills · 75 tokens

go-logic-review

Review Go code for business logic correctness, boundary conditions, off-by-one errors, state management, data flow integrity, and return value contracts. Trigger on any Go code change that modifies behavior, conditional logic, state transitions, or data processing. Use for logic-correctness focused review.

johnqtcg/awesome-skills · 62 tokens

go-performance-review

Review Go code for performance issues including slice/map pre-allocation, string concatenation, N+1 queries, connection pool configuration, sync.Pool, memory alignment, lock scope, buffered I/O, and HTTP transport tuning. Trigger when code contains make(), loops, database queries, string building, sync primitives…

johnqtcg/awesome-skills · 80 tokens