Official agent skill

Efcore D2 DB Diagram

by github in github/awesome-copilot

Generate D2 database diagrams from Entity Framework Core models.

OfficialMITAuto-check passedDatabases

Install Efcore D2 DB Diagram

skills CLI
$ npx skills add github/awesome-copilot --skill efcore-d2-db-diagram -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install github/awesome-copilot efcore-d2-db-diagram --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/github/awesome-copilot.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/efcore-d2-db-diagram .claude/skills/efcore-d2-db-diagram && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
efcore-d2-db-diagram
GitHub stars
40k
Token cost
~2.3k tokens
SKILL.md length
1,029 words
Files
6 (incl. references)
Skills in repo
417
Repo updated
First seen
Licence
MIT

At a glance

Generate D2 database diagrams from Entity Framework Core models.

  • Works in 6 steps: Database tables and relationships. → Primary keys, foreign keys,… → Owned types and value objects. → …
  • : EF Core database diagram
  • SKILL.md covers When to Use, Goal, Tools and Recommended Workflow, plus 8 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Efcore D2 DB Diagram is an agent skill from github/awesome-copilot, published by the product's own GitHub organization. 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…

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/d2-erd-style.md`, `references/efcore-model-extraction.md` and `references/grouping-modes.md`).

It sits in Databases, covering Diagrams and ORMs and data access. It works with C#, PostgreSQL, draw.io and SQL. The repository describes itself as: Community-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot. The licence is MIT.

When your agent uses it

  • : EF Core database diagram
  • Entity Framework Core ERD
  • DbContext diagram
  • C entity relationship diagram

Example prompts

  • “/efcore-d2-db-diagram”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  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.

What it can do on your machine

Read from SKILL.md and the folder at commit 727ff2e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are d2).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Efcore D2 DB Diagram loads about 2.3k tokens when it runs, and up to ~3.1k if it reads all its reference files. Until then it costs about 137 tokens; SKILL.md has 1,029 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~137
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from github/awesome-copilot at commit 727ff2e, republished under its MIT licence (© github). 1,029 words, ~2,287 tokens.

Download SKILL.mdSave it as .claude/skills/efcore-d2-db-diagram/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
efcore-d2-db-diagram
description
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.

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.
  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. If regenerating, re-read EF Core mappings and migrations first.

Mandatory Questions Before Diagram Generation

Ask these questions for every new diagram and every regeneration unless the user already answered them in the same request.

  1. Which DbContext should be diagrammed? (auto-detect/all/specific name)
  2. Display columns? (all/key-only/none)
  3. Display column types? (Yes/No)
  4. Display nullable/required markers? (Yes/No)
  5. Display indexes and unique constraints? (Yes/No)
  6. Display enum values? (Yes/No)
  7. Display owned types? (inline/separate/hide)
  8. Display many-to-many join tables? (explicit/compact/hide)
  9. Display audit/technical tables? (Yes/No)
  10. Display migration-only tables not present as entities? (Yes/No)
  11. Which grouping mode? (bounded-context/schema/namespace/flat)
  12. Which layout engine? (elk/dagre/tala)
  13. Which output format? (d2/svg/png)

Default values, when the user asks for a quick generation:

  • DbContext: auto-detect
  • Columns: key-only
  • Column types: Yes
  • Nullable markers: Yes
  • Indexes: Yes
  • Enums: No
  • Owned types: inline
  • Join tables: explicit
  • Audit/technical tables: No
  • Migration-only tables: Yes
  • Grouping: bounded-context
  • Layout: elk
  • Output: d2

Reference Documents

Load these on demand when needed:

ReferenceWhen to load
references/efcore-model-extraction.mdRules for reading DbContext, DbSet, Fluent API, configurations and migrations
references/d2-erd-style.mdD2 syntax and visual conventions for ERD diagrams
references/relationship-rules.mdHow to infer one-to-one, one-to-many, many-to-many and owned relationships
references/grouping-modes.mdRules for bounded-context, schema, namespace and flat grouping
references/quality-gate.mdFinal checklist before delivering the generated diagram

EF Core Extraction Rules

Source Priority

Use this priority order when sources disagree:

  1. Latest applied migration / migration snapshot.
  2. Fluent API configuration in OnModelCreating or IEntityTypeConfiguration<T>.
  3. Data annotations.
  4. EF Core conventions.
  5. Raw C# class shape.
Required EF Core Concepts to Detect

Detect and represent:

  • DbContext and DbSet<T>.
  • Entity class names and actual table names from ToTable.
  • Schema names from ToTable("Table", "schema").
  • Primary keys from HasKey, [Key], conventions and migrations.
  • Composite keys.
  • Foreign keys from HasForeignKey, navigation properties and migration operations.
  • Delete behavior when explicit: Cascade, Restrict, NoAction, SetNull, ClientSetNull.
  • Required/optional relationship markers.
  • Owned types from OwnsOne, OwnsMany and [Owned].
  • Many-to-many relationships from UsingEntity and implicit EF Core join tables.
  • Indexes from HasIndex, IsUnique and migrations.
  • Alternate keys from HasAlternateKey.
  • Shadow properties configured in Fluent API.
  • Value conversions when they affect persisted type or readability.
  • Enum properties.
  • Ignored properties and ignored entities.
Show full SKILL.md (377 more words)Show less

Diagram Rendering Rules

Tables

Represent each persisted table as a D2 node with shape: sql_table when possible.

Use this content convention:

d2
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.

Relationships

Use directional edges from dependent table to principal table.

Labels must include relationship cardinality and FK name when known:

d2
Offers.ClientId -> Clients.Id: "N:1 FK_Offers_Clients_ClientId"

Use these cardinality labels:

  • 1:1
  • 1:N
  • N:1
  • N:N
  • owned
Owned Types

Owned types default to inline rendering.

Inline example:

d2
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.

Many-to-Many

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.

Technical Tables

Hide technical tables by default unless requested.

Examples:

  • __EFMigrationsHistory
  • Hangfire tables
  • ASP.NET Identity tables
  • Audit logs
  • Outbox tables

If technical tables are hidden, mention them in the summary after the diagram.

Grouping Modes

  • 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.

Style Rules

Use consistent styles:

  • Primary entity tables: solid border.
  • Join tables: dashed border.
  • Owned types: lighter stroke or nested inline fields.
  • Technical tables: muted style.
  • External tables or migration-only tables: dotted border.
  • Required relationships: solid line.
  • Optional relationships: dashed line.
  • Cascade delete: label suffix cascade.

Quality Gate Before Delivery

Before delivering the diagram, verify:

  • The selected DbContext is clear.
  • All DbSet<T> entities are considered.
  • Fluent API configurations are read.
  • Migrations are checked when present.
  • Table names and schema names match EF Core mapping.
  • Primary keys are present.
  • Foreign keys and cardinalities are represented.
  • Owned types are handled according to user choice.
  • Many-to-many join tables are explicit unless the user asked otherwise.
  • Hidden technical tables are listed in the final summary.
  • D2 syntax is valid with d2 fmt.
  • Edge endpoints use full dot-notation when inside containers.
  • The diagram remains readable and avoids crossing-heavy layouts.

Output Format

When the user asks for a skill installation, provide this folder structure:

text
.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:

  1. The .d2 source file content.
  2. The render command using the selected layout engine.
  3. A concise summary of assumptions and hidden tables.

© github, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in skills/efcore-d2-db-diagram of github/awesome-copilot.

  • SKILL.md
  • references/d2-erd-style.md
  • references/efcore-model-extraction.md
  • references/grouping-modes.md
  • references/quality-gate.md
  • references/relationship-rules.md

Open the folder on GitHubat commit 727ff2e

Compare with similar skills

Efcore D2 DB Diagram next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Efcore D2 DB Diagram compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Efcore D2 DB Diagram this skillgithub/awesome-copilot40k—~2.3kAutomated safety check: PassMIT
Sql2erystemsrx/sql_to_ER188—~1.1kAutomated safety check: PassAGPL-3.0
Releaserogerpadilla/uql125—~842Automated safety check: PassMIT
Database Scoutzebbern/claude-code-guide4.6k—~1.1kAutomated safety check: PassMIT
NpgsqlrestNpgsqlRest/NpgsqlRest132—~7kAutomated safety check: NotesMIT
Database FundamentalsDanielPodolsky/ownyourcode2901 repos~1.6kAutomated safety check: PassMIT

Similar skills

  • Sql2er

    ystemsrx/sql_to_ER

    A skill your agent uses when the user wants a Chen-model ER diagram from SQL CREATE TABLE statements or DBML, wants to rearrange or clean up an existing sql2er state, wants a skeleton-only overview…

    188 GitHub stars~1.1k tokensUpdated 6 days ago
    DatabasesAuto-check passed
  • Release

    rogerpadilla/uql

    Cut and publish a uql release - review the change, changelog entry, commit, version bump and tag, GitHub Release, npm publish, docs site.

    125 GitHub stars~842 tokensUpdated today
    DatabasesAuto-check passed
  • Database Scout

    zebbern/claude-code-guide

    Explore SQLite and PostgreSQL databases: list tables, inspect schemas (columns/types/constraints), preview data, generate Mermaid ER diagrams, and run safe read-only queries.

    4.6k GitHub stars~1.1k tokensUpdated today
    DatabasesAuto-check passed
  • Npgsqlrest

    NpgsqlRest/NpgsqlRest

    Build and modify REST APIs with NpgsqlRest — exposing PostgreSQL as HTTP endpoints from two sources (database functions/procedures/tables/views, and plain .sql files), driven by SQL comment…

    132 GitHub stars~7k tokensUpdated 4 days ago
    DatabasesAuto-check: notes
  • Database Fundamentals

    DanielPodolsky/ownyourcode

    Reviews schema design, SQL queries, ORM patterns. An agent skill from DanielPodolsky/ownyourcode.

    290 GitHub starsUsed in 1 repo~1.6k tokens
    DatabasesAuto-check passed
  • Drizzle Database

    ChatbotXIO/ChatbotX

    Work with Drizzle ORM database schema, migrations, relations, and queries in PostgreSQL.

    878 GitHub stars~2.1k tokensUpdated today
    DatabasesAuto-check passed

More from github/awesome-copilot

All 417 skills in this repo
  • Acquire Codebase Knowledge

    github/awesome-copilot

    Official

    Maps an unfamiliar codebase into seven evidence-backed documents in docs/codebase/, using a scan script and templates, for onboarding or architecture write-ups.

    40k GitHub starsUsed in 1 repo~2.3k tokens
    Auto-check passed
  • Azure Architecture Autopilot

    github/awesome-copilot

    Official

    Designs Azure infrastructure from a natural-language description, or diagrams an existing resource group, then refines the design through conversation and deploys it with Bicep.

    40k GitHub starsUsed in 1 repo~1.9k tokens
    Auto-check passed
  • Draw.io Diagram Generator

    github/awesome-copilot

    Official

    Generates, edits and validates draw.io files with correct mxGraph XML, covering flowcharts, architecture, sequence, ER and UML class diagrams.

    40k GitHub starsUsed in 1 repo~4.9k tokens
    Auto-check passed
  • Credit Risk Data Cleaning

    github/awesome-copilot

    Official

    Cleans raw credit data and screens variables before loan modeling, dropping unstable, noisy or redundant features and writing an Excel report of every step.

    40k GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed
  • Daily Focus Board

    github/awesome-copilot

    Official

    Builds a warm, browser-based daily focus board the user updates by talking to their agent, with Eisenhower priorities, a brain-dump box and kind not-today carryover.

    40k GitHub stars~3k tokensUpdated today
    Auto-check passed
  • Python Pypi Package Builder

    github/awesome-copilot

    Official

    End-to-end skill for building, testing, linting, versioning, and publishing a production-grade Python library to PyPI.

    40k GitHub starsUsed in 1 repo~4.6k tokens
    Auto-check passed

Questions about Efcore D2 DB Diagram

What does Efcore D2 DB Diagram do?

Generate D2 database diagrams from Entity Framework Core models. Efcore D2 DB Diagram is an agent skill from github/awesome-copilot, published by the product's own GitHub organization. Generate D2 database diagrams from Entity Framework Core models.

When should I use Efcore D2 DB Diagram?

Efcore D2 DB Diagram fits situations like: : EF Core database diagram; entity Framework Core ERD; dbContext diagram; C entity relationship diagram.

How do I install Efcore D2 DB Diagram in Claude Code?

Run `npx skills add github/awesome-copilot --skill efcore-d2-db-diagram -a claude-code`. Or copy the skill folder (skills/efcore-d2-db-diagram in github/awesome-copilot) into .claude/skills/efcore-d2-db-diagram in your project. Claude Code loads it when a task matches its description.

How do I install Efcore D2 DB Diagram in Codex?

Run `npx skills add github/awesome-copilot --skill efcore-d2-db-diagram -a codex`. Or copy the skill folder (skills/efcore-d2-db-diagram in github/awesome-copilot) into .agents/skills/efcore-d2-db-diagram in your project. Codex loads it when a task matches its description.

Can I use Efcore D2 DB Diagram in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add github/awesome-copilot --skill efcore-d2-db-diagram -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/efcore-d2-db-diagram, .gemini/skills/efcore-d2-db-diagram, .github/skills/efcore-d2-db-diagram and .opencode/skills/efcore-d2-db-diagram in your project.

What does Efcore D2 DB Diagram need to run?

SKILL.md names no scripts, command-line tools or credentials: Efcore D2 DB Diagram is instructions for the agent only.

Does Efcore D2 DB Diagram access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Efcore D2 DB Diagram safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Efcore D2 DB Diagram use?

Efcore D2 DB Diagram is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Efcore D2 DB Diagram use?

About 2.3k tokens (SKILL.md is roughly 9.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 836 tokens, read only when the agent opens those files.

What are the alternatives to Efcore D2 DB Diagram?

Skills that share tags, products or a category with Efcore D2 DB Diagram: Sql2er (ystemsrx/sql_to_ER, 188 stars), Release (rogerpadilla/uql, 125 stars), Database Scout (zebbern/claude-code-guide, 4.6k stars) and Npgsqlrest (NpgsqlRest/NpgsqlRest, 132 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Efcore D2 DB Diagram?

github (a GitHub organization, an official publisher) maintains it in github/awesome-copilot, which has 39,748 GitHub stars. The repository holds 417 skills in this directory. The repository was last updated on October 7, 2026.

Source: github/awesome-copilot on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.