architecture-patterns

Apply Clean, Hexagonal, and Domain-Driven Design patterns to structure backend services.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Business logic often becomes entangled with frameworks, ORM models, and HTTP concerns, making codebases untestable and hard to refactor. This Skill provides concrete patterns and code examples for separating domain logic from infrastructure so services stay maintainable and testable. ## Core Features & Use Cases - Layered Architecture Guidance: Apply Clean Architecture, Hexagonal Architecture (ports and adapters), and Onion Architecture with clear dependency rules pointing inward. - DDD Tactical Patterns: Implement entities, value objects, aggregates, repositories, and domain events with validated invariants and consistency boundaries. - Testable Design: Write use-case tests with in-memory adapters that require no database, Docker, or network. - Use Case: When refactoring a monolith where controllers contain business logic, use this Skill to extract use cases, define repository ports, and wire implementations through a DI container. ## Quick Start Ask the agent to design a new backend service using Clean Architecture with a user registration use case and an in-memory repository test.

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 domain (entities, value objects, interfaces), use_cases (application rules), adapters (repositories, controllers), and infrastructure (config, DI). Every import in domain and use_cases must point only toward domain, never toward adapters or infrastructure.

What is the difference between Hexagonal Architecture and Clean Architecture?

Both enforce inward-pointing dependencies. Hexagonal Architecture emphasizes ports (abstract interfaces) and adapters (concrete implementations) around a domain core, while Clean Architecture defines four rings: entities, use cases, interface adapters, and frameworks.

How do I test use cases without a database?

Inject an in-memory implementation of the repository port into the use case constructor. The use case must depend on the abstract interface, not a concrete class like PostgresUserRepository, so tests need no Docker or network.

Why do I get circular imports between use cases and adapters?

Circular imports happen when a use case imports a concrete adapter class instead of the abstract port. Define the interface in domain/interfaces, have adapters implement it, and wire them together in the infrastructure DI container.

When should I use an Anti-Corruption Layer?

Use an ACL when one bounded context must consume another context's model, such as Ordering fetching Catalog product data. The ACL translates the upstream model into the downstream context's own value objects, preventing foreign domain concepts from leaking in.

How do I decide aggregate boundaries in DDD?

Put objects that must be consistent together in the same aggregate; use domain events for eventually consistent relationships. The root controls access, and if you load thousands of objects to change one, the aggregate is too large and should be split.