Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ccheney avatar

Clean Ddd Hexagonal

  • 4k installs
  • 57 repo stars
  • Updated July 7, 2026
  • ccheney/robust-skills

Proactively apply when designing APIs, microservices, or scalable backend structure. Triggers on DDD, Clean Architecture, Hexagonal, ports and adapters, entitie

About

The clean-ddd-hexagonal skill Proactively apply when designing APIs microservices or scalable backend structure Triggers on DDD Clean Architecture Hexagonal ports and adapters entities value objects domain events CQRS event sourcing repository pattern use cases onion architecture outbox pattern aggregate root anti-corruption layer Use when working with domain models aggregates repositories or bounded contexts Clean Architecture DDD Hexagonal patterns for backend services language-agnostic Go Rust Python TypeScript Java C Clean Architecture DDD Hexagonal Backend architecture combining DDD tactical patterns Clean Architecture dependency rules and Hexagonal ports adapters for maintainable testable systems This skill is an opinionated synthesis of several related architecture traditions It is not a single canonical architecture model Use the original source that matches the design question you are answering DDD for domain modeling Hexagonal Architecture for ports adapters Clean Architecture for dependency direction Onion Architecture for domain-centered layering and CQRS Event Sourcing only for specific read write or temporal requirements When to Use and When NOT to Use When Skip When.

  • agnostic (Go, Rust, Python, TypeScript, Java, C#).
  • # Clean Architecture + DDD + Hexagonal
  • centered layering, and CQRS/Event Sourcing only for specific read/write or temporal requirements.
  • ## When to Use (and When NOT to)
  • | Complex business domain with many rules | Simple CRUD, few business rules |

Clean Ddd Hexagonal by the numbers

  • 4,024 all-time installs (skills.sh)
  • +97 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #157 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

clean-ddd-hexagonal capabilities & compatibility

Capabilities
proactively apply when designing apis, microserv · reference guided agent workflow · skill.md grounded routing
Use cases
documentation
From the docs

What clean-ddd-hexagonal says it does

Clean Architecture + DDD + Hexagonal Backend architecture combining DDD tactical patterns, Clean Architecture dependency rules, and Hexagonal ports/adapters for maintainable, testa
SKILL.md
npx skills add https://github.com/ccheney/robust-skills --skill clean-ddd-hexagonal

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs4k
repo stars57
Security audit3 / 3 scanners passed
Last updatedJuly 7, 2026
Repositoryccheney/robust-skills

How do I apply clean-ddd-hexagonal patterns from its SKILL.md documentation?

Proactively apply when designing APIs, microservices, or scalable backend structure. Triggers on DDD, Clean Architecture, Hexagonal, ports and adapters, entities, value objects, domain events, CQRS, e

Who is it for?

Developers using clean-ddd-hexagonal inside Claude Code or Cursor agent workflows.

Skip if: Skip when the task is unrelated to this skill's documented scope.

When should I use this skill?

Proactively apply when designing APIs, microservices, or scalable backend structure. Triggers on DDD, Clean Architecture, Hexagonal, ports and adapters, entities, value objects, do

What you get

Actionable clean-ddd-hexagonal workflow grounded in the skill reference files.

  • bounded-context structure
  • ports-and-adapters layout
  • domain layer interfaces

By the numbers

  • SKILL.md grounded workflow
  • Agent-triggered invocation

Files

SKILL.mdMarkdownGitHub ↗

Clean Architecture + DDD + Hexagonal

Backend architecture combining DDD tactical patterns, Clean Architecture dependency rules, and Hexagonal ports/adapters for maintainable, testable systems.

This skill is an opinionated synthesis of several related architecture traditions. It is not a single canonical architecture model. Use the original source that matches the design question you are answering: DDD for domain modeling, Hexagonal Architecture for ports/adapters, Clean Architecture for dependency direction, Onion Architecture for domain-centered layering, and CQRS/Event Sourcing only for specific read/write or temporal requirements.

When to Use (and When NOT to)

Use WhenSkip When
Complex business domain with many rulesSimple CRUD, few business rules
Long-lived system (years of maintenance)Prototype, MVP, throwaway code
Team of 5+ developersSolo developer or small team (1-2)
Multiple entry points (API, CLI, events)Single entry point, simple API
Need to swap infrastructure (DB, broker)Fixed infrastructure, unlikely to change
High test coverage requiredQuick scripts, internal tools

Start simple. Evolve complexity only when needed. Most systems don't need full CQRS or Event Sourcing.

Pattern Boundaries

PatternPrimary QuestionUse It ForDo Not Treat As
DDDHow do we model a complex business domain?Ubiquitous language, bounded contexts, aggregates, value objectsA folder structure by itself
Hexagonal ArchitectureHow does the application interact with the outside world?Ports, driver adapters, driven adapters, testable application coreA mandate for six sides or one exact package layout
Clean ArchitectureWhich direction should dependencies point?Inward dependency rule, use case boundaries, framework independenceA universal four-folder template
Onion ArchitectureHow do we keep the domain model central?Domain-centered layers and dependency inversionA separate requirement when Clean/Hexagonal already solve the local problem
CQRSDo reads and writes need different models?Bounded contexts with divergent read/write workloadsA default application architecture
Event SourcingDo we need state from a complete event history?Audit, temporal queries, replayable workflowsA persistence default for CRUD systems

CRITICAL: The Dependency Rule

Dependencies point inward only. Outer layers depend on inner layers, never the reverse.

Infrastructure → Application → Domain
   (adapters)     (use cases)    (core)

Violations to catch:

  • Domain importing database/HTTP libraries
  • In this architecture style, controllers calling repositories directly instead of application use cases
  • Entities depending on application services

Design validation: "Create your application to work without either a UI or a database" — Alistair Cockburn. If you can run your domain logic from tests with no infrastructure, your boundaries are correct.

Quick Decision Trees

"Where does this code go?"

Where does it go?
├─ Pure business logic, no I/O           → domain/
├─ Orchestrates domain + has side effects → application/
├─ Talks to external systems              → infrastructure/
├─ Defines HOW to interact (interface)    → port (domain or application)
└─ Implements a port                      → adapter (infrastructure)

"Is this an Entity or Value Object?"

Entity or Value Object?
├─ Has unique identity that persists → Entity
├─ Defined only by its attributes    → Value Object
├─ "Is this THE same thing?"         → Entity (identity comparison)
└─ "Does this have the same value?"  → Value Object (structural equality)

"Should this be its own Aggregate?"

Aggregate boundaries?
├─ Must be consistent together in a transaction → Same aggregate
├─ Can be eventually consistent                 → Separate aggregates
├─ Referenced by ID only                        → Separate aggregates
└─ >10 entities in aggregate                    → Split it

Rule: One aggregate per transaction. Cross-aggregate consistency via domain events (eventual consistency).

Directory Structure

src/
├── domain/                    # Core business logic (NO external dependencies)
│   ├── {aggregate}/
│   │   ├── entity              # Aggregate root + child entities
│   │   ├── value_objects       # Immutable value types
│   │   ├── events              # Domain events
│   │   ├── repository          # DDD repository interface (driven port)
│   │   └── services            # Domain services (stateless logic)
│   └── shared/
│       └── errors              # Domain errors
├── application/               # Use cases / Application services
│   ├── {use-case}/
│   │   ├── command             # Command/Query DTOs
│   │   ├── handler             # Use case implementation
│   │   └── port                # Driver port interface
│   └── shared/
│       └── unit_of_work        # Transaction abstraction
├── infrastructure/            # Adapters (external concerns)
│   ├── persistence/           # Database adapters
│   ├── messaging/             # Message broker adapters
│   ├── http/                  # REST/GraphQL adapters (DRIVER)
│   └── config/
│       └── di                  # Dependency injection / composition root
└── main                        # Bootstrap / entry point

Port placement: This skill defaults to a DDD-centered layout where aggregate repository interfaces live beside the aggregate in domain/. A stricter Hexagonal layout may instead put driven ports under application/ports/driven/. Pick one convention per codebase and keep the dependency rule intact.

DDD Building Blocks

PatternPurposeLayerKey Rule
EntityIdentity + behaviorDomainEquality by ID
Value ObjectImmutable dataDomainEquality by value, no setters
AggregateConsistency boundaryDomainOnly root is referenced externally
Domain EventRecord of changeDomainPast tense naming (OrderPlaced)
RepositoryPersistence abstractionDomain (port)Per aggregate, not per table
Domain ServiceStateless logicDomainWhen logic doesn't fit an entity
Application ServiceOrchestrationApplicationCoordinates domain + infra

Anti-Patterns (CRITICAL)

Anti-PatternProblemFix
Anemic Domain ModelEntities are data bags, logic in servicesMove behavior INTO entities
Repository per EntityBreaks aggregate boundariesOne repository per AGGREGATE
Leaking InfrastructureDomain imports DB/HTTP libsDomain has ZERO external deps
God AggregateToo many entities, slow transactionsSplit into smaller aggregates
Skipping Use CasesControllers call repositories directly in a use-case architectureRoute through application use cases
CRUD ThinkingModeling data, not behaviorModel business operations
Premature CQRSAdding complexity before neededStart with simple read/write, evolve
Cross-Aggregate TXMultiple aggregates in one transactionUse domain events for consistency

Implementation Order

1. Discover the Domain — Event Storming, conversations with domain experts 2. Model the Domain — Entities, value objects, aggregates (no infra) 3. Define Ports — Repository interfaces, external service interfaces 4. Implement Use Cases — Application services coordinating domain 5. Add Adapters last — HTTP, database, messaging implementations

DDD is collaborative. Modeling sessions with domain experts are as important as the code patterns.

Reference Documentation

FilePurpose
references/LAYERS.mdComplete layer specifications
references/DDD-STRATEGIC.mdBounded contexts, context mapping
references/DDD-TACTICAL.mdEntities, value objects, aggregates (pseudocode)
references/HEXAGONAL.mdPorts, adapters, naming
references/CQRS-EVENTS.mdCommand/query separation, events
references/TESTING.mdUnit, integration, architecture tests
references/CHEATSHEET.mdQuick decision guide

Sources

Primary Sources

Primary Pattern References

Implementation Guides

Supplemental Syntheses

Related skills

How it compares

Proactively apply when designing APIs, microservices, or scalable backend structure. Triggers on DDD, Clean Architecture

FAQ

Who is clean-ddd-hexagonal for?

Developers applying clean-ddd-hexagonal from its SKILL.md guidance.

When should I use clean-ddd-hexagonal?

Proactively apply when designing APIs, microservices, or scalable backend structure. Triggers on DDD, Clean Architecture, Hexagonal, ports and adapters, entitie

Is clean-ddd-hexagonal safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.