hexagonal-architecture

Community

Isolate domain logic, test with real services.

Authoraitchwhy
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill promotes a "no-mock" testing strategy for hexagonal architecture, ensuring that domain logic is isolated and tested against real infrastructure via service containers. It leads to more reliable, representative tests and reduces the fragility of mock-heavy test suites.

Core Features & Use Cases

  • Absolute Constraints: Strictly forbids mocking frameworks (jest.mock, vi.mock, sinon.stub) and encourages testing against real service containers.
  • Port & Adapter Pattern: Guides on defining clear port interfaces (contracts) and implementing concrete adapters for various infrastructure concerns (databases, blob storage, external APIs).
  • Service Container Setup: Provides patterns for configuring PostgreSQL and MinIO via process-compose (local development) and GitHub Actions services (CI/CD) for consistent test environments.
  • Use Case: A developer needs to test a new database interaction. Instead of mocking the database, they can use this skill to set up a real PostgreSQL container via process-compose, write an integration test that uses the actual database adapter, and verify the interaction against a live service.

Quick Start

Refactor the 'UserRepository' to use a 'DatabasePort' interface and implement a 'PostgresAdapter' that connects to a real PostgreSQL instance, ensuring no mocking is used in tests.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: hexagonal-architecture
Download link: https://github.com/aitchwhy/dotfiles/archive/main.zip#hexagonal-architecture

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.