hkj-arch

Provides architectural patterns for structuring Java 25 applications with Functional Core, Imperative Shell design.

78|6|Updated Apr 4, 2025
One-click install
npx skills add https://github.com/higher-kinded-j/higher-kinded-j --skill hkj-arch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hkj-arch
Source: https://github.com/higher-kinded-j/higher-kinded-j/tree/main/.claude/skills/hkj-arch
Command: npx skills add https://github.com/higher-kinded-j/higher-kinded-j --skill hkj-arch

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill addresses the complexity of managing side effects and state in Java applications by providing a structured approach to the Functional Core, Imperative Shell (FCIS) pattern. It eliminates scattered validation logic, hidden side effects, and difficult-to-test code by enforcing a clear separation between pure business logic and effectful I/O.

Core Features & Use Cases

  • Architectural Guidance: Provides clear patterns for separating pure domain logic from side-effecting shell code using Higher-Kinded-J.
  • Domain Modelling: Offers best practices for using Java 25 records, sealed interfaces, and pattern matching to create type-safe, immutable domain models.
  • Deterministic Testing: Enables testing of time-sensitive and effectful logic without mocks by using TimeSource and Effect Handlers.
  • Use Case: Refactor a legacy Spring Boot service that mixes database calls, validation, and business rules into a clean, testable pipeline where business rules are pure functions and I/O is pushed to the controller boundary.

Quick Start

Use the hkj-arch skill to analyze my current service architecture and suggest a migration plan to the functional core imperative shell pattern.

Frequently Asked Questions about hkj-arch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I separate business logic from side effects in Java applications?

To separate business logic from side effects in Java applications, implement the Functional Core, Imperative Shell pattern to isolate pure domain rules from effectful I/O boundaries. This enforces a clear separation, eliminating scattered validation and hidden state mutations.

How do I test time-sensitive logic deterministically without using mocks?

You can test time-sensitive logic deterministically without mocks by using TimeSource and Effect Handlers. This pattern isolates time-based effects and I/O operations, allowing pure business logic to execute predictably in test environments.

What is the best way to model domain entities in Java 25?

The best way to model domain entities in Java 25 is using records, sealed interfaces, and pattern matching. This approach creates type-safe, immutable domain models with sealed error hierarchies for robust domain-oriented programming.

Can I refactor a legacy Spring Boot service into a functional core architecture?

Yes, you can refactor a legacy Spring Boot service into a functional core architecture. This migration extracts mixed database calls, validation, and business rules into a testable pipeline where business rules become pure functions and I/O is pushed to the controller boundary.

Does migrating to functional core architecture require Higher-Kinded-J types?

Migrating to functional core architecture uses Higher-Kinded-J types to facilitate the transition from imperative services to pure, testable business logic. It supports isolating effectful boundaries and integrating domain-oriented programming within Java 25 applications.