Skills architecture-patterns
📦

architecture-patterns

Safe

Implement Backend Architecture Patterns

Also available from: Barnhardt-Enterprises-Inc,AdamManuel-dev

Building maintainable backend systems requires proven architecture patterns. This skill helps you implement Clean Architecture, Hexagonal Architecture, and Domain-Driven Design to create testable, scalable applications with proper separation of concerns.

Supports: Claude Codex Code(CC)
📊 71 Adequate
1

Download the skill ZIP

2

Upload in Claude

Go to Settings → Capabilities → Skills → Upload skill

3

Toggle on and start using

Test it

Using "architecture-patterns". Create a Clean Architecture structure for a user management system

Expected outcome:

The skill generates a complete directory structure with domain/entities containing User entity, domain/interfaces with IUserRepository port, use_cases containing CreateUserUseCase and UpdateUserUseCase, adapters/repositories with PostgresUserRepository implementation, and adapters/controllers with UserController for HTTP handling. Each component demonstrates proper dependency flow and separation of concerns.

Using "architecture-patterns". Implement a payment gateway adapter using hexagonal architecture

Expected outcome:

The skill creates a PaymentGatewayPort interface defining the charge method contract, then implements both StripePaymentAdapter for production and MockPaymentAdapter for testing. Both adapters implement the same port interface, allowing easy swapping without changing business logic. The example includes error handling and proper async/await patterns.

Using "architecture-patterns". Design an Order aggregate with DDD patterns

Expected outcome:

The skill designs an Order entity as aggregate root with add_item, calculate_total, and submit methods encapsulating business rules. It includes OrderItem entity, Money value object for currency handling, OrderStatus enum for state management, and domain events like OrderSubmittedEvent. The aggregate enforces invariants and maintains consistency boundaries.

Security Audit

Safe
v5 • 1/21/2026

All 43 static analysis findings are false positives from educational code examples in documentation. The skill teaches software architecture patterns through Python examples showing Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. No executable code, network access, or security vulnerabilities present.

2
Files scanned
909
Lines analyzed
0
findings
5
Total audits
No security issues found
Audited by: claude View Audit History →

Quality Score

38
Architecture
100
Maintainability
87
Content
31
Community
100
Security
91
Spec Compliance

What You Can Build

Design New Backend Service Architecture

Plan and implement a new microservice using Clean Architecture principles with proper layer separation, dependency injection, and testable business logic.

Refactor Monolithic Application

Transform a tightly coupled monolithic application into a well-structured hexagonal architecture with ports and adapters for easier testing and maintenance.

Implement Domain-Driven Design Patterns

Model complex business domains using DDD tactical patterns including aggregates, entities, value objects, and domain events for better domain alignment.

Try These Prompts

Generate Clean Architecture Structure
Create a Clean Architecture folder structure for an e-commerce order management system with domain entities, use cases, and adapters.
Implement Repository Port and Adapter
Implement a user repository port interface and PostgreSQL adapter following hexagonal architecture principles with async database access.
Create Domain Entities with Business Logic
Design an Order aggregate with domain entities, value objects, and business rules for adding items, calculating totals, and state transitions.
Refactor Controller to Use Case Pattern
Refactor this FastAPI endpoint that has business logic in the controller into a proper use case with dependency injection and separation of concerns.

Best Practices

  • Always point dependencies inward from outer layers to inner layers, never let domain layer depend on infrastructure
  • Use interfaces and ports to define contracts in the domain layer, implement adapters in outer layers for testability
  • Keep business logic in domain entities and use cases, controllers should only handle HTTP concerns and delegate to use cases

Avoid

  • Placing business logic in controllers or API handlers instead of use cases and domain entities
  • Creating anemic domain models with only data properties and no behavior, putting all logic in services
  • Tightly coupling domain layer to specific frameworks, databases, or external APIs without abstraction interfaces

Frequently Asked Questions

When should I use Clean Architecture versus simpler patterns?
Use Clean Architecture for complex business logic with multiple integrations and long-term maintenance needs. Simple CRUD applications with basic workflows may not benefit from the additional abstraction layers. Consider the trade-off between maintainability and simplicity based on your project complexity.
How does hexagonal architecture differ from Clean Architecture?
Both enforce dependency inversion and separation of concerns. Clean Architecture emphasizes concentric layers with strict dependency rules flowing inward. Hexagonal Architecture focuses on ports and adapters where the domain core is surrounded by interchangeable adapters. They are complementary approaches often used together.
What is the difference between entities and value objects in DDD?
Entities have unique identity and lifecycle, two entities with same attributes are still different if IDs differ. Value objects are defined by their attributes and are immutable, two value objects with same attributes are considered equal. Use entities for things that change over time, value objects for descriptive characteristics.
How do I test use cases that depend on repositories and external services?
Use dependency injection to provide mock implementations of repository and service interfaces. Create test doubles that implement the same port interfaces but return controlled data instead of accessing real databases or APIs. This allows testing business logic in isolation without infrastructure dependencies.
Can I apply these patterns to existing codebases or only new projects?
You can incrementally refactor existing code toward these patterns. Start with one module or feature, extract business logic into use cases, create repository interfaces, and implement adapters. Gradual migration is safer than full rewrites. Focus on high-change areas first for maximum benefit.
Does this skill work with frameworks other than FastAPI and PostgreSQL?
The principles apply to any framework or database. Examples use FastAPI and PostgreSQL for demonstration, but the same patterns work with Django, Flask, Express, MongoDB, MySQL, or other technologies. The key is keeping framework-specific code in outer adapter layers separate from business logic.

Developer Details

File structure

📄 SKILL.md