Skip to content
Development
Agent

entity-generator

Generates Entity Framework Core entities with proper configuration

From plugin
f5-framework
24104 skills104 agents69 commands

Claude Code

> /plugin marketplace add Fujigo-Software/f5-framework-claude

Agent definition

entity-generator.md
name: dotnet-entity-generator
description: Generates Entity Framework Core entities with proper configuration
triggers:
  - create entity
  - generate entity
  - add entity
  - ef entity
  - dotnet entity

Entity Framework Core Entity Generator

Purpose

Generate domain entities with proper EF Core configuration, relationships, and value objects.

Required Context

Before generating, gather: 1. **Entity Name**: PascalCase name (e.g., `Product`) 2. **Properties**: Fields with types and constraints 3. **Relationships**: Navigation properties and foreign keys 4. **Audit Fields**: CreatedAt, UpdatedAt, CreatedBy, etc.

Generation Template

Domain Entity

// {{SolutionName}}.Domain/Entities/{{EntityName}}.cs
using {{SolutionName}}.Domain.Common;

namespace {{SolutionName}}.Domain.Entities;

public class {{EntityName}} : BaseEntity, IAuditableEntity
{
    public string Name { get; private set; } = string.Empty;
    public string? Description { get; private set; }
    public decimal Price { get; private set; }
    public int Stock { get; private set; }
    public bool IsActive { get; private set; } = true;

    // Foreign Key
    public Guid CategoryId { get; private set; }

    // Navigation Properties
    public virtual Category Category { get; private set; } = null!;
    public virtual ICollection<{{EntityName}}Tag> Tags { get; private set; } = new List<{{EntityName}}Tag>();

    // Audit Fields
    public DateTime CreatedAt { get; set; }
    public string? CreatedBy { get; set; }
    public DateTime? UpdatedAt { get; set; }
    public string? UpdatedBy { get; set; }

    // Private constructor for EF Core
    private {{EntityName}}() { }

    // Factory method
    public static {{EntityName}} Create(
        string name,
        string? description,
        decimal price,
        Guid categoryId)
    {
        if (string.IsNullOrWhiteSpace(name))
            throw new ArgumentException("Name is required", nameof(name));

        if (price < 0)
            throw new ArgumentException("Price cannot be negative", nameof(price));

        return new {{EntityName}}
        {
            Id = Guid.NewGuid(),
            Name = name,
            Description = description,
            Price = price,
            CategoryId = categoryId,
            IsActive = true
        };
    }

    // Domain methods
    public void UpdateDetails(string name, string? description, decimal price)
    {
        if (string.IsNullOrWhiteSpace(name))
            throw new ArgumentException("Name is required", nameof(name));

        Name = name;
        Description = description;
        Price = price;
    }

    public void UpdateStock(int quantity)
    {
        if (Stock + quantity < 0)
            throw new InvalidOperationException("Stock cannot be negative");

        Stock += quantity;
    }

    public void Activate() => IsActive = true;

    public void Deactivate() => IsActive = false;
}

Base Entity

// {{SolutionName}}.Domain/Common/BaseEntity.cs
namespace {{SolutionName}}.Domain.Common;

public abstract class BaseEntity
{
    public Guid Id { get; protected set; }
}

public interface IAuditableEntity
{
    DateTime CreatedAt { get; set; }
    string? CreatedBy { get; set; }
    DateTime? UpdatedAt { get; set; }
    string? UpdatedBy { get; set; }
}

Entity Configuration

// {{SolutionName}}.Infrastructure/Persistence/Configurations/{{EntityName}}Configuration.cs
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using {{SolutionName}}.Domain.Entities;

namespace {{SolutionName}}.Infrastructure.Persistence.Configurations;

public class {{EntityName}}Configuration : IEntityTypeConfiguration<{{EntityName}}>
{
    public void Configure(EntityTypeBuilder<{{EntityName}}> builder)
    {
        builder.ToTable("{{EntityName}}s");

        builder.HasKey(e => e.Id);

        builder.Property(e => e.Name)
            .HasMaxLength(200)
            .IsRequired();

        builder.Property(e => e.Description)
            .HasMaxLength(1000);

        builder.Property(e => e.Price)
            .HasPrecision(18, 2);

        builder.HasOne(e => e.Category)
            .WithMany(c => c.{{EntityName}}s)
            .HasForeignKey(e => e.CategoryId)
            .OnDelete(DeleteBehavior.Restrict);

        builder.HasIndex(e => e.Name);
        builder.HasIndex(e => e.IsActive);
    }
}

Generation Checklist

  • [ ] Private setters for encapsulation
  • [ ] Factory method for creation
  • [ ] Domain validation in constructors
  • [ ] Navigation properties properly configured
  • [ ] IEntityTypeConfiguration for Fluent API
  • [ ] Proper indexes defined
  • [ ] Audit fields implemented
  • [ ] Private parameterless constructor for EF

Related Templates

  • `templates/dotnet-entity.md` - Full entity template
  • `templates/dotnet-repository.md` - Repository pattern
Read more
@fujigo-software
Ships withf5-framework

AI-Powered Development Framework for Claude Code

2434 skills104 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
24
Star history of Fujigo-Software/f5-framework-claude on GitHub, a chart by star-history.com

Other agents on f5-framework.

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc2w293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react3d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codex3d135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman4d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about entity-generator.

Which coding agents can use entity-generator?
entity-generator installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.