add-entity

Add an EF Core-backed domain entity to a FullStackHero module with migration guidance.

6.7k|2.0k|Updated Aug 20, 2021
One-click install
npx skills add https://github.com/fullstackhero/dotnet-starter-kit --skill add-entity-fullstackhero
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-entity
Source: https://github.com/fullstackhero/dotnet-starter-kit/tree/main/.agents/skills/add-entity
Command: npx skills add https://github.com/fullstackhero/dotnet-starter-kit --skill add-entity-fullstackhero

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you add a new database-backed domain entity/aggregate to an existing FullStackHero (FSH) module by defining the aggregate, its domain event(s), its EF Core configuration, and the migration workflow in a consistent, framework-compatible way.

Core Features & Use Cases

  • Rich domain aggregate: Generates a sealed aggregate root with a private EF constructor, a static factory, behavior via methods, and domain event raising.
  • Framework-aligned persistence rules: Adds an EF Core configuration that follows the kit’s conventions for table mapping, required constraints, value objects, and soft-delete/tenant behavior (without manual query filters).
  • Migration-ready workflow: Guides you to create the proper EF migration using the correct contexts so the entity is actually persisted.

Quick Start

Use the add-entity skill to create a new entity for an existing FSH module by providing the module name and the entity name as inputs.

Frequently Asked Questions about add-entity

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

FAQPage Schema
How do I add a new EF Core entity to an existing dotnet module with domain events?

To add a new EF Core entity, define a sealed AggregateRoot<Guid> with a private EF constructor, static factory, behavior methods, and domain event raising, then apply framework-aligned EF Core configuration without manual tenant or soft-delete query filters.

What is the best way to configure multitenancy and soft delete for a new Entity Framework Core aggregate?

Configuring multitenancy and soft delete for an Entity Framework Core aggregate requires using the kit's EF Core configuration conventions for table mapping and constraints, deliberately avoiding manual query filters for tenant or soft-delete behavior.

Do I need a private constructor when creating a domain-driven design aggregate root with EF Core?

Yes, creating a domain-driven design aggregate root with EF Core requires a private EF constructor to ensure encapsulation, alongside a static factory for instantiation and behavior driven through methods rather than public property setters.

How do I create a PostgreSQL migration for a new domain entity using the target DbContext?

Creating a PostgreSQL migration for a new domain entity involves running the EF Core migration workflow using the specified PostgreSQL migrations project and the target DbContext to ensure the new aggregate is persisted correctly.

Can I use manual query filters for tenant and soft delete behaviors in EF Core configurations?

No, you should not use manual query filters for tenant and soft delete behaviors in EF Core configurations; the framework handles these automatically through its marker-interface-driven conventions and base entity configurations.

Why should domain events be raised via the kit's DomainEvent helpers when adding an entity?

Domain events should be raised via the kit's DomainEvent helpers when adding an entity to maintain consistency with the framework's domain-driven design architecture and ensure production-grade event handling within the aggregate root.