All skills
github avatar

/efcore-d2-db-diagram

@c9dace8 official
by githubgithub/awesome-copilot40k stars
5,040

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.

Use this Skill: https://skilld.dev/gh/github/awesome-copilot/efcore-d2-db-diagram

This session only. Nothing lands on disk.

referencesrelationship-rules.md

≈253 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Relationship Rules

One-to-many

Detected from:

  • HasOne(...).WithMany(...)
  • FK property on dependent entity.
  • Collection navigation on principal entity.

Render dependent to principal:

Orders.ClientId -> Clients.Id: "N:1"

One-to-one

Detected from:

  • HasOne(...).WithOne(...)
  • Unique FK index.
  • Shared primary key relationship.

Render dependent to principal:

ClientProfiles.ClientId -> Clients.Id: "1:1"

Many-to-many

Detected from:

  • UsingEntity
  • Two collection navigations without explicit join entity.
  • Migration-created join table with two FKs and composite key.

Render the join table explicitly by default.

Owned types

Detected from:

  • OwnsOne
  • OwnsMany
  • [Owned]

Inline by default unless table splitting or separate table mapping is detected.

Optional relationships

A relationship is optional when:

  • FK is nullable.
  • IsRequired(false) is configured.
  • Migration column is nullable.

Use dashed line for optional relationships.

Source: SKILL.md on GitHub

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    The skill is a specialized tool for generating D2 diagrams from Entity Framework Core models by analyzing C# source files. It uses the `d2` CLI for diagram rendering and formatting. No security issues or malicious patterns were detected.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at c9dace8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 months ago
  • efcore
  • entity-framework-core
  • d2
  • database-diagram
  • erd
  • csharp
  • dbcontext
  • schema-visualization
  • migrations

README badge

README badge for github/awesome-copilot/efcore-d2-db-diagram

Generates D2 entity-relationship diagrams from Entity Framework Core models, reading DbContext classes, Fluent API configurations, and migrations to produce renderable `.d2` files. Handles primary keys, foreign keys, owned types, many-to-many relationships, indexes, and constraints with customizable display options for columns, types, and grouping modes.

Generated from the current SKILL.md.

Does this skill generate actual database diagrams or just D2 source code?
It generates D2 source code. You then render it to SVG or PNG using the d2 CLI (e.g. `d2 --layout=elk schema.d2 schema.svg`).
Does this work with all Entity Framework Core versions?
The skill reads DbContext, DbSet, Fluent API, data annotations, and migrations to infer the model. It should work with any EF Core version that supports these constructs, but the skill does not specify a minimum version.
Can it diagram multiple DbContext classes in one file?
Yes. The skill auto-detects all DbContext classes by default, but you can also choose to diagram a specific DbContext or all of them together.
Does this skill visualize runtime data or only the schema?
Schema only. It does not execute code, debug, or inspect runtime state. It extracts the static model from EF Core mappings and migrations.
What happens to many-to-many relationships in the diagram?
By default, explicit join tables are shown because EF Core creates real database tables for them. You can choose compact or hidden display if preferred.

Generated from the current SKILL.md. These answers refresh after source changes.