hexagonal-architecture-layers-java

hexagonal-architecture-layers-java is a skill for Claude Code, Codex from Gentleman-Programming/Gentleman-Skills. It costs 39 tokens per session (874 once invoked), scanned A, original, MIT.

A guide to organising Java services into domain, application, and infrastructure layers. Hexagonal architecture keeps business rules separate from frameworks, databases, and external services.

In plain words
What is it for?
Use it when designing or refactoring Java services, separating use cases from adapters, or supporting multiple interfaces and data stores.
Why use it?
It helps prevent business logic from becoming tied to Spring, persistence tools, or network details, making boundaries and testing clearer.

Skill for Claude CodeCodex

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/gentleman-programming/gentleman-skills/hexagonal-architecture-layers-java
Any agent
npx skills add Gentleman-Programming/Gentleman-Skills --skill hexagonal-architecture-layers-java
Clone the repo
git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-Skills

Made for: Claude Code, Codex.

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 hexagonal-architecture-layers-java

README.md
[![agentmods](https://agentmods.dev/badge/skills/gentleman-programming/gentleman-skills/hexagonal-architecture-layers-java.svg)](https://agentmods.dev/skills/gentleman-programming/gentleman-skills/hexagonal-architecture-layers-java)
Your own site
<a href="https://agentmods.dev/skills/gentleman-programming/gentleman-skills/hexagonal-architecture-layers-java"><img src="https://agentmods.dev/badge/skills/gentleman-programming/gentleman-skills/hexagonal-architecture-layers-java.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 874 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.00039 $0.00874
Opus 5 $0.00019 $0.00437
Sonnet 5 $0.00008 $0.00175
Haiku 4.5 $0.00004 $0.00087

Measured 6d ago against content hash 4ce68f4122be, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

hexagonal-architecture-layers-java 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 6d 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.

community/hexagonal-architecture-layers-java/SKILL.md · 165 lines

How it starts

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

When to Use

Load this skill when:

  • Designing a new Java service with clean, testable layers
  • Refactoring Spring code to isolate the domain from frameworks
  • Supporting multiple adapters (REST + messaging, JPA + Mongo)
  • Enforcing dependency direction and clear module boundaries

Critical Patterns

Pattern 1: Domain is pure

Domain has no framework annotations, no persistence concerns, and no I/O.

Pattern 2: Application orchestrates

Application defines use cases and ports, calling domain logic and delegating I/O to ports.

Pattern 3: Infrastructure adapts

Infrastructure implements ports and wires adapters (controllers, repositories, clients).

Code Examples

Example 1: Domain model + output port

package com.acme.order.domain;

public record OrderId(String value) { }

public final class Order {
  private final OrderId id;
  private final Money total;

  public Order(OrderId id, Money total) {
    this.id = id;
    this.total = total;
  }

  public OrderId id() { return id; }
  public Money total() { return total; }
}
package com.acme.order.application.port;

import com.acme.order.domain.Order;
import com.acme.order.domain.OrderId;

public interface OrderRepositoryPort {
  OrderId nextId();
  void save(Order order);
}

Example 2: Application use case + input port

package com.acme.order.application.usecase;

import com.acme.order.application.port.OrderRepositoryPort;
import com.acme.order.domain.Order;
import com.acme.order.domain.OrderId;
import com.acme.order.domain.Money;

public interface PlaceOrderUseCase {
  OrderId place(Money total);
}

public final class PlaceOrderService implements PlaceOrderUseCase {
  private final OrderRepositoryPort repository;

  public PlaceOrderService(OrderRepositoryPort repository) {
    this.repository = repository;
  }

  @Override
  public OrderId place(Money total) {
    OrderId id = repository.nextId();
    Order order = new Order(id, total);
    repository.save(order);
    return id;
  }
}

Read the full file on GitHub · 165 lines

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. 6d ago First seen · 165 lines · 39 tokens per session scan A 4ce68f4122be

Subscribe to this mod's changes

hexagonal-architecture-layers-java is a skill published in the GitHub repository Gentleman-Programming/Gentleman-Skills (641 stars, last pushed 5mo ago), licensed MIT. It adds 39 tokens to every session and 874 once invoked, about $0.0002 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-08-30.

Related

Other skills, from other repositories

azure-security-keyvault-secrets-java

Azure Key Vault Secrets Java SDK for secret management. Use when storing, retrieving, or managing passwords, API keys, connection strings, or other sensitive configuration data.

microsoft/skills · 40 tokens

azure-ai-anomalydetector-java

Build anomaly detection applications with Azure AI Anomaly Detector SDK for Java. Use when implementing univariate/multivariate anomaly detection, time-series analysis, or AI-powered monitoring.

microsoft/skills · 43 tokens

azure-communication-chat-java

Build real-time chat applications with Azure Communication Services Chat Java SDK. Use when implementing chat threads, messaging, participants, read receipts, typing notifications, or real-time chat features.

microsoft/skills · 41 tokens

azure-communication-common-java

Azure Communication Services common utilities for Java. Use when working with CommunicationTokenCredential, user identifiers, token refresh, or shared authentication across ACS services.

microsoft/skills · 35 tokens

union-type-wrappers

Add typed getters and setters over BinaryData properties that represent TypeSpec union types in generated Java models. Use when generated classes expose BinaryData for union-typed fields and you need ergonomic, type-safe accessors instead.

Azure/azure-sdk-for-java · 49 tokens

azure-ai-agents-persistent-java

Azure AI Agents Persistent SDK for Java. Low-level SDK for creating and managing AI agents with threads, messages, runs, and tools. Triggers: "PersistentAgentsClient", "persistent agents java", "agent threads java", "agent runs java", "streaming agents java".

microsoft/skills · 63 tokens