ddd-entity-generator

Generate TypeScript domain components with private constructors and factory methods.

5|1|Updated Oct 29, 2025
One-click install
npx skills add https://github.com/moasadi/ddd-bun-api-boilerplate --skill ddd-entity-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ddd-entity-generator
Source: https://github.com/moasadi/ddd-bun-api-boilerplate/tree/main/.claude/skills/ddd-entity-generator
Command: npx skills add https://github.com/moasadi/ddd-bun-api-boilerplate --skill ddd-entity-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill generates domain layer components such as entities, value objects, repository interfaces, domain events, and domain errors, all without framework dependencies.

Core Features & Use Cases

  • Entities: Private constructors with factory methods and getters
  • Value Objects: Immutable types with validation
  • Repository Interfaces: Domain-level persistence contracts
  • Domain Events: Immutable event classes for state changes
  • Domain Errors: Business-specific error types with codes

Quick Start

Create a Customer entity with Email and PhoneNumber value objects, plus a CustomerRepository interface.

Frequently Asked Questions about ddd-entity-generator

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

FAQPage Schema
How do I generate domain entities with value objects for Domain-Driven Design?

This Skill generates domain entities with private constructors, factory methods, and getters, paired with immutable value objects for validation. It produces TypeScript abstractions without framework dependencies, enabling you to model domain concepts like Customer entities with Email and PhoneNumber value objects in a single workflow.

Can I generate repository interfaces and domain events without framework dependencies?

Yes. This Skill creates domain-level repository interfaces and immutable domain event classes that capture state changes, all as plain TypeScript abstractions with zero framework imports. You get clean contracts for persistence and event handling aligned to DDD principles.

What's the best way to model domain-specific errors in TypeScript?

This Skill generates domain error types with business-specific codes and error messages as first-class domain abstractions. This approach ensures errors are modeled as domain concepts rather than generic exceptions, improving clarity and handling across your application layer.

Do I need to write validation logic separately from my entity definitions?

No. This Skill embeds validation into factory methods during entity and value object generation, ensuring invalid state cannot be constructed. Validation happens at creation time as part of the domain layer contract.

Can I use this Skill to add new entities to an existing Domain-Driven Design context?

Yes. This Skill is designed for incremental entity addition to existing contexts, generating entities, value objects, repository interfaces, and domain events that integrate with your established domain model without requiring framework changes or existing code modification.

What makes value objects immutable in the generated code?

Generated value objects are immutable by design—properties are read-only and exposed only through getters. This prevents accidental state mutation and ensures value objects maintain their identity through immutability, a core DDD pattern.