Best for
- Generate a D2 database diagram from EF Core entities.
- Visualize tables, columns, primary keys, foreign keys and relationships.
- Analyze DbContext, DbSet, IEntityTypeConfiguration, Fluent API and migrations.
github/awesome-copilot/skills/efcore-d2-db-diagram/SKILL.md
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
Decision brief
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 .
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/github/awesome-copilot --skill "skills/efcore-d2-db-diagram"Inspect the Agent Skill "efcore-d2-db-diagram" from https://github.com/github/awesome-copilot/blob/9933dcad5be5caeb288cebcd370eeeb2fc2f1685/skills/efcore-d2-db-diagram/SKILL.md at commit 9933dcad5be5caeb288cebcd370eeeb2fc2f1685. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
1. Read the EF Core project structure. 2. Locate all DbContext classes. 3. Locate all DbSet declarations. 4. Locate entity classes, owned types, enum types and value objects. 5. Read OnModelCreating and all IEntityTypeConfiguration classes. 6. Read migrations when available to c…
Use this skill when the user wants to generate a database / ERD diagram from an Entity Framework Core codebase.
Create a readable D2 entity-relationship diagram that reflects the actual EF Core persistence model, not only the raw C class shape.
d2 CLI: render .d2 files to SVG/PNG.
Ask these questions for every new diagram and every regeneration unless the user already answered them in the same request.
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 83/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 37,126 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Use this skill when the user wants to generate a database / ERD diagram from an Entity Framework Core codebase.
Typical requests:
DbContext, DbSet<T>, IEntityTypeConfiguration<T>, Fluent API and migrations..d2 file renderable to SVG/PNG with the d2 CLI.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:
Output is .d2 source code. It can be rendered to SVG or PNG via the d2 CLI.
.d2 files to SVG/PNG.
d2 input.d2 output.svgd2 --layout=elk input.d2 output.svgd2 fmt input.d2DbContext classes.DbSet<T> declarations.OnModelCreating and all IEntityTypeConfiguration<T> classes..d2 file using the database model, not raw class nesting.d2 fmt before delivery.d2 --layout=elk schema.d2 schema.svg when possible.Ask these questions for every new diagram and every regeneration unless the user already answered them in the same request.
Which DbContext should be diagrammed? (auto-detect/all/specific name)Display columns? (all/key-only/none)Display column types? (Yes/No)Display nullable/required markers? (Yes/No)Display indexes and unique constraints? (Yes/No)Display enum values? (Yes/No)Display owned types? (inline/separate/hide)Display many-to-many join tables? (explicit/compact/hide)Display audit/technical tables? (Yes/No)Display migration-only tables not present as entities? (Yes/No)Which grouping mode? (bounded-context/schema/namespace/flat)Which layout engine? (elk/dagre/tala)Which output format? (d2/svg/png)Default values, when the user asks for a quick generation:
auto-detectkey-onlyYesYesYesNoinlineexplicitNoYesbounded-contextelkd2Load these on demand when needed:
| Reference | When to load |
|---|---|
references/efcore-model-extraction.md | Rules for reading DbContext, DbSet, Fluent API, configurations and migrations |
references/d2-erd-style.md | D2 syntax and visual conventions for ERD diagrams |
references/relationship-rules.md | How to infer one-to-one, one-to-many, many-to-many and owned relationships |
references/grouping-modes.md | Rules for bounded-context, schema, namespace and flat grouping |
references/quality-gate.md | Final checklist before delivering the generated diagram |
Use this priority order when sources disagree:
OnModelCreating or IEntityTypeConfiguration<T>.Detect and represent:
DbContext and DbSet<T>.ToTable.ToTable("Table", "schema").HasKey, [Key], conventions and migrations.HasForeignKey, navigation properties and migration operations.Cascade, Restrict, NoAction, SetNull, ClientSetNull.OwnsOne, OwnsMany and [Owned].UsingEntity and implicit EF Core join tables.HasIndex, IsUnique and migrations.HasAlternateKey.Represent each persisted table as a D2 node with shape: sql_table when possible.
Use this content convention:
Clients: {
shape: sql_table
constraint: primary_key
Id: uuid {constraint: primary_key}
Name: text
Status: enum
}
If sql_table is unavailable or causes validation issues, fallback to a rectangle with structured text.
Use directional edges from dependent table to principal table.
Labels must include relationship cardinality and FK name when known:
Offers.ClientId -> Clients.Id: "N:1 FK_Offers_Clients_ClientId"
Use these cardinality labels:
1:11:NN:1N:NownedOwned types default to inline rendering.
Inline example:
Clients: {
shape: sql_table
Id: uuid {constraint: primary_key}
Address.Street: text
Address.ZipCode: text
Address.City: text
}
If the user chooses separate, represent owned types as visually subordinate tables and use an owned relationship.
Default to explicit join tables because EF Core creates real tables.
For implicit many-to-many relationships, create a generated join table node and mark it as implicit join.
Hide technical tables by default unless requested.
Examples:
__EFMigrationsHistoryIf technical tables are hidden, mention them in the summary after the diagram.
bounded-context: group by detected domain area or folder/module.schema: group by database schema, e.g. public, auth, billing.namespace: group by C# namespace.flat: no containers, all tables at the same level.Use consistent styles:
cascade.Before delivering the diagram, verify:
DbSet<T> entities are considered.d2 fmt.When the user asks for a skill installation, provide this folder structure:
.github/
skills/
efcore-d2-db-diagram/
SKILL.md
references/
efcore-model-extraction.md
d2-erd-style.md
relationship-rules.md
grouping-modes.md
quality-gate.md
When the user asks to generate a diagram, provide:
.d2 source file content.Alternatives
wshobson/agents
Schedule and publish social media posts across 13 platforms (X, LinkedIn, Instagram, Facebook Pages, TikTok, Discord, Telegram, YouTube, Reddit, WordPress, Pinterest) via the SocialClaw API. Use when the user wants to publish, schedule, or manage social media content programmatically. Requires SOCIALCLAW_API_KEY.
affaan-m/ECC
Laravel security best practices — authentication, authorization, Eloquent safety, CSRF, XSS prevention, API security, and secure deployment configurations.
affaan-m/ECC
Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provides comprehensive security checklist and patterns.
affaan-m/ECC
Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provides comprehensive security checklist and patterns.