architecture-patterns

Design backend systems using Clean, Hexagonal, and Domain-Driven architectures.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

Introduces proven backend architectures (Clean, Hexagonal, DDD) to structure scalable, testable systems.

Core Features & Use Cases

  • Clean Architecture: Clear layering with inward dependencies for testability.
  • Hexagonal & DDD: Ports/adapters and bounded contexts to enable flexible tooling.
  • Domain-Driven Design: Entities, value objects, aggregates, and repositories.

Quick Start

Map a new feature into a Clean Architecture layout and outline the domain model and boundaries.

Frequently Asked Questions about architecture-patterns

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

FAQPage Schema
How do I structure a backend application using Clean Architecture?

Clean Architecture organizes code into concentric layers with inward-pointing dependencies: entities at the core, use cases in the middle, and adapters (UI, database, web) at the outer ring. This layering isolates business logic from frameworks, making systems testable and maintainable.

What's the difference between Hexagonal Architecture and Clean Architecture?

Both enforce inward dependencies, but Hexagonal Architecture emphasizes ports and adapters—defining interfaces for external concerns like databases or APIs. Clean Architecture is more prescriptive about layer count and names. Hexagonal fits well when you need flexible tooling swaps.

How do I apply Domain-Driven Design to structure a complex backend system?

Domain-Driven Design models business logic using entities, value objects, aggregates, and repositories bounded by context. Define clear domain boundaries, map those to code structure, and ensure each bounded context owns its data and logic independently.

When should I refactor a monolith into Clean or Hexagonal Architecture?

Refactor when a monolith becomes hard to test, deploy independently, or organize logically. Clean and Hexagonal Architectures let you separate concerns gradually, establish team standards, and enable independent feature scaling without rewriting the entire system at once.

Do these architectural patterns work for microservices or only monoliths?

Clean, Hexagonal, and Domain-Driven Design patterns apply to both monoliths and microservices. For microservices, each service follows the pattern internally; bounded contexts from DDD map naturally to service boundaries, reducing coupling and coordination overhead.

What directory structure should I use to implement these architecture patterns?

The Skill provides concrete directory structures for Clean Architecture (layers: entities, use cases, adapters) and Hexagonal (core domain, ports, adapters). Structure depends on your pattern choice; follow the provided examples to establish consistency and prevent layer violations.