efcore-d2-db-diagram
하는 일
이 도구는 프로젝트 코드로부터 데이터베이스의 시각적 다이어그램을 만듭니다. Entity Framework Core를 사용해 테이블과 테이블 사이의 관계를 어떻게 정의했는지 이해합니다.
사용하는 경우
- ✓데이터베이스 테이블이 어떻게 연결되는지 보고 싶을 때.
- ✓C# 프로젝트의 데이터베이스 구조를 문서로 남길 때.
- ✓다대다 관계 같은 복잡한 관계를 이해하고 싶을 때.
스킬 링크
https://github.com/github/awesome-copilot/blob/main/skills/efcore-d2-db-diagram/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“Entity Framework Core를 사용하는 제 프로젝트의 데이터베이스 다이어그램을 생성해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
도구는 Entity Framework Core를 사용하는 C# 코드를 분석합니다. 테이블과 열 정의, 그리고 그 관계를 찾아 다이어그램을 그립니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
.d2file renderable to SVG/PNG with thed2CLI. - 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:
- Database tables and relationships.
- Primary keys, foreign keys, required/optional columns.
- Owned types and value objects.
- Many-to-many relationships and join tables.
- Indexes, unique constraints and table names.
- 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
.d2files to SVG/PNG.d2 input.d2 output.svgd2 --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
- Read the EF Core project structure.
- Locate all
DbContextclasses. - Locate all
DbSet<T>declarations. - Locate entity classes, owned types, enum types and value objects.
- Read
OnModelCreatingand allIEntityTypeConfiguration<T>classes. - Read migrations when available to confirm table names, join tables, indexes and delete behaviors.
- Build a normalized database model before writing D2.
- Ask the mandatory diagram questionnaire before generation.
- Generate the
.d2file using the database model, not raw class nesting. - Validate D2 syntax with
d2 fmtbefore delivery. - Render with
d2 --layout=elk schema.d2 schema.svgwhen possible. - 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.
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:
- 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:
| 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 |
EF Core Extraction Rules
Source Priority
Use this priority order when sources disagree:
- Latest applied migration / migration snapshot.
- Fluent API configuration in
OnModelCreatingorIEntityTypeConfiguration<T>. - Data annotations.
- EF Core conventions.
- Raw C# class shape.
Required EF Core Concepts to Detect
Detect and represent:
DbContextandDbSet<T>.- Entity class names and actual table names from
ToTable. - Schema names from
ToTable("Table", "schema"). - Primary keys from
HasKey,[Key], conventions and migrations.
…
자주 묻는 질문
ERD 다이어그램이란 무엇인가요?
ERD는 Entity-Relationship Diagram의 약자입니다. 데이터베이스 테이블과 서로 연결되는 방식을 보여 주는 그림입니다.
Entity Framework Core가 무엇인가요?
개발자가 SQL 코드를 직접 모두 쓰지 않고도 C# 프로젝트에서 데이터베이스를 다루도록 돕는 도구입니다.
.d2 파일이란 무엇인가요?
다이어그램을 설명하는 텍스트 파일입니다. 'd2 CLI'라는 다른 도구를 사용해 SVG나 PNG 같은 이미지로 바꿀 수 있습니다.
상세 정보
작성자의 원본 설명
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.
repo: github/awesome-copilot
인기도
- GitHub 스타
- 40k
- 순위
- #7187
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
acquire-codebase-knowledge
40k에이전트가 기존 코드 프로젝트를 이해하고 문서화하도록 돕습니다. 새 구성원을 맞이하거나 아키텍처를 개괄적으로 파악할 때 유용합니다.
acreadiness-assess
40k에이전트가 프로젝트의 AI 준비 상태를 평가하고 보고서를 만들도록 합니다. 프로젝트가 AI 도구를 쓸 준비가 얼마나 되어 있는지 이해하는 데 유용합니다.
acreadiness-generate-instructions
40k에이전트가 평가 결과를 바탕으로 AI 도구를 위한 지침을 만들도록 돕습니다. AI가 코드와 상호작용하는 방식을 개선하고 확인된 공백을 메울 때 유용합니다.
acreadiness-policy
40k에이전트가 AI 프로젝트 평가를 위한 정책을 정의하거나 적용하도록 돕습니다. 프로젝트 평가 방식을 표준화하고 규정 준수를 보장할 때 유용합니다.