
Architecture Patterns
Structure a growing product into bounded contexts, onion layers, and service folders so agents and humans do not entangle domains.
Overview
architecture-patterns is an agent skill most often used in Build (also Validate scope, Operate infra) that documents DDD, onion, and anti-corruption layouts for multi-service backends.
Install
npx skills add https://github.com/wshobson/agents --skill architecture-patternsWhat is this skill?
- Reference layouts for multi-service ecommerce with identity, catalog, and related bounded contexts
- Domain entities, value objects, and repository interfaces separated from adapters and infrastructure
- Use-case layer examples (register_user, authenticate_user) decoupled from HTTP controllers
- Onion Architecture and Anti-Corruption Layer guidance for integrating legacy or external systems
- Per-context test folders (unit vs integration) baked into the suggested tree
Adoption & trust: 16.7k installs on skills.sh; 36.5k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your codebase is a tangle of routes and models and every agent edit risks crossing business boundaries you never named.
Who is it for?
Solo builders scaling a SaaS or marketplace from monolith toward services who want opinionated DDD/onion examples agents can follow.
Skip if: Throwaway prototypes, single-file scripts, or teams that have already standardized on one framework doc and do not want DDD ceremony.
When should I use this skill?
You are designing or refactoring a multi-module backend and need DDD, onion, ACL, or full project structure examples referenced during agent implementation.
What do I get? / Deliverables
You adopt a bounded-context folder structure with domain, use cases, adapters, and tests so new features land in the right service layer.
- Proposed directory tree per bounded context
- Layer placement for entities, use cases, adapters, and infrastructure
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Primary shelf is Build/backend because the artifact is service and domain layout; the same patterns inform earlier scoping and later operational boundaries. DDD, repositories, use cases, and adapters are backend architecture concerns even when they span multiple deployable services.
Where it fits
Decide whether catalog and billing belong in separate bounded contexts before you commit to repos.
Scaffold identity service with domain entities, use cases, and postgres adapters agents can extend.
Map deploy units to services/ folders so monitoring and ownership align with contexts.
How it compares
Architecture reference skill—not a scaffold CLI and not a code review checker by itself.
Common Questions / FAQ
Who is architecture-patterns for?
Indie and small-team backend builders using AI agents who need consistent DDD and onion patterns across services.
When should I use architecture-patterns?
Use it in Validate (scope) when splitting domains; in Build (backend) when laying out repos; and in Operate (infra) when aligning deployable service folders with team mental models.
Is architecture-patterns safe to install?
It is documentation and examples only; confirm trust via the Security Audits panel on this Prism page before adding skills from external repos.
SKILL.md
READMESKILL.md - Architecture Patterns
# Advanced Architecture Patterns — Reference Deep-dive implementation examples for DDD bounded contexts, Onion Architecture, Anti-Corruption Layers, and full project structures. Referenced from SKILL.md. --- ## Full Multi-Service Project Structure A realistic e-commerce system organised by bounded context, each context is a deployable service: ``` ecommerce/ ├── services/ │ ├── identity/ # Bounded context: users & auth │ │ ├── identity/ │ │ │ ├── domain/ │ │ │ │ ├── entities/ │ │ │ │ │ └── user.py │ │ │ │ ├── value_objects/ │ │ │ │ │ ├── email.py │ │ │ │ │ └── password_hash.py │ │ │ │ └── interfaces/ │ │ │ │ └── user_repository.py │ │ │ ├── use_cases/ │ │ │ │ ├── register_user.py │ │ │ │ └── authenticate_user.py │ │ │ ├── adapters/ │ │ │ │ ├── repositories/ │ │ │ │ │ └── postgres_user_repository.py │ │ │ │ └── controllers/ │ │ │ │ └── auth_controller.py │ │ │ └── infrastructure/ │ │ │ └── jwt_service.py │ │ └── tests/ │ │ ├── unit/ │ │ └── integration/ │ │ │ ├── catalog/ # Bounded context: products │ │ ├── catalog/ │ │ │ ├── domain/ │ │ │ │ ├── entities/ │ │ │ │ │ └── product.py │ │ │ │ └── value_objects/ │ │ │ │ ├── sku.py │ │ │ │ └── price.py │ │ │ └── use_cases/ │ │ │ ├── create_product.py │ │ │ └── update_inventory.py │ │ └── tests/ │ │ │ └── ordering/ # Bounded context: orders │ ├── ordering/ │ │ ├── domain/ │ │ │ ├── entities/ │ │ │ │ └── order.py │ │ │ ├── value_objects/ │ │ │ │ ├── customer_id.py # NOT imported from identity! │ │ │ │ └── money.py │ │ │ └── interfaces/ │ │ │ ├── order_repository.py │ │ │ └── catalog_client.py # ACL port to catalog context │ │ ├── use_cases/ │ │ │ ├── place_order.py │ │ │ └── cancel_order.py │ │ └── adapters/ │ │ ├── acl/ │ │ │ └── catalog_http_client.py # ACL adapter │ │ └── repositories/ │ │ └── postgres_order_repository.py │ └── tests/ │ ├── shared/ # Shared kernel (use sparingly) │ └── domain_events/ │ └── base_event.py └── docker-compose.yml ``` --- ## Onion Architecture vs. Clean Architecture Both enforce inward-pointing dependencies. The difference is terminology and layering granularity: | Concern | Clean Architecture | Onion Architecture | |---|---|---| | Innermost ring | Entities | Domain Model | | Second ring | Use Cases | Domain Services | | Third ring | Interface Adapters | Application Services | | Outermost ring | Frameworks & Drivers | Infrastructure / UI / Tests | | Key insight | Controller is an adapter | Application Services = Use Cases | Onion Architecture makes the Domain Services layer explicit — it hosts pure domain logic that spans multiple entities but has no I/O: ```python # onion/domain/services/pricing_service.py from domain.entities.product import Product from domain.value_objects.money import Money from domain.value_objects.discount import Discount class PricingService: """ Domain service: logic that doesn't belong to a single entity. No ports or adapters here — purely domain computation. """ def apply_bulk_discount(self, product: Product, quantity: int) -> Money: if quantity >= 100: discount = Discount(percentage=20) elif quantity >= 50: discount = Discount(percentage=10) else: discount = Discount(percentage=0) return product.price.apply_discount(discount) def calculate_order_total(self, items: list[tuple[Product, int]]) -> Money: subtotals = [self.apply_bulk_discount(p, q) for p,