effective-java

effective-java is a skill for Claude Code, Codex from booklib-ai/booklib. It costs 165 tokens per session (3,335 once invoked), scanned A, original, MIT.

A Java coding and review guide based on Effective Java, a book of practices for designing classes, APIs, and everyday Java code.

In plain words
What is it for?
Use it when writing or reviewing Java classes, public APIs, factories, builders, streams, lambdas, generic types, concurrent code, or error handling.
Why use it?
It helps prevent common design and maintenance problems involving object creation, mutable state, inheritance, concurrency, generics, exceptions, and serialization.

Skill for Claude CodeCodex

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

Good fit Use it when writing or reviewing Java classes, public APIs, factories, builders, streams, lambdas, generic types, concurrent code, or error handling.

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

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 effective-java

README.md
[![agentmods](https://agentmods.dev/badge/skills/booklib-ai/booklib/effective-java/github.svg)](https://agentmods.dev/skills/booklib-ai/booklib/effective-java)
Your own site
<a href="https://agentmods.dev/skills/booklib-ai/booklib/effective-java"><img src="https://agentmods.dev/badge/skills/booklib-ai/booklib/effective-java/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 effective-java

Your own site · 80×15
<a href="https://agentmods.dev/skills/booklib-ai/booklib/effective-java"><img src="https://agentmods.dev/badge/skills/booklib-ai/booklib/effective-java.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 165 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,335 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.00165 $0.03335
Opus 5.5 $0.00066 $0.01334
Sonnet 5.5 $0.00033 $0.00667
Haiku 4.5 $0.00016 $0.00333

Measured 1mo ago against content hash 736d8ae5c07f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

effective-java 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 1mo ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/checkstyle_setup.py, scripts/example.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/effective-java/SKILL.md · 228 lines

How it starts

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

Effective Java Skill

You are an expert Java architect grounded in the 90 items from Joshua Bloch's Effective Java (3rd Edition). You help developers in two modes:

  1. Code Generation — Produce well-structured Java code following Effective Java principles
  2. Code Review — Analyze existing Java code and recommend improvements

How to Decide Which Mode

  • If the user asks you to build, create, generate, implement, or scaffold something → Code Generation
  • If the user asks you to review, check, improve, audit, or critique code → Code Review
  • If ambiguous, ask briefly which mode they'd prefer

Mode 1: Code Generation

When generating Java code, follow this decision flow:

Step 1 — Understand the Requirements

Ask (or infer from context) what the component needs:

  • Object creation — How should instances be created? (Factory, Builder, Singleton, DI)
  • Mutability — Does the class need to be mutable or can it be immutable?
  • Inheritance model — Composition, interface-based, or class hierarchy?
  • Concurrency — Will this be accessed from multiple threads?
  • API surface — Is this internal or part of a public API?

Step 2 — Select the Right Patterns

Read references/items-catalog.md for full item details. Quick decision guide:

Problem Items to Apply
How to create objects? Item 1 (static factories), Item 2 (Builder), Item 3 (Singleton), Item 5 (DI)
How to design an immutable class? Item 17 (minimize mutability), Item 50 (defensive copies)
How to model types? Item 20 (interfaces over abstract classes), Item 23 (class hierarchies over tagged classes)
How to use generics safely? Item 26 (no raw types), Item 31 (bounded wildcards / PECS), Item 28 (lists over arrays)
How to use enums effectively? Item 34 (enums over int constants), Item 37 (EnumSet), Item 38 (EnumMap)
How to use lambdas and streams? Item 42 (lambdas over anon classes), Item 43 (method refs), Item 45 (streams judiciously)
How to design methods? Item 49 (validate params), Item 50 (defensive copies), Item 51 (design signatures carefully)
How to handle errors? Item 69 (exceptions for exceptional conditions), Item 71 (avoid unnecessary checked), Item 73 (translate exceptions)
How to handle concurrency? Item 78 (synchronize shared mutable data), Item 79 (avoid excessive sync), Item 81 (concurrency utilities)
How to handle serialization? Item 85 (prefer alternatives), Item 90 (serialization proxies)

Read the full file on GitHub · 228 lines

Files

What ships with it

10 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 228 lines · 165 tokens per session scan A 736d8ae5c07f

Subscribe to this mod's changes

effective-java is a skill published in the GitHub repository booklib-ai/booklib (39 stars, last pushed 6mo ago), licensed MIT. It adds 165 tokens to every session and 3,335 once invoked, about $0.0007 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-30.

Related

Other skills, from other repositories

java

Use when writing, reviewing or refactoring modern Java (21+, 25 LTS) — records and sealed interfaces as algebraic data types, exhaustive pattern-matching switch over instanceof ladders, virtual-thread concurrency, structured concurrency and ScopedValue replacing ThreadLocal, Stream and Optional pipelines…

ericrisco/rsc-harness · 89 tokens

writing-java-kotlin

Idiomatic modern Java and Kotlin JVM development. Use when writing .java, .kt, or .kts code; changing Gradle or Maven builds; or working on Spring, Micronaut, Quarkus, Ktor, Android JVM modules, JUnit, Mockito, Kotest, ktlint, detekt, or JVM CLI/services. Emphasizes JDK toolchains, null-safety, fast focused…

alexei-led/cc-thingz · 126 tokens

standards

Use this agent when you need to evaluate code, architecture, or development practices against the NASAB framework principles and Rust best practices.

samibs/skillfoundry · 29 tokens

java-spring-best-practices

Enterprise-grade Spring Boot 3.5.x/4.x development guide. Use when building Spring Boot APIs, microservices, or enterprise Java applications. Covers Java Records as DTOs, Virtual Threads, ProblemDetail (RFC 7807), RestClient, structured logging, Testcontainers, observability, sealed exception hierarchies, and GraalVM…

cosbort/agent-skills · 104 tokens

java-spring-boot

Java and Spring Boot development patterns. Spring Boot 3.x, Spring Security, JPA/Hibernate, reactive programming, and production patterns. Use when building Java backend services, REST APIs, or enterprise applications.

hoangatg/ai-agent-toolkit · 48 tokens

springboot-patterns

Spring Boot architecture patterns, REST API design, layered services, data access, caching, async processing, and logging. Use for Java Spring Boot backend work.

deepelementlab/jupyter-studio · 36 tokens