Imported from fpindej/netrock (
.claude/skills/new-entity/SKILL.md). Install upstream withnpx skills add fpindej/netrock --skill new-entity. Copyright stays with the author.
Creates a new backend entity with EF Core configuration and migration.
Infers entity name, properties, feature name, and enum values from context. Asks only if the entity's purpose or key properties are genuinely ambiguous.
Templates
Use these as starting points - fill in the specifics from context:
Conventions
- Boolean properties: Use
Is*prefix in C# (e.g.IsUsed,IsInvalidated) per .NET convention, but map to prefix-free DB column names viaHasColumnName(e.g.Used,Invalidated) to keep the schema clean.
Steps
Domain:
- Create
src/backend/MyProject.Domain/Entities/{Entity}.cs:- Extend
BaseEntity, private setters, protected parameterless ctor, public ctor withId = Guid.NewGuid()
- Extend
- If enums: create alongside entity with explicit integer values
- Add
Errorentries (snake_case code + message) tosrc/backend/MyProject.Shared/ErrorMessages.cs
Infrastructure:
- Create EF config
Infrastructure/Features/{Feature}/Configurations/{Entity}Configuration.cs:- Extend
BaseEntityConfiguration<T>, markinternal,.HasComment()on enum columns - For boolean properties: map with
.HasColumnName("PrefixFree")to keep DB schema clean
- Extend
- Add
DbSet<{Entity}>toInfrastructure/Persistence/MyProjectDbContext.cs - Run migration:
dotnet ef migrations add Add{Entity} \ --project src/backend/MyProject.Infrastructure \ --startup-project src/backend/MyProject.WebApi \ --output-dir Persistence/Migrations
Dockerfile:
- If a new project was added that WebApi references, add its
.csprojCOPY line to the Dockerfile restore layer - otherwisedotnet restorefails in Docker builds.
Verify and commit:
dotnet build src/backend/MyProject.slnx- fix errors, loop until green- Commit:
feat({feature}): add {Entity} entity and EF configuration
This skill stops at Infrastructure. Use
/new-endpointto add service, controller, and API surface.