Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when you need to apply functional exception handling best practices in Java — including replacing exception overuse with Optional and VAVR Either types, designing error type hierarchies using sealed classes and enums, implementing monadic error composition pipelines, establishing functional control flow patterns, and reserving exceptions only for truly exceptional system-level failures. This should trigger for requests such as Improve the code with Functional Exception Handling; Apply Functi
.claude/skills/jabrena-143-java-functional-exception-handling/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 43% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 26% | 0% |
| case-04 | ✓→✗ | ▼ Worse | -55% | 0% |
| case-11 | ✓→✓ | = Same ✓ | -25% | 0% |
Identify and apply functional exception handling best practices in Java to improve error clarity, maintainability, and performance by eliminating exception overuse in favour of monadic error types.
What is covered in this Skill?
Optional<T> for nullable values over throwing NullPointerException or NotFoundExceptionEither<L,R> for predictable business-logic failuresCompletableFuture<T> for async error handlingflatMap/map/peek/peekLeft for chaining operations that can failScope: The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples.
Before applying any functional exception handling changes, ensure the project validates. When introducing Either types, confirm the VAVR dependency (io.vavr:vavr) and SLF4J are present.
./mvnw validate or mvn validate before applying any changesEither types, confirm VAVR (io.vavr:vavr) and SLF4J are present./mvnw clean verify or mvn clean verify after applying improvementsRun ./mvnw validate or mvn validate and stop immediately if validation fails.
When introducing Either, confirm VAVR (io.vavr:vavr) and SLF4J are present before implementation.
Read references/143-java-functional-exception-handling.md and identify places to replace exception-heavy control flow with monadic error types.
Implement selected Optional/Either/async error patterns with structured logging and clear error contracts.
Run ./mvnw clean verify or mvn clean verify after applying improvements.
For detailed guidance, examples, and constraints, see references/143-java-functional-exception-handling.md.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-11 | pass→pass | 9,589 | 2,428 | -75% | 1 | 1 | 0% | 1,337 | 1,006 | -25% | 0 | 0 | — |
case-01 | fail→fail | 18,271 | 6,131 | -66% | 1 | 1 | 0% | 3,288 | 950 | -71% | 0 | 0 | — |
case-02 | fail→fail | 17,432 | 5,982 | -66% | 1 | 1 | 0% | 3,211 | 1,016 | -68% | 0 | 0 | — |
case-03 | fail→fail | 17,848 | 4,729 | -74% | 1 | 1 | 0% | 2,968 | 851 | -71% | 0 | 0 | — |
case-04 | pass→fail | 11,962 | 5,248 | -56% | 1 | 1 | 0% | 1,946 | 882 | -55% | 0 | 0 | — |
case-05 | pass→pass | 17,464 | 11,006 | -37% | 1 | 1 | 0% | 3,017 | 2,583 | -14% | 0 | 0 | — |
case-06 | pass→pass | 16,260 | 8,230 | -49% | 1 | 1 | 0% | 2,843 | 2,029 | -29% | 0 | 0 | — |
case-07 | pass→pass | 17,508 | 8,218 | -53% | 1 | 1 | 0% | 2,870 | 1,963 | -32% | 0 | 0 | — |
case-08 | pass→pass | 6,615 | 4,851 | -27% | 1 | 1 | 0% | 1,045 | 1,502 | +44% | 0 | 0 | — |
case-09 | pass→pass | 11,436 | 8,631 | -25% | 1 | 1 | 0% | 1,741 | 2,008 | +15% | 0 | 0 | — |
case-10 | fail→pass | 6,904 | 3,915 | -43% | 1 | 1 | 0% | 1,161 | 1,367 | +18% | 0 | 0 | — |
case-12 | fail→pass | 4,624 | 2,135 | -54% | 1 | 1 | 0% | 679 | 973 | +43% | 0 | 0 | — |
case-13 | fail→fail | 10,203 | 6,918 | -32% | 1 | 1 | 0% | 1,863 | 1,859 | -0% | 0 | 0 | — |
case-14 | pass→pass | 4,279 | 3,796 | -11% | 1 | 1 | 0% | 754 | 1,290 | +71% | 0 | 0 | — |
case-15 | pass→pass | 20,939 | 15,090 | -28% | 1 | 1 | 0% | 3,028 | 2,823 | -7% | 0 | 0 | — |
case-16 | pass→pass | 4,366 | 5,552 | +27% | 1 | 1 | 0% | 723 | 1,665 | +130% | 0 | 0 | — |
case-17 | pass→pass | 7,580 | 7,677 | +1% | 1 | 1 | 0% | 1,243 | 1,995 | +60% | 0 | 0 | — |
case-18 | pass→pass | 9,534 | 7,556 | -21% | 1 | 1 | 0% | 1,508 | 1,856 | +23% | 0 | 0 | — |
case-19 | fail→pass | 14,931 | 14,886 | -0% | 1 | 1 | 0% | 2,669 | 3,371 | +26% | 0 | 0 | — |
case-20 | pass→pass | 17,545 | 16,004 | -9% | 1 | 1 | 0% | 3,219 | 3,542 | +10% | 0 | 0 | — |
case-21 | pass→pass | 13,347 | 7,766 | -42% | 1 | 1 | 0% | 2,182 | 2,061 | -6% | 0 | 0 | — |
case-22 | pass→pass | 12,578 | 16,854 | +34% | 1 | 1 | 0% | 2,310 | 3,570 | +55% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 19 counted toward the lift figure. The other 3 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +9 percentage points is the difference between those two pass rates over the 19 comparable cases. 3 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.