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.
npx agentmods add skills/gentleman-programming/gentleman-skills/java-21npx skills add Gentleman-Programming/Gentleman-Skills --skill java-21git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-SkillsWrote 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.
[](https://agentmods.dev/skills/gentleman-programming/gentleman-skills/java-21)<a href="https://agentmods.dev/skills/gentleman-programming/gentleman-skills/java-21"><img src="https://agentmods.dev/badge/skills/gentleman-programming/gentleman-skills/java-21.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00035 | $0.00641 |
| Opus 5 | $0.00017 | $0.00320 |
| Sonnet 5 | $0.00007 | $0.00128 |
| Haiku 4.5 | $0.00003 | $0.00064 |
Grade A, and why
java-21 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 122 lines — stays where its author put it; the contents beside it link to each section on GitHub.
When to Use
Load this skill when:
- Writing Java 21 application or library code
- Designing immutable DTOs or value objects
- Modeling closed hierarchies with sealed types
- Using virtual threads for blocking I/O
Critical Patterns
Pattern 1: Records for immutable data
Use records for DTOs and value objects, validate in compact constructors.
Pattern 2: Sealed types + pattern matching
Use sealed interfaces/classes and switch pattern matching for exhaustiveness.
Pattern 3: Virtual threads for I/O
Use virtual threads to handle blocking I/O without large thread pools.
Code Examples
Example 1: Record with validation
package com.acme.user;
public record Email(String value) {
public Email {
if (value == null || !value.contains("@")) {
throw new IllegalArgumentException("Invalid email");
}
}
}
Example 2: Sealed hierarchy + switch pattern matching
package com.acme.payment;
public sealed interface Payment permits Card, BankTransfer { }
public record Card(String last4) implements Payment { }
public record BankTransfer(String iban) implements Payment { }
public final class PaymentPrinter {
public String describe(Payment payment) {
return switch (payment) {
case Card card -> "card-" + card.last4();
case BankTransfer bank -> "iban-" + bank.iban();
};
}
}
Example 3: Virtual threads for blocking calls
package com.acme.io;
import java.util.concurrent.Executors;
public final class Fetcher {
public void fetchAll(java.util.List<String> urls) throws Exception {
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
for (String url : urls) {
executor.submit(() -> blockingFetch(url));
}
}
}
private void blockingFetch(String url) {
// perform blocking I/O here
}
}
Anti-Patterns
Don't: Use mutable data carriers
// BAD: mutable DTO
public class UserDto {
public String name;
public String email;
}
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.
- 4d ago First seen · 122 lines · 35 tokens per session scan A 4c04430d5680
java-21 is a skill published in the GitHub repository Gentleman-Programming/Gentleman-Skills (638 stars, last pushed 5mo ago), licensed MIT. It adds 35 tokens to every session and 641 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-08-30.
Other skills, from other repositories
wxjava-api-contributor
按 WxJava 的 Maven 多模块、Java 8、公共 API 兼容性和 TestNG 约定,为微信官方接口新增或维护 SDK 支持。适用于新增 Service API、请求响应 Bean、序列化、HTTP 实现、Starter 配置或回归测试时。.
union-type-wrappers
Add typed getters and setters over BinaryData properties that represent TypeSpec union types in generated Java models. Use when generated classes expose BinaryData for union-typed fields and you need ergonomic, type-safe accessors instead.
run-tests
Run project tests using Maven (mvn). Use when the user asks to run tests.
search-m2
Search for Java classes inside Maven dependencies in /.m2. Use when the user asks to locate classes or inspect JARs. Cross-reference pom.xml files in the current directory to resolve dependency names/versions.
dd-code-generation
Use pup CLI for immediate Datadog operations or generate code for integration into applications.
create-package-skill
Interactive wizard that walks service teams through creating a package-specific skill for their Azure SDK package. Scans the package, detects customization patterns, scaffolds a SKILL.md with references, and validates with vally lint. The skill is placed inside the package's .github/skills/ directory so…