tsentials-entity

Create DDD aggregate roots with audit tracking, soft deletion, and domain events in TypeScript.

49|Updated May 12, 2026
One-click install
npx skills add https://github.com/senrecep/tsentials --skill tsentials-entity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tsentials-entity
Source: https://github.com/senrecep/tsentials/tree/main/.well-known/agent-skills/tsentials-entity
Command: npx skills add https://github.com/senrecep/tsentials --skill tsentials-entity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create consistent DDD aggregate roots without boilerplate for audit fields, soft deletion lifecycle, or domain event collection and dispatch.

Core Features & Use Cases

  • Aggregate root audit tracking: Use createEntityBase() to add created/updated timestamps and user attribution alongside a domain events queue.
  • Soft deletion lifecycle: Use createSoftDeletable() to support isDeleted/isHardDeleted plus deletedAt/deletedBy, including restore.
  • Domain events via composition: Define and raise domain events from your entity methods using a DomainEvent marker interface with occurredOn.

Quick Start

Create an aggregate root by composing createEntityBase() and createSoftDeletable() inside your entity, then delegate getters and methods to expose audit, domainEvents, and soft-delete behavior.

Frequently Asked Questions about tsentials-entity

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

FAQPage Schema
How do I implement a DDD aggregate root with audit fields in TypeScript?

To implement soft deletion in a TypeScript DDD entity, use the createSoftDeletable() mixin to support isDeleted/isHardDeleted flags, deletedAt/deletedBy metadata, and restore semantics directly within your aggregate root methods.

How do I collect and raise domain events from a TypeScript entity?

To collect and raise domain events from a TypeScript entity, define events using a DomainEvent marker interface that includes an occurredOn timestamp, then queue them via the aggregate root's event collection for downstream publishing.

What is the best way to add soft delete and restore semantics to a TypeScript domain model?

The best way to add soft delete and restore semantics to a TypeScript domain model is composing the createSoftDeletable() factory into your entity, which manages deletion state tracking and restoration logic consistently across aggregates.

Can I use composition to build TypeScript entities with domain events and soft delete?

Yes, you can use composition to build TypeScript entities by delegating createEntityBase() and createSoftDeletable() inside your class, exposing audit tracking, domain event collection, and soft-deletion behavior through delegated getters and methods.

Do I need external dependencies to manage DDD aggregate roots and domain events in TypeScript?

No, you do not need external dependencies to manage DDD aggregate roots and domain events in TypeScript, as this functionality is provided through self-contained mixin-factory composition without any external library requirements.