Agent skill · writing content · github
efcore-d2-db-diagram
Generate D2 database diagrams from Entity Framework Core models. USE FOR: EF Core database diagram, Entity Framework Core ERD, DbContext diagram, C# entity relationship diagram, PostgreSQL schema visualization, generate .d2 file from EF Core entities, Fluent API mapping diagram, migrations-based database diagram, table relationships, owned types, many-to-many join tables, indexes and constraints. DO NOT USE FOR: runtime debugging, database migration execution, schema deployment, SQL performance tuning, or draw.io diagrams.
Why this skill is useful
Generates a .d2 file from EF Core models, providing specific commands and workflows for database diagram generation that the AI wouldn't reliably generate on its own.
What it needs
Requires d2 installed locally. About 5k tokens when loaded. Last updated 2026-08-07. 37,534 stars on the source repository.
What this skill does
EF Core D2 Database Diagram Generator When to Use Use this skill when the user wants to generate a database / ERD diagram from an Entity Framework Core codebase. Typical requests: Generate a D2 database diagram from EF Core entities. Visualize tables, columns, primary keys, foreign keys and relationships. Analyze DbContext, DbSet<T>, IEntityTypeConfiguration<T>, Fluent API and migrations. Produce a .d2 file renderable to SVG/PNG with the d2 CLI. Document the database model of an ASP.NET Core / .NET project. Goal Create a readable D2 entity-relationship diagram that reflects the actual EF Core persistence model, not only the raw C# class shape. The diagram must prioritize: 1. Database tables and relationships. 2. Primary keys, foreign keys, required/optional columns. 3. Owned types and value objects. 4. Many-to-many relationships and join tables. 5. Indexes, unique constraints and table names. 6. EF Core conventions only when explicit mapping is absent. Output is .d2 source code. It can be rendered to SVG or PNG via the d2 CLI. Tools d2 CLI: render .d2 files to SVG/PNG. d2 input.d2 output.svg d2 --layout=elk input.d2 output.svg d2 fmt: format D2 files. d2 fmt input.d2 No MCP server is required. The skill generates D2 source code as text. Recommended Workflow 1. Read the EF Core project structure. 2. Locate all DbContext classes. 3. Locate all DbSet<T> declarations. 4. Locate entity classes, owned types, enum types and value objects. 5. Read OnModelCreating and all IEntityTypeConfiguration<T> classes. 6. Read migrations when available to confirm table names, join tables, indexes and delete behaviors. 7. Build a normalized database model before writing D2. 8. Ask the mandatory diagram questionnaire before generation. 9. Generate the .d2 file using the database model, not raw class nesting. 10. Validate D2 syntax with d2 fmt before delivery. 11. Render with d2 --layout=elk schema.d2 schema.svg when possible. 12. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills github/efcore-d2-db-diagram