ManageEntity

Define Dart/Flutter domain entity patterns with constructors, factories, and validation.

1|Updated Sep 22, 2025
One-click install
npx skills add https://github.com/pretodev/nice_app --skill manageentity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ManageEntity
Source: https://github.com/pretodev/nice_app/tree/main/.trae/skills/ManageEntity
Command: npx skills add https://github.com/pretodev/nice_app --skill manageentity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guidelines for creating, maintaining, and modifying domain entities in the odu_core project.

Core Features & Use Cases

  • Identity type selection and guidance for choosing between GuidEntity, SerialEntity, and Entity<T>, including recommended ID patterns (GuidEntity.newId(), SerialEntity.unsavedId) and when to use each.
  • Required structure and patterns: a public constructor receiving all fields, creation factories, encapsulation of internal state, domain methods, and clear update semantics.
  • Validation and documentation practices: overriding validate(), defining domain-specific failures, and documenting non-obvious rules and side effects.

Quick Start

Model a new domain entity by defining a public constructor with all fields, add a creation factory, enforce encapsulation, and implement validate() with your invariants.

Frequently Asked Questions about ManageEntity

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

FAQPage Schema
How do I define domain entities in Dart with proper encapsulation and validation?

To define domain entities in Dart, use a public constructor for all fields, add creation factories, encapsulate internal state, and override the validate() method to enforce invariants and handle domain-specific failures.

When should I use GuidEntity versus SerialEntity for domain entity identity types?

Use GuidEntity.newId() for generating unique identifiers in distributed systems, and SerialEntity.unsavedId for entities relying on database-generated sequential IDs during domain entity creation.

What is the best way to structure factories and constructors for Flutter domain entities?

The best way to structure Flutter domain entities is by defining a required public constructor receiving all fields, supplemented by creation factories that handle initial state generation and ensure valid object instantiation.

How do you handle state changes and updates in Dart domain entities without breaking encapsulation?

Handle state changes in Dart domain entities by exposing domain methods for modifications, ensuring internal state encapsulation, and validating all invariants through the validate() method before applying updates.

Does this domain entity pattern require specific base classes for Flutter projects?

Yes, the domain entity pattern requires selecting appropriate base classes like Entity<T>, GuidEntity, or SerialEntity to establish identity, structure, and validation consistency across your bounded contexts.

Why does my domain entity validation fail when using custom creation factories in Dart?

Domain entity validation fails when creation factories bypass required invariants; ensure your Dart factories initialize all fields correctly and that the overridden validate() method properly checks domain-specific failures.