jabrena/142-java-functional-programming
Use when you need to apply functional programming principles in Java — including writing immutable objects and Records, pure functions, functional interfaces, lambda expressions, Stream API pipelines, Optional for null safety, function composition, higher-order functions, pattern matching for instanceof and switch, sealed classes/interfaces for controlled hierarchies, Stream Gatherers for custom operations, currying/partial application, effect boundary separation, and concurrent-safe functional patterns. This should trigger for requests such as Improve the code with Functional Programming; Apply Functional Programming; Refactor the code with Functional Programming; Refactor Java code to use streams or Optionals safely; Improve immutability and pure functions in Java. Part of Plinth Toolkit
npx skills add https://github.com/jabrena/plinth --skill 142-java-functional-programming
Identify and apply functional programming principles in Java to improve immutability, expressiveness, and maintainability.
What is covered in this Skill?
Function, Predicate, Consumer, Supplier, custom @FunctionalInterfacetoUnmodifiable* collectorsOptional idiomatic usage: map/flatMap/filter/orElse* over isPresent()+get()andThen/composeinstanceof and switch (Java 21)List.of(), Collectors.toUnmodifiableList()Scope: The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples.
Before applying any functional programming changes, ensure the project compiles. If compilation fails, stop immediately — do not proceed until the project compiles successfully. Verify that maven-compiler-plugin source/target supports the Java features being used.
./mvnw compile or mvn compile before applying any changes./mvnw clean verify or mvn clean verify after applying improvementsRun ./mvnw compile or mvn compile and stop immediately if compilation fails.
Verify maven-compiler-plugin source/target supports the functional features planned for adoption.
Read references/142-java-functional-programming.md and identify opportunities for immutability, pure functions, and functional composition.
Implement selected functional refactorings while keeping side effects at boundaries.
Run ./mvnw clean verify or mvn clean verify after applying improvements.
For detailed guidance, examples, and constraints, see references/142-java-functional-programming.md.
Take jabrena/142-java-functional-programming from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.