architecture-patterns

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

Updated Mar 3, 2026
One-click install
npx skills add https://github.com/manhthien2005/PM_REVIEW --skill architecture-patterns-manhthien2005
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: architecture-patterns
Source: https://github.com/manhthien2005/PM_REVIEW/tree/main/tooling/.windsurf-template/shared/skills/TongQuan/skills/architecture-patterns
Command: npx skills add https://github.com/manhthien2005/PM_REVIEW --skill architecture-patterns-manhthien2005

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing backend systems that remain maintainable, testable, and loosely coupled is difficult, especially when refactoring monoliths or establishing team-wide architecture standards. This Skill provides structured guidance and code templates for applying proven architecture patterns. ## Core Features & Use Cases - Clean Architecture: Layered structure with entities, use cases, adapters, and infrastructure, enforcing the dependency rule so business logic stays framework-independent. - Hexagonal Architecture: Ports and adapters pattern with concrete examples like Stripe payment adapters and mock adapters for testing. - Domain-Driven Design: Tactical patterns including entities, value objects, aggregates, repositories, and domain events. - Use Case: When refactoring a tightly coupled FastAPI monolith, use this Skill to define repository interfaces, extract use cases, and reorganize the codebase into a testable layered structure. ## Quick Start Ask the AI to design a backend module for order processing using Clean Architecture with repository interfaces and use cases.

Frequently Asked Questions about architecture-patterns

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

FAQPage Schema
How do I implement Clean Architecture in a Python backend?▼

Clean Architecture in Python organizes code into four layers: domain entities, use cases, adapters, and infrastructure. Dependencies point inward, so use cases depend only on abstract repository interfaces, while concrete implementations like PostgresUserRepository live in the adapters layer.

What is the difference between Clean Architecture and Hexagonal Architecture?▼

Clean Architecture organizes code into concentric layers with dependencies pointing inward, while Hexagonal Architecture centers the domain and connects external concerns through ports and adapters. Both keep business logic independent of frameworks and make cores testable with mock adapters.

How do I make a backend codebase testable without a database?▼

Define repository and gateway interfaces as abstract ports, then inject mock adapters during testing. For example, a MockPaymentAdapter returns successful results without calling Stripe, letting you test use cases and domain services without external dependencies.

When should I not use Clean Architecture or DDD?▼

Avoid these patterns for simple CRUD applications or small localized refactors, where the layering overhead exceeds the benefit. They fit complex domains with rich business rules, not systems that are primarily frontend or need only minor implementation changes.

What are common pitfalls when applying Domain-Driven Design?▼

Common pitfalls include anemic domain models with data but no behavior, business logic leaking into controllers, exposing ORM objects through repositories, and concrete dependencies in the domain core. Keep behavior in entities and enforce invariants through aggregate roots.