Design, implement, and refactor hexagonal architecture with clear, testable boundaries.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "hexagonal-architecture" skill from askskill: 1. Download https://raw.githubusercontent.com/affaan-m/ECC/main/skills/hexagonal-architecture/SKILL.md 2. Save it as ~/.claude/skills/hexagonal-architecture/SKILL.md 3. Reload skills and tell me it's ready
Design a hexagonal architecture for an e-commerce order service in TypeScript. List domain models, use cases, ports, adapters, and folder structure, and explain dependency direction.
A complete hexagonal architecture blueprint with domain boundaries, interface definitions, and recommended project structure.
Here is a Java controller tightly coupled to database and business logic. Refactor it into hexagonal architecture by separating use cases, repository ports, and adapters, and provide revised code examples and a testing strategy.
Refactored layered code using ports and adapters, plus actionable unit and integration testing guidance.
Using Kotlin, create a testable use-case orchestration example for a payment flow. Show dependency inversion, input/output models, port interfaces, failure handling, and include unit test examples.
A clear use-case orchestration example with port interfaces, error handling patterns, and accompanying test code.
Hexagonal architecture (Ports and Adapters) keeps business logic independent from frameworks, transport, and persistence details. The core app depends on abstract ports, and adapters implement those ports at the edges.
Use this skill when the request involves boundaries, domain-centric design, refactoring tightly coupled services, or decoupling application logic from specific libraries.
Outbound port interfaces usually live in the application layer (or in domain only when the abstraction is truly domain-level), while infrastructure adapters implement them.
Dependency direction is always inward:
Define a single use case with a clear input and output DTO. Keep transport details (Express req, GraphQL context, job payload wrappers) outside this boundary.
Identify every side effect as a port:
UserRepositoryPort)BillingGatewayPort)LoggerPort, ClockPort)Ports should model capabilities, not technologies.
Use case class/function receives ports via constructor/arguments. It validates application-level invariants, coordinates domain rules, and returns plain data structures.
Instantiate adapters, then inject them into use cases. Keep this wiring centralized to avoid hidden service-locator behavior.
flowchart LR
Client["Client (HTTP/CLI/Worker)"] --> InboundAdapter["Inbound Adapter"]
InboundAdapter -->|"calls"| UseCase["UseCase (Application Layer)"]
UseCase -->|"uses"| OutboundPort["OutboundPort (Interface)"]
OutboundAdapter["Outbound Adapter"] -->|"implements"| OutboundPort
OutboundAdapter --> ExternalSystem["DB/API/Queue"]
UseCase --> DomainModel["DomainModel"]
Use feature-first organization with explicit boundaries:
src/
features/
orders/
domain/
Order.ts
OrderPolicy.ts
application/
ports/
inbound/
CreateOrder.ts
outbound/
OrderRepositoryPort.ts
PaymentGatewayPort.ts
use-cases/
…
Run repo tasks, debug CI, and deliver fixes with verified evidence.
Process documents with OCR, conversion, extraction, redaction, signing, and form filling.
Build robust Django tests with pytest-django, TDD, mocks, factories, and API coverage.
Research prediction market signals for products, dashboards, agents, and decision intelligence.
Learn frontend patterns for React, Next.js, state, performance, and UI best practices.
Handle HIPAA privacy, security, PHI, and breach compliance tasks correctly.
Design systems and architectures with APIs, data models, and service boundaries.
Design and evaluate CLI tools and developer SDK architecture and usability.
Design or evaluate web services, APIs, scalability, and reliability tradeoffs.
Design and assess enterprise integration patterns, legacy modernization, and orchestration strategies.
Model complex domains and define system boundaries with Domain-Driven Design.
Choose suitable architectural primitives and judge whether a pattern truly fits.