hexagonal-architecture

Design and refactor Ports and Adapters systems with decoupled domain logic across TypeScript, Java, Kotlin, and Go.

5|15|Updated Jul 8, 2026
One-click install
npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill hexagonal-architecture-clfigueiredo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hexagonal-architecture
Source: https://github.com/clfigueiredo/hermes-infra-skills/tree/main/.hermes/skills/curso-hermes/hexagonal-architecture
Command: npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill hexagonal-architecture-clfigueiredo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Business logic often becomes tangled with frameworks, databases, and transport code, making services hard to test and painful to change. This Skill guides you to separate domain rules from infrastructure using the Ports and Adapters pattern so use cases stay testable and infrastructure stays replaceable. ## Core Features & Use Cases - Boundary Modeling: Define use cases with explicit input/output DTOs, inbound ports, and outbound ports for repositories, gateways, loggers, and clocks. - Multi-Language Guidance: Apply the same dependency rules in TypeScript, Java, Kotlin, and Go with concrete package layouts and composition-root wiring examples. - Migration Playbook: Refactor legacy layered code slice by slice using a strangler approach, facade-first port extraction, and characterization tests. - Use Case: You have an Express controller mixing SQL queries, Stripe calls, and business rules. Use this Skill to extract a CreateOrderUseCase with OrderRepositoryPort and PaymentGatewayPort interfaces, then move SQL and Stripe code into outbound adapters wired in a composition root. ## Quick Start Ask the agent to refactor one tightly coupled endpoint into a hexagonal use case with explicit ports, adapters, and a composition root.

Frequently Asked Questions about hexagonal-architecture

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

FAQPage Schema
How do I implement hexagonal architecture in TypeScript?▼

Define port interfaces in application/ports, write use cases that receive ports via constructor injection, and implement adapters under adapters/inbound and adapters/outbound. Wire everything in an explicit composition root factory instead of hidden global singletons.

How to refactor legacy code to ports and adapters?▼

Use a strangler approach: pick one high-churn vertical slice, extract a use-case boundary with input/output types, wrap existing infrastructure behind outbound ports, and delegate old adapters to the new use case. Add characterization tests first and migrate slice by slice.

What is the difference between inbound and outbound ports?▼

Inbound ports are contracts describing what the application can do, called by inbound adapters like HTTP controllers or CLI handlers. Outbound ports are contracts for dependencies the application needs, such as repositories, payment gateways, and clocks, implemented by outbound adapters.

Does hexagonal architecture work with Spring, Koin, or Go?▼

Yes, the same boundary rules apply across Java with Spring, Kotlin with Koin or Dagger, and Go with small interfaces and explicit constructors. Framework annotations stay optional and wiring lives in a dedicated configuration or main package, never in domain classes.

When should I not use hexagonal architecture?▼

Avoid it for simple CRUD scripts or prototypes where the overhead of ports, adapters, and composition roots outweighs maintainability gains. The pattern pays off when you need multiple interfaces, replaceable infrastructure, or long-term testability of business rules.