hexagonal-architecture

Designs ports-and-adapters boundaries separating domain logic from frameworks and infrastructure.

3|Updated Apr 18, 2026
One-click install
npx skills add https://github.com/ankhorage/zora --skill hexagonal-architecture-ankhorage
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hexagonal-architecture
Source: https://github.com/ankhorage/zora/tree/main/.agents/skills/hexagonal-architecture
Command: npx skills add https://github.com/ankhorage/zora --skill hexagonal-architecture-ankhorage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Business logic often becomes entangled with web frameworks, ORMs, and external SDKs, making code hard to test, refactor, and migrate. This Skill guides you through applying hexagonal architecture (ports and adapters) so domain rules stay independent of transport and persistence details. ## Core Features & Use Cases - Boundary Design: Define inbound ports, outbound ports, use cases, and adapters with a clear dependency direction pointing inward. - Multi-Language Guidance: Apply the same boundary rules in TypeScript, Java, Kotlin, and Go with language-specific module layouts and wiring styles. - Migration Playbook: Refactor legacy systems slice-by-slice using a strangler approach with characterization tests and rollback paths. - Use Case: When adding a new orders feature, use this Skill to define an OrderRepositoryPort and PaymentGatewayPort, implement a CreateOrderUseCase with pure orchestration, and wire Postgres and Stripe adapters in a single composition root. ## Quick Start Use the hexagonal-architecture skill to design the ports, use cases, and adapters for my new feature before I write any framework code.

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 outbound port interfaces in the application layer, write use cases that receive ports via constructor injection, and implement adapters for databases and external APIs. Wire everything in an explicit composition root factory rather than using hidden global singletons.

What is the difference between inbound and outbound ports?▼

Inbound ports are contracts describing what the application can do, such as commands and queries called by controllers. Outbound ports are contracts for dependencies the application needs, such as repositories, payment gateways, and event publishers.

How do I refactor legacy code to ports and adapters?▼

Use a strangler approach: pick one vertical slice, extract a use-case boundary with explicit input and output types, wrap existing infrastructure behind outbound ports, and add characterization tests. Migrate slice-by-slice instead of rewriting everything at once.

Does hexagonal architecture work with Spring or dependency injection frameworks?▼

Yes. In Java and Kotlin, ports are interfaces in application.port packages and use cases are plain classes where Spring annotations are optional. Keep wiring in configuration classes so framework specifics never leak into domain or use-case code.

How do I test use cases without a real database?▼

Unit test use cases with in-memory fakes or stubs implementing the outbound port interfaces, asserting business outcomes and port interactions. Separately run adapter integration tests against real infrastructure to verify queries, serialization, and timeouts.

When should I not use hexagonal architecture?▼

Avoid it for trivial CRUD scripts or prototypes where the indirection of ports and adapters adds cost without payoff. It pays off when long-term maintainability, multiple delivery interfaces, or infrastructure replaceability actually matter.