Java

From dean0x/devflow · View interactive version

Java is an AI agent skill from the GitHub repository dean0x/devflow. This skill should be used when the user works with Java files (.java), asks about "records", "sealed classes", "streams", or discusses modern Java patterns.

How to use this skill

Skill file

Java Patterns

Iron Law

FAVOR COMPOSITION OVER INHERITANCE

Delegation and interfaces over class hierarchies. Inheritance creates tight coupling,

breaks encapsulation, and makes refactoring dangerous. Use interfaces for polymorphism,

records for data, and sealed classes for restricted hierarchies. Extend only when the

"is-a" relationship is genuinely invariant. — Effective Java, Item 18 [1, Item 18]

Type System (Modern Java)

public sealed interface Result<T> permits Success, Failure {
    record Success<T>(T value) implements Result<T> {}
    record Failure<T>(String error) implements Result<T> {}
}
switch (result) {
    case Success<User> s -> handleSuccess(s.value());
    case Failure<User> f -> handleError(f.error());
}

Error Handling

Immutability and Composition

Extended References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.