architecture-patterns

Apply Clean Architecture, Hexagonal Architecture, and DDD to design modular systems.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/yusoofsh/dotfiles --skill architecture-patterns-yusoofsh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: architecture-patterns
Source: https://github.com/yusoofsh/dotfiles/tree/main/home/dot_claude/private_plugins/private_marketplaces/claude-code-workflows/plugins/backend-development/skills/architecture-patterns
Command: npx skills add https://github.com/yusoofsh/dotfiles --skill architecture-patterns-yusoofsh

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 guides you in applying robust backend architecture patterns like Clean Architecture, Hexagonal Architecture, and DDD, ensuring your systems are maintainable, testable, and adaptable to change.

Core Features & Use Cases

  • Clean Architecture: Structure your application with clear layers, isolating business logic from frameworks and external concerns.
  • Hexagonal Architecture: Design systems with "ports and adapters" for easy swapping of infrastructure components and enhanced testability.
  • Domain-Driven Design (DDD): Model complex business domains with entities, value objects, and aggregates for a shared understanding and robust core.
  • Use Case: Refactor a monolithic e-commerce application into a more modular structure, allowing independent development of features and easier integration of new technologies.

Quick Start

Use the architecture-patterns skill to generate Python code for a basic Clean Architecture setup, including a User entity, an IUserRepository interface, and a CreateUserUseCase.

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 with Clean Architecture?

Clean Architecture separates your application into independent layers—entities, use cases, interface adapters, and frameworks—isolating business logic from external dependencies. This structure makes your codebase testable, maintainable, and resilient to technology changes.

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

Hexagonal Architecture (ports and adapters) emphasizes swappable infrastructure components through defined boundaries, while Clean Architecture focuses on layer isolation and inward dependency rules. Both achieve the same goal—decoupling business logic from frameworks—but Hexagonal is more infrastructure-centric.

When should I use Domain-Driven Design for backend systems?

Use DDD when modeling complex business domains where shared understanding between developers and domain experts is critical. It provides entities, value objects, and aggregates to express business rules explicitly and maintain a cohesive, resilient core.

How do I refactor a monolithic Python application into modular architecture?

Apply layered architecture with FastAPI, Pydantic for validation, and repository interfaces to decouple your data layer. Gradually extract bounded contexts, define clear dependencies, and migrate infrastructure concerns away from business logic using ports-and-adapters patterns.

Can I apply these architecture patterns to an existing FastAPI project?

Yes. FastAPI works well with Clean and Hexagonal patterns. Use Pydantic models for domain entities, define repository interfaces with asyncpg for data access, and structure your use cases as separate service layers to progressively improve maintainability without rewriting everything.

What are the key limitations of layered architecture?

Strict layering can create coupling across layers and slow development if not carefully managed. Service layer bloat and database schema dependencies are common pitfalls. Mitigate these by enforcing inward-only dependencies, using aggregates to define boundaries, and keeping infrastructure concerns isolated.