agentleFS
andy-dendy-repoandy-dendy-repo/govern/.claude/skills/add-entity/SKILL.md

add-entity

Skill2 starsChanged 32 days agoMITView on GitHub

Adds a Govern domain entity with its EF Core configuration, DbSet and migration (and optional domain event). Use when a feature needs a new table/aggregate or child entity ("store X", "add an Order entity").

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. fullstackhero/dotnet-starter-kit★ 6.9ksame name
    2. aiqadam/qadam-flow★ 5same name
    3. jpoindexter/theft-kit★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run inside /develop-feature.

    line 10
  2. Very specific:

    Read first: persistence.md, mapping.md, and architecture.md (the Domain template).

    line 12
  3. Distinctive:

    No EF, ASP.NET or DTO types in Domain (arch test).

    line 19
  4. Very specific:

    Run /add-migration with a name like Add[Names].

    line 32
  5. Very specific:

    Document the entity (fields, invariants, events) in docs/features/[feature].md.

    line 36
  6. Very specific:

    Run dotnet build Govern.slnx, then dotnet test Govern.slnx.

    line 40

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Add an entity

Run inside /develop-feature. Reference implementation: src/Govern.Domain/Entities/User.cs (aggregate root) and RefreshToken.cs (child created only through the root), src/Govern.Infrastructure/Persistence/Configurations/UserConfiguration.cs.

Read first: persistence.md, mapping.md, and architecture.md (the Domain template).

1. Domain: src/Govern.Domain/Entities/[Name].cs

  • Derive from BaseAuditableEntity (or BaseEntity when timestamps make no sense). The Guid v7 Id comes from the base.
  • sealed class with a private parameterless constructor for EF and private set properties. Initialise strings to string.Empty.
  • Creation: a static factory (public static Order Create(...)) that validates invariants with guard clauses and raises a domain event if something should react.
  • Changes: go through intention-revealing methods (Rename, Close). Keep children in private readonly List<T> exposed as IReadOnlyCollection<T>; children are created and changed only through the root (use internal members on the child).
  • No EF, ASP.NET or DTO types in Domain (arch test).
  • Optional event: src/Govern.Domain/Events/[Name][Happened]Event.cs as a sealed record ... : BaseEvent, with a handler in src/Govern.Application/[Feature]/EventHandlers/[Event]Handler.cs (internal sealed, INotificationHandler<TEvent>).

2. Persistence

  1. src/Govern.Application.Common/Abstractions/IApplicationDbContext.cs: add a DbSet<[Name]> [Names] { get; } with an XML summary.
  2. src/Govern.Infrastructure/Persistence/ApplicationDbContext.cs: add public DbSet<[Name]> [Names] => Set<[Name]>();.
  3. src/Govern.Infrastructure/Persistence/Configurations/[Name]Configuration.cs: an internal sealed class implementing IEntityTypeConfiguration<[Name]>.
    • The key.
    • A max length on every string.
    • Required columns.
    • Unique indexes for business keys.
    • Foreign keys with explicit OnDelete, and an index on each.
    • Backing-field navigations with UsePropertyAccessMode(PropertyAccessMode.Field).
  4. Run /add-migration with a name like Add[Names].

3. Tests and docs

  • Integration tests exercise the entity through the endpoints of the use cases that need it (/add-use-case). There are no unit tests for Domain or Application.
  • Document the entity (fields, invariants, events) in docs/features/[feature].md.
  • Optionally run the ef-core-specialist agent on the change.

4. Check

Run dotnet build Govern.slnx, then dotnet test Govern.slnx. The architecture tests check the base type, the folder, the naming and the Domain dependencies.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.