ddd-primitives

Implement domain-driven design primitives with value objects, specifications, and state machines.

1|Updated Feb 28, 2024
One-click install
npx skills add https://github.com/Sparkymod/Template --skill ddd-primitives
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ddd-primitives
Source: https://github.com/Sparkymod/Template/tree/main/.claude/skills/ddd-primitives
Command: npx skills add https://github.com/Sparkymod/Template --skill ddd-primitives

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill aids in implementing advanced Domain-Driven Design patterns and practices, addressing invariants, value objects, specifications, aggregate roots, domain events, and state machines, ensuring robust and maintainable domain logic.

Core Features & Use Cases

  • Value Object Modeling: Offers a template for value objects with structural equality, ideal for concepts with real invariants.
  • Specification Implementation: Provides a mechanism for composable business rules that run both in-memory and in SQL.
  • Strongly Typed Ids: Helps eliminate primitive obsession in id management.
  • Aggregate Root and Domain Events: Facilitates the creation of entities that own invariants and can react to changes.
  • StateMachine: Enables guarded state transitions without exceptions, suitable for entities with complex status fields.
  • Use Case: Use this Skill when building a complex system that requires strict enforcement of business rules and domain logic.

Quick Start

Apply the 'ddd-primitives' skill to an entity that requires value objects, specifications, and state management.

Frequently Asked Questions about ddd-primitives

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement domain-driven design value objects with structural equality in my entities?

Domain-driven design value objects with structural equality are implemented using provided templates that define concepts with real invariants. These templates ensure robust domain logic by enforcing validation rules directly within the value object structure.

How do I enforce business rules in-memory and SQL using the specification pattern?

The specification pattern enforces business rules by providing a composable mechanism that runs both in-memory and SQL. This allows complex domain logic to validate invariants consistently across different query layers.

How do I manage guarded state transitions for complex entities without throwing exceptions?

Guarded state transitions for complex entities are managed by implementing a state machine that enables transitions without exceptions. This approach suits entities with complex status fields requiring strict invariant enforcement.

Can I use aggregate roots and domain events to react to state changes in complex systems?

Aggregate roots and domain events facilitate creating entities that own invariants and react to changes. This pattern targets complex systems requiring robust domain logic and strict enforcement of business rules.

What is the best way to eliminate primitive obsession when managing entity identifiers?

Eliminating primitive obsession in identifier management is achieved by implementing strongly typed ids. This approach wraps raw identifier values, ensuring type safety and preventing invalid id assignments across the domain model.

When do I need advanced domain-driven design patterns for my application logic?

Advanced domain-driven design patterns are needed when building complex systems that require strict enforcement of business rules and domain logic. Use them to address invariants, aggregate roots, and state machines for maintainable logic.