hexagonal-architecture

Structure software projects with hexagonal architecture to separate domain logic from infrastructure.

2|1|Updated Jun 13, 2025
One-click install
npx skills add https://github.com/leynos/agent-helper-scripts --skill hexagonal-architecture-leynos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hexagonal-architecture
Source: https://github.com/leynos/agent-helper-scripts/tree/main/skills/hexagonal-architecture
Command: npx skills add https://github.com/leynos/agent-helper-scripts --skill hexagonal-architecture-leynos

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Hexagonal architecture isolates core business logic from infrastructure concerns by defining explicit boundaries between the domain and external systems, improving testability and maintainability.

Core Features & Use Cases

  • Clear separation between domain and infrastructure via ports and adapters.
  • Testability: domain logic can be tested without external dependencies.
  • Evolution-friendly: supports multiple delivery mechanisms (API, CLI, queues) without coupling.
  • Architectural drift detection: provides patterns to detect and remediate boundary violations.

Quick Start

Identify the domain boundaries and start modeling driving and driven ports with corresponding adapters.

Frequently Asked Questions about hexagonal-architecture

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

FAQPage Schema
What is hexagonal architecture and how does it separate domain logic from infrastructure?

Hexagonal architecture isolates core business logic by defining explicit boundaries between the domain and external systems. It uses driving and driven ports to separate domain logic from infrastructure, improving testability and maintainability.

How do I structure a new project using ports and adapters?

To structure a project using ports and adapters, identify the domain boundaries first, then model driving and driven ports with corresponding adapters. This workflow separates domain logic from infrastructure for API, CLI, and background job workflows.

Can I use hexagonal architecture when refactoring an existing system with multiple delivery mechanisms?

Hexagonal architecture supports refactoring existing systems by enforcing boundaries across API, CLI, and queue delivery mechanisms without coupling. It defines domain, ports, and adapters to isolate core logic during architecture reviews.

What is the best way to detect architectural drift and boundary violations in domain-driven design?

The best way to detect architectural drift is using provided drift detection patterns that identify and remediate boundary violations between the domain and infrastructure. These patterns enforce clear separation during architecture reviews.

How does hexagonal architecture improve testability for domain logic?

Hexagonal architecture improves testability by isolating core domain logic from infrastructure concerns. Domain logic can be tested without external dependencies through explicit ports and adapters, ensuring clear boundaries are maintained.

When should I not use hexagonal architecture for my software project?

Hexagonal architecture may not suit simple systems where infrastructure coupling is minimal. Its ports and adapters pattern adds structural overhead, so projects without complex domain logic or multiple delivery mechanisms may not benefit from enforcing these boundaries.