hexagonal-architecture

Run integration tests against real PostgreSQL, MinIO, and Redis containers without mocking.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/aitchwhy/dotfiles --skill hexagonal-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hexagonal-architecture
Source: https://github.com/aitchwhy/dotfiles/tree/main/config/agents/skills/hexagonal-architecture
Command: npx skills add https://github.com/aitchwhy/dotfiles --skill hexagonal-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

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.

Frequently Asked Questions about hexagonal-architecture

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

FAQPage Schema
How do I test integration with real databases instead of using mocks?

Integration testing with real databases involves setting up service containers like PostgreSQL via process-compose, implementing concrete adapters for your ports, and executing tests against the live service rather than mock objects. This approach validates actual IO contracts and eliminates fragility from mock-heavy suites.

What is hexagonal architecture and how does it help with testing?

Hexagonal architecture isolates domain logic at the center with typed port interfaces and adapter implementations at the edges. This separation enables reliable testing by allowing you to swap real infrastructure adapters (PostgreSQL, MinIO, Redis) into your domain layer without mocking, ensuring tests exercise actual service interactions.

Can I test backend services without mocking frameworks?

Yes. A no-mock testing strategy uses real service containers—PostgreSQL, MinIO, Redis—configured via process-compose locally and GitHub Actions services in CI/CD. You implement lightweight adapters for your ports and test your domain logic against actual infrastructure, eliminating mock-related fragility.

How do I set up PostgreSQL and MinIO containers for local testing?

Use process-compose to configure real PostgreSQL and MinIO containers for your local development environment. Define your port interfaces, implement concrete adapters that connect to these services, and write integration tests that exercise actual storage and database interactions without mocking.

What's the difference between dependency injection and mocking in integration tests?

Dependency injection supplies real service adapters at the composition root, while mocking replaces them with fake implementations. This Skill mandates dependency injection with real containers to validate actual IO contracts and domain logic behavior against live infrastructure, not simulated behavior.

Do I need to refactor existing code to use ports and adapters?

Yes. Define clear port interfaces for your infrastructure concerns (database, storage, APIs), then implement concrete adapters for real services like PostgreSQL and MinIO. This refactoring enables true integration testing with real containers and eliminates the need for mocking frameworks entirely.