architecture-patterns

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

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/5onyy/essential-ai-agent-skills --skill architecture-patterns-5onyy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: architecture-patterns
Source: https://github.com/5onyy/essential-ai-agent-skills/tree/main/.cursor/skills/architecture-patterns
Command: npx skills add https://github.com/5onyy/essential-ai-agent-skills --skill architecture-patterns-5onyy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing backend systems that remain maintainable, testable, and scalable is difficult when business logic becomes coupled to frameworks, databases, and external services. This Skill provides structured guidance for applying proven architecture patterns so dependencies point inward and core domain logic stays independent of infrastructure. ## Core Features & Use Cases - Clean Architecture Implementation: Layered structure separating entities, use cases, interface adapters, and frameworks, with Python code examples for repositories, use cases, and controllers. - Hexagonal Architecture (Ports and Adapters): Define ports as interfaces and swap adapters such as Stripe payment gateways or mock implementations for testing. - Domain-Driven Design: Tactical patterns including entities, value objects, aggregates, repositories, and domain events, plus strategic patterns like bounded contexts and ubiquitous language. - Use Case: When refactoring a monolithic order-processing application, use this Skill to define module boundaries, extract a domain core with Order aggregates and Money value objects, and migrate persistence behind repository interfaces. ## Quick Start Ask the agent to design a backend module for order processing using Clean Architecture with repository interfaces and use case classes.

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

Structure the project into domain entities, use cases, adapters, and infrastructure layers so dependencies point inward. Define repository interfaces in the domain layer, implement them with PostgreSQL or other adapters, and keep controllers thin by delegating to use case classes.

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

Clean Architecture organizes code into concentric layers where dependencies point inward toward entities. Hexagonal Architecture focuses on ports and adapters, isolating the domain core behind interfaces so implementations like Stripe or mock gateways can be swapped freely.

When should I use Domain-Driven Design tactical patterns?▼

Use DDD tactical patterns when the domain has complex business rules, invariants, and state transitions. Entities, value objects, aggregates, and domain events help model behavior-rich domains, but they add overhead for simple CRUD applications.

When should I avoid applying Clean Architecture?▼

Avoid full Clean Architecture for small localized refactors, simple CRUD services, or frontend-only work. Over-engineering simple applications with multiple layers and abstractions adds complexity without delivering maintainability benefits.

How do ports and adapters make code more testable?▼

Ports define interfaces for external concerns like payment gateways and repositories, while adapters provide implementations. Tests can inject mock adapters, such as a MockPaymentAdapter returning success, so domain logic runs without external services.