architecture-patterns

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

Updated Jun 12, 2026
One-click install
npx skills add https://github.com/bilacchi/agents-skills --skill architecture-patterns-bilacchi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: architecture-patterns
Source: https://github.com/bilacchi/agents-skills/tree/main/skills/architecture-patterns
Command: npx skills add https://github.com/bilacchi/agents-skills --skill architecture-patterns-bilacchi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing backend systems without clear architectural boundaries leads to tightly coupled code, untestable business logic, and painful refactoring. This Skill provides proven architecture patterns and implementation guidance to build maintainable, testable, and scalable backend systems. ## Core Features & Use Cases - Clean Architecture Guidance: Layered structure with entities, use cases, adapters, and infrastructure, enforcing the dependency rule so business logic stays framework-independent. - Hexagonal Architecture (Ports & Adapters): Define ports as interfaces and swap adapters (e.g., Stripe vs. mock payment gateways) for testing and flexibility. - Domain-Driven Design: Tactical patterns including entities, value objects, aggregates, repositories, and domain events, plus strategic patterns like bounded contexts. - Use Case: When refactoring a monolithic order-processing application, use this Skill to define module boundaries, extract domain entities with business rules, and create repository interfaces so the core logic can be tested without a database. ## Quick Start Ask the AI to design a Clean Architecture structure for a new backend service, including domain entities, use cases, and repository interfaces.

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

Organize code into four layers: domain (entities and interfaces), use_cases (application business rules), adapters (repository and controller implementations), and infrastructure (database, config). Dependencies must point inward so the domain never imports framework code.

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

Both isolate business logic from infrastructure. Clean Architecture uses concentric layers with an inward dependency rule, while Hexagonal Architecture centers the domain and connects external concerns through ports (interfaces) and adapters (implementations).

How do I make business logic testable without a database?▼

Define repository and gateway interfaces (ports) in the domain layer, then inject mock adapters in tests. Use cases depend only on these abstractions, so they run without PostgreSQL, Stripe, or other external services.

When should I not use Clean Architecture or DDD?▼

Avoid these patterns for simple CRUD applications, small localized refactors, or frontend-only work. Full layered architecture adds overhead that is not justified when there is little domain complexity or business logic.

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

Common pitfalls include anemic domain models (entities with data but no behavior), business logic leaking into controllers, exposing ORM objects through repositories, and missing bounded contexts. Keep behavior inside entities and enforce invariants in aggregate roots.