One-click install
npx skills add https://github.com/himanshu231204/AI_Research_agent --skill hexagonal-architecture-himanshu231204
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hexagonal-architecture
Source: https://github.com/himanshu231204/AI_Research_agent/tree/main/.opencode/skills/hexagonal-architecture
Command: npx skills add https://github.com/himanshu231204/AI_Research_agent --skill hexagonal-architecture-himanshu231204

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the pain of tightly coupled application code where business logic is mixed with framework, transport, and persistence details, making systems hard to maintain, test, and adapt to changing infrastructure or requirements.

Core Features & Use Cases

  • Decoupled Domain Logic: Keep core business rules independent of frameworks, databases, and external APIs for long-term maintainability.
  • Multi-Interface Support: Build use cases that work across HTTP, CLI, queue workers, and cron jobs without rewriting core logic.
  • Testable Workflows: Unit test use cases with simple in-memory fakes, and swap infrastructure components (like databases or payment gateways) without modifying business rules.
  • Use Case Example: Refactor a legacy e-commerce service where order processing logic is mixed with Stripe SDK calls and Postgres queries into a clean, testable structure with separate ports and adapters.

Quick Start

Use the hexagonal-architecture skill to refactor your existing order processing service to separate business rules from Stripe payment and Postgres persistence logic.

Frequently Asked Questions about hexagonal-architecture

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

FAQPage Schema
How do I separate business logic from infrastructure dependencies like databases and external APIs?

You separate business logic from infrastructure dependencies by applying hexagonal architecture, which isolates core domain rules into ports and adapters, ensuring business rules remain independent of frameworks, databases, and external APIs.

What is the best way to refactor a legacy layered architecture with tightly coupled code?

The best way to refactor tightly coupled legacy code is using hexagonal architecture to extract business rules from framework and persistence details into explicit ports, allowing infrastructure swaps without modifying core logic and enabling simple unit testing with in-memory fakes.

Can I use hexagonal architecture for services supporting multiple interfaces like HTTP, CLI, and cron jobs?

Yes, hexagonal architecture supports multi-interface use cases by routing HTTP, CLI, queue worker, and cron job requests through separate adapters to the same core use cases, allowing multiple interface support without rewriting core business logic.

Does this dependency inversion approach work with TypeScript, Java, Kotlin, and Go?

Yes, this dependency inversion approach supports cross-language service implementations across TypeScript, Java, Kotlin, and Go, applying explicit domain boundaries and testable application orchestration consistently regardless of the underlying language ecosystem.

How do I unit test use cases when business logic is mixed with Stripe SDK calls and Postgres queries?

To unit test use cases mixed with Stripe SDK calls and Postgres queries, refactor using ports and adapters to inject in-memory fakes, enabling you to test application orchestration and business rules without hitting real payment or database infrastructure.

When should I not use ports and adapters for application design?

You should avoid ports and adapters when application complexity is low, if you do not require multiple interface support, or when infrastructure swaps are unlikely, as the overhead of explicit domain boundaries and dependency inversion may outweigh maintainability benefits.