126-java-exception-handling

126-java-exception-handling is a skill for Claude Code, Codex from jabrena/plinth. It costs 144 tokens per session (759 once invoked), scanned A, original, Apache-2.0.

Guidelines for handling failures and exceptions in Java programs. They cover specific error types, resource cleanup, preserving error context, retries, timeouts, interruption, logging, and translating errors at API boundaries.

In plain words
What is it for?
Use them when reviewing try-catch blocks, asynchronous code, network retries, timeout handling, resource cleanup, structured logs, or errors returned by APIs.
Why use it?
They make failures easier to understand and less likely to leak sensitive information or leave resources open. They also help prevent unreliable retry behaviour and lost interruption signals.

Skill for Claude CodeCodex

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

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.

agentmods
npx agentmods add skills/jabrena/plinth/126-java-exception-handling
Any agent
npx skills add jabrena/plinth --skill 126-java-exception-handling
Clone the repo
git clone --depth 1 https://github.com/jabrena/plinth

Made for: Claude Code, Codex.

Its marketplace also offers this one on its own, as the plugin 126-java-exception-handling/plugin install 126-java-exception-handling after adding the marketplace above.

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 126-java-exception-handling

README.md
[![agentmods](https://agentmods.dev/badge/skills/jabrena/plinth/126-java-exception-handling.svg)](https://agentmods.dev/skills/jabrena/plinth/126-java-exception-handling)
Your own site
<a href="https://agentmods.dev/skills/jabrena/plinth/126-java-exception-handling"><img src="https://agentmods.dev/badge/skills/jabrena/plinth/126-java-exception-handling.svg" alt="Measured on agentmods" height="20"></a>
Per session 144 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 759 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00144 $0.00759
Opus 5 $0.00072 $0.00380
Sonnet 5 $0.00029 $0.00152
Haiku 4.5 $0.00014 $0.00076

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

Security

Grade A, and why

126-java-exception-handling 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.

skills/126-java-exception-handling/SKILL.md · 71 lines

How it starts

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

Java Exception Handling Guidelines

Identify and apply robust Java exception handling practices to improve error clarity, security, debuggability, and system reliability.

What is covered in this Skill?

  • Specific exception types instead of generic Exception/RuntimeException
  • try-with-resources for automatic resource cleanup
  • Secure exception messages that avoid information leakage
  • Exception chaining to preserve full error context
  • Early input validation with IllegalArgumentException/NullPointerException
  • InterruptedException handling with interrupted-status restoration
  • @throws JavaDoc documentation, fail-fast principle
  • Structured logging with correlation IDs, avoiding log-and-throw duplication
  • API boundary translation via centralized exception mappers
  • Bounded retry with backoff for idempotent operations only
  • Timeout enforcement with deadline propagation
  • Throwable#addSuppressed for secondary cleanup failures
  • Never catching Throwable/Error
  • Observability via error metrics
  • Failure propagation in async CompletionStage code

Scope: The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples.

Constraints

Before applying any exception handling changes, ensure the project compiles. If compilation fails, stop immediately — do not proceed until resolved. After applying improvements, run full verification.

  • MANDATORY: Run ./mvnw compile or mvn compile before applying any changes
  • SAFETY: If compilation fails, stop immediately — do not proceed until the project is in a valid state
  • VERIFY: Run ./mvnw clean verify or mvn clean verify after applying improvements
  • BEFORE APPLYING: Read the reference for detailed good/bad examples, constraints, and safeguards for each exception handling pattern

When to use this skill

  • Exception handling
  • Use try-with-resources in Java code
  • Create exception chaining in Java code
  • Apply fail-fast validation in Java code
  • Review Java exception taxonomy and propagation

Read the full file on GitHub · 71 lines

Files

What ships with it

1 file 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. 3d ago First seen · 71 lines · 144 tokens per session scan A f612a10f8ea3

Subscribe to this mod's changes

126-java-exception-handling is a skill published in the GitHub repository jabrena/plinth (436 stars, last pushed 2d ago), licensed Apache-2.0. It adds 144 tokens to every session and 759 once invoked, about $0.0007 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

performance-smell-detection

Detect potential code-level performance smells in Java - streams, collections, boxing, regex, object creation. Provides awareness, not absolutes - always measure before optimizing. For JPA/database performance, use jpa-patterns instead.

decebals/claude-code-java · 51 tokens

phx-investigate

Investigate Elixir/Phoenix bugs root-cause first. Reproduce failures, cite evidence, and use optional Amp subagents only when useful.

oliver-kriska/claude-elixir-phoenix · 35 tokens

phx-trace

Trace Elixir call trees from entry points via mix xref. Use when debugging data flow, planning signature changes, or understanding how a bug reaches code.

oliver-kriska/claude-elixir-phoenix · 36 tokens

logging-patterns

Java logging best practices with SLF4J, structured logging (JSON), and MDC for request tracing. Includes AI-friendly log formats for Claude Code debugging. Use when user asks about logging, debugging application flow, or analyzing logs.

decebals/claude-code-java · 50 tokens

go-errors

Enforces Go error handling — errors as values, wrapping with %w, errors.Is and errors.As over type assertions, sentinel and custom error types, and when panic is acceptable. Use when writing, reviewing, or debugging Go error paths, and when the user mentions err != nil, error wrapping, errors.Is, errors.As, sentinel…

CasLubbers/code-design-skills · 101 tokens

py-boy-scout

Use when fixing, editing, changing, debugging, or working with any Python code. Applies the Boy Scout Rule—always leave code cleaner than you found it. Orchestrates other clean code skills as needed. Also trigger on: "while you're at it", "any quick wins", "improve this a bit", "anything else obviously wrong", or when…

CasLubbers/code-design-skills · 0 tokens