implement-hexagonal-ports

Implement Hexagonal Architecture InPorts, OutPorts, and adapters with constructor injection.

Updated Oct 27, 2025
One-click install
npx skills add https://github.com/mariotoffia/gobridge --skill implement-hexagonal-ports
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: implement-hexagonal-ports
Source: https://github.com/mariotoffia/gobridge/tree/main/.cursor/skills/implement-hexagonal-ports
Command: npx skills add https://github.com/mariotoffia/gobridge --skill implement-hexagonal-ports

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Hexagonal Architecture helps developers create maintainable, testable applications by clearly separating the core domain from external services and infrastructure.

Core Features & Use Cases

  • Define InPorts and OutPorts to decouple business logic from frameworks.
  • Implement driving and driven adapters to swap implementations without touching core logic.
  • Wire dependencies via constructor injection and allow use cases to be exercised by REST, CLI, or events.

Quick Start

Start by creating a new skill module, declare InPort and OutPort interfaces, implement a use case that consumes them, add a driving adapter that calls the InPorts, and finally wire the adapters in your application bootstrap.

Frequently Asked Questions about implement-hexagonal-ports

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

FAQPage Schema
What is hexagonal architecture and how do ports and adapters decouple application logic?

Hexagonal architecture isolates core domain logic from infrastructure by defining driving InPorts and driven OutPorts. This decoupling means business rules remain independent of frameworks, allowing infrastructure adapters to be swapped or replaced without modifying the core application logic.

How do I implement InPorts and OutPorts for a use case using dependency injection?

To implement InPorts and OutPorts, define interfaces for driving and driven interactions. Construct a use case that consumes these OutPorts, then wire concrete adapter implementations via constructor injection during application bootstrap to exercise the logic.

Can I swap REST, CLI, or event adapters without touching core business logic?

Yes, you can swap REST, CLI, or event driving adapters because they all call the same InPorts. This architectural pattern ensures external delivery mechanisms are decoupled from the core domain, enabling flexible implementation swapping.

What's the best way to test hexagonal architecture use cases with mock adapters?

The best way to test hexagonal architecture use cases is by injecting in-memory or mock driven adapters. Because OutPorts are interfaces, you can replace database or API dependencies during testing to validate business logic in isolation.

Do I need domain-driven design knowledge to use ports and adapters effectively?

Yes, understanding domain-driven design concepts is required. The Skill requires familiarity with bounding contexts and constructor injection to properly separate core domain logic from external infrastructure adapters.