architecture-patterns

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

1|Updated Aug 31, 2024
One-click install
npx skills add https://github.com/aRustyDev/dotfiles --skill architecture-patterns-arustydev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: architecture-patterns
Source: https://github.com/aRustyDev/dotfiles/tree/main/.ai/plugins/backend-development/skills/architecture-patterns
Command: npx skills add https://github.com/aRustyDev/dotfiles --skill architecture-patterns-arustydev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires asyncpg, fastapi, pydantic, stripe, and includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill empowers you to implement proven backend architecture patterns like Clean Architecture, Hexagonal Architecture, and Domain-Driven Design, leading to maintainable, testable, and scalable systems.

Core Features & Use Cases

  • Layered Architectures: Guides through Clean Architecture's entities, use cases, and adapters for clear separation of concerns.
  • Ports and Adapters: Implements Hexagonal Architecture for technology-agnostic core logic and easy testability.
  • Domain-Driven Design: Applies strategic and tactical DDD patterns for rich domain models and consistency boundaries.
  • Use Case: Refactor a monolithic application into a Clean Architecture, isolating business logic from framework details and making it easier to test and evolve.

Quick Start

Describe the core layers and their dependencies in Clean Architecture.

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 principles?

Clean Architecture organizes code into layers—entities, use cases, and adapters—with inward dependency flow so business logic stays independent from frameworks. This separation enables testability, maintainability, and technology-agnostic core logic that survives framework changes.

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

Hexagonal Architecture (ports and adapters) and Clean Architecture share the same core goal: isolating domain logic from external dependencies. Hexagonal emphasizes symmetrical boundaries and explicit ports; Clean Architecture layers dependencies more formally, but both achieve framework independence and testability.

How do I apply Domain-Driven Design to backend system design?

Domain-Driven Design uses strategic patterns—bounded contexts, ubiquitous language—and tactical patterns—aggregates, repositories, domain events—to model rich, cohesive domains. This approach clarifies ownership, reduces coupling, and aligns code structure with business requirements.

Can I refactor a monolithic application into a loosely coupled architecture?

Yes. By applying Clean Architecture or Hexagonal patterns, you isolate business logic from framework details, extract domain models, define repositories for data access, and introduce domain events for decoupling. This enables gradual migration to microservices or modular monoliths.

What project structure should I use for a backend system following these patterns?

A canonical structure organizes code by layers (entities, use cases, adapters) or domains (bounded contexts), each with clear input and output boundaries. This structure makes dependencies explicit, supports parallel development, and simplifies testing in isolation.

Do these architecture patterns work with FastAPI and async frameworks?

Yes. Clean Architecture and Hexagonal patterns are framework-agnostic; FastAPI and async tools like asyncpg operate as adapters in the presentation and data layers, leaving core business logic independent and testable regardless of async implementation details.