What problem does it solve?
Poorly designed data models can lead to tightly coupled code, difficult maintenance, and a lack of clarity in business logic, hindering scalability and developer productivity. This Skill promotes robust domain-driven design patterns for backend models.
Core Features & Use Cases
- Domain Entities: Implement rich domain models with private constructors and static
create() factory methods, ensuring valid state upon creation.
- DTO Management: Create clear request and response Data Transfer Objects (DTOs) with validation decorators and static
from() methods for easy data transformation.
- Mapper Integration: Seamlessly convert between Prisma entities and domain objects using dedicated mapper classes, maintaining separation of concerns.
- Value Objects: Utilize value objects (e.g.,
ArticleContent) for complex attributes, enhancing type safety and encapsulating domain logic.
- Use Case: When defining a new
Product domain entity, ensure it has a private constructor, a static create() factory method, and uses value objects for complex attributes like Price and Dimensions, adhering to DDD principles.
Quick Start
Help me define a new Category domain entity with an id and name property, ensuring it follows the static factory method pattern and uses a private constructor.