typescript-hexagonal-architecture

Organize TypeScript code into core, application, and infrastructure layers with explicit dependency rules.

1|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/thomassloboda/ai-stuff --skill typescript-hexagonal-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-hexagonal-architecture
Source: https://github.com/thomassloboda/ai-stuff/tree/main/skills/typescript-hexagonal-architecture
Command: npx skills add https://github.com/thomassloboda/ai-stuff --skill typescript-hexagonal-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill defines a disciplined blueprint for structuring TypeScript code according to hexagonal architecture, ensuring clear separation of concerns and explicit dependency rules.

Core Features & Use Cases

  • Layered organization and module boundaries: place core/domain, core/ports, application, and infrastructure in clearly defined folders with explicit boundaries.
  • Explicit dependency direction: enforce one-way data flow from core/domain through ports to infrastructure via adapters.
  • Barrel-file exposition and testing discipline: expose modules through barrel files and require tests for domain, use-cases, and adapters to prevent regressions.

Quick Start

Create a hexagonal-architecture-compliant TS module by placing domain logic in core/domain, exposing ports, and implementing adapters following barrel-file conventions.

Frequently Asked Questions about typescript-hexagonal-architecture

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

FAQPage Schema
How do I enforce hexagonal architecture and ports in a TypeScript project?

To enforce hexagonal architecture in TypeScript, organize code into core/domain, core/ports, application use-cases, and infrastructure adapters. This enforces explicit dependency rules and one-way data flow from the domain outward through adapters.

What is the best way to separate domain logic from infrastructure in TypeScript?

Separate domain logic from infrastructure by defining explicit ports and implementing infrastructure adapters. This approach enforces clear module boundaries and ensures your core domain logic remains isolated from external dependencies.

How do I structure TypeScript module boundaries using barrel files for ports and adapters?

Structure module boundaries by placing domain logic, ports, and adapters in clearly defined folders, then expose modules through barrel files. This enforces strict separation of concerns and explicit dependency direction across layers.

Can I apply DDD principles with strict module boundaries in an existing TypeScript application?

Yes, you can apply DDD principles by restructuring your application into core/domain, application use-cases, and infrastructure layers. This enforces explicit module boundaries and dependency rules without breaking existing domain logic.

What testing discipline is required for TypeScript hexagonal architecture use-cases and adapters?

Hexagonal architecture requires tests across domain, application use-cases, and infrastructure adapters to prevent regressions. This testing discipline validates the isolated domain logic and verifies adapter implementations against explicit ports.

When should I not use hexagonal architecture for a TypeScript module?

Avoid hexagonal architecture when your module requires minimal separation of concerns or lacks complex domain logic. The overhead of explicit ports, adapters, and strict module boundaries is unnecessary for simple, isolated utility scripts.