create-ef-configuration

Generates EF Core IEntityTypeConfiguration classes with TypedId conversions and owned types.

Updated Nov 19, 2020
One-click install
npx skills add https://github.com/kwojtasinski-repo/ECommerceApp --skill create-ef-configuration-kwojtasinski-repo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-ef-configuration
Source: https://github.com/kwojtasinski-repo/ECommerceApp/tree/main/.github/skills/create-ef-configuration
Command: npx skills add https://github.com/kwojtasinski-repo/ECommerceApp --skill create-ef-configuration-kwojtasinski-repo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing EF Core entity configurations by hand is repetitive and error-prone, especially when a project enforces strict conventions like TypedId conversions, value object mappings, decimal precision, and required string lengths. This Skill scaffolds a complete IEntityTypeConfiguration<T> class that follows those conventions exactly. ## Core Features & Use Cases - Convention-Compliant Scaffolding: Generates an internal sealed configuration class placed in the correct Infrastructure module path with proper table naming. - Conversion Pattern Library: Covers TypedId (int and string based), single-value value objects, Price/Money with HasPrecision(18, 4), enums stored as strings, and owned types in the same or separate tables. - Use Case: After adding a new Product entity to the Catalog bounded context, ask the assistant to create its EF configuration and receive a ready-to-use class with key conversion, unique indexes, and owned type mappings matching project rules. ## Quick Start Ask the assistant to create an EF configuration for your entity, for example: create an EF configuration for the Product entity in Catalog/Products.

Frequently Asked Questions about create-ef-configuration

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

FAQPage Schema
How do I create an EF Core IEntityTypeConfiguration class?

Implement IEntityTypeConfiguration<T> with a Configure method that sets the table name, primary key, property conversions, and indexes. This Skill scaffolds the full class following project conventions like internal sealed visibility and pluralized table names.

How to map a strongly typed ID in EF Core?

Use a value conversion on the key property: .HasConversion(x => x.Value, v => new XxxId(v)) with ValueGeneratedOnAdd for int-based IDs. String-based TypedIds also need HasMaxLength(450). Every TypedId must have an explicit conversion rather than relying on convention.

Can EF Core map value objects and owned types?

Yes. Single-value value objects use HasConversion, while complex value objects use OwnsOne, either inline in the same table or mapped to a separate table with ToTable and WithOwner().HasForeignKey. Required owned navigations also need builder.Navigation(e => e.X).IsRequired().

What precision should decimal properties use in EF Core?

This project's convention requires HasPrecision(18, 4) on every decimal property, including Price and Money value objects converted via their Amount property. Omitting precision causes EF Core warnings and potential truncation in SQL Server.

Where should EF configuration classes be placed in a modular monolith?

Place them under ECommerceApp.Infrastructure/<Module>/<BC>/Configurations/ named {EntityName}Configuration.cs. The class should be internal sealed and live in the matching ECommerceApp.Infrastructure.{InfraNamespace}.Configurations namespace.