efcore-d2-db-diagram

efcore-d2-db-diagram is a skill for Claude Code, Codex from OKHP3/skillz. It costs 108 tokens per session (2,159 once invoked), scanned A, original, MIT.

A generator that turns Entity Framework Core models into D2 database diagrams. Entity Framework Core is a .NET tool for mapping C# objects to database tables, while D2 is a text format for diagrams.

In plain words
What is it for?
It helps document tables, columns, keys, relationships, join tables, indexes, constraints, owned types, and migrations in ASP.NET Core or other C# projects.
Why use it?
It makes the actual persistence model easier to inspect than reading entity classes and mapping rules alone.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps document tables, columns, keys, relationships, join tables, indexes, constraints, owned types, and migrations in ASP.NET Core or other C# projects.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/okhp3/skillz/efcore-d2-db-diagram
View source ↗ OKHP3/skillz
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add OKHP3/skillz --skill efcore-d2-db-diagram
Clone the repo
git clone --depth 1 https://github.com/OKHP3/skillz

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for efcore-d2-db-diagram

README.md
[![agentmods](https://agentmods.dev/badge/skills/okhp3/skillz/efcore-d2-db-diagram/github.svg)](https://agentmods.dev/skills/okhp3/skillz/efcore-d2-db-diagram)
Your own site
<a href="https://agentmods.dev/skills/okhp3/skillz/efcore-d2-db-diagram"><img src="https://agentmods.dev/badge/skills/okhp3/skillz/efcore-d2-db-diagram/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for efcore-d2-db-diagram

Your own site · 80×15
<a href="https://agentmods.dev/skills/okhp3/skillz/efcore-d2-db-diagram"><img src="https://agentmods.dev/badge/skills/okhp3/skillz/efcore-d2-db-diagram.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 108 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,159 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00108 $0.02159
Opus 5 $0.00054 $0.01079
Sonnet 5 $0.00022 $0.00432
Haiku 4.5 $0.00011 $0.00216

Measured 6d ago against content hash e0689c25df30, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

efcore-d2-db-diagram scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

community/efcore-d2-db-diagram/SKILL.md · 274 lines

How it starts

The opening of the file, as written. The whole thing — 274 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

Read the full file on GitHub · 274 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 274 lines · 108 tokens per session scan A e0689c25df30

Subscribe to this mod's changes

efcore-d2-db-diagram is a skill published in the GitHub repository OKHP3/skillz (3 stars, last pushed yesterday), licensed MIT. It adds 108 tokens to every session and 2,159 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

neo-dotnet-ef-core

Use this skill when the task involves Entity Framework Core models, DbContext, migrations, LINQ queries, change tracking, database providers, performance tuning, or data access review in .NET projects.

Benknightdark/neo-skills · 46 tokens

optimizing-ef-core-queries

Optimize and improve the performance of slow Entity Framework Core (EF Core) queries: make them generate less SQL, make fewer database round-trips, and return results faster. Use whenever an EF Core or DbContext query or data-access path is slow or should be made faster — whether or not EF Core owns the database…

dotnet/skills · 86 tokens

csharp-developer

Use when building C# applications with .NET 8+, ASP.NET Core APIs, or Blazor web apps. Builds REST APIs using minimal or controller-based routing, configures database access with Entity Framework Core, implements async patterns and cancellation, structures applications with CQRS via MediatR, and scaffolds Blazor…

Jeffallan/claude-skills · 102 tokens

dotnet-core-expert

Use when building .NET 8 applications with minimal APIs, clean architecture, or cloud-native microservices. Invoke for Entity Framework Core, CQRS with MediatR, JWT authentication, AOT compilation.

Jeffallan/claude-skills · 47 tokens

entity-framework-core

Design, tune, or review EF Core data access with proper modeling, migrations, query translation, performance, and lifetime management for modern .NET applications. USE FOR: DbContext, migrations, model configuration, EF queries, tracking, loading, performance, transactions, and EF6 migration decisions. DO NOT USE FOR…

managedcode/dotnet-skills · 110 tokens

efcore-patterns

Entity Framework Core best practices including NoTracking by default, query splitting for navigation collections, migration management, dedicated migration services, and common pitfalls to avoid.

Aaronontheweb/dotnet-skills · 35 tokens