drawio-impl-er-diagrams
Installation
SKILL.md
Draw.io ER Diagram Implementation
Purpose
This skill enables correct generation of entity-relationship diagrams, database schemas, and data models in Draw.io mxGraph XML. It enforces crow's foot notation for cardinality, proper entity table structures, and PK/FK visual conventions. The most common AI mistake is using generic arrows (endArrow=classic) instead of ER-specific markers (ERone, ERmany, etc.).
Critical Rules (Memorize These)
- ALWAYS use
entityRelationEdgeStylefor ER relationships — NEVER useorthogonalEdgeStyleor default edge routing. - ALWAYS use ER-specific arrow markers (
ERone,ERmany,ERmandOne,ERzeroToOne,ERoneToMany,ERzeroToMany) — NEVER useendArrow=classicorendArrow=blockin ER diagrams. - ALWAYS set
startFill=0andendFill=0on ER edges — crow's foot markers MUST useFill=0. SettingFill=1produces incorrect filled shapes. - ALWAYS use
shape=table;childLayout=tableLayout;container=1;for entity shapes — this produces the standard database table appearance with a header row and stacked attribute rows. - ALWAYS place attribute rows as children of the entity — every attribute
mxCellMUST haveparent="<entity_id>". NEVER useparent="1". - ALWAYS mark primary key fields with
fontStyle=4;(underline) — this is the standard ER convention for PKs. - ALWAYS mark foreign key fields with
fontStyle=2;(italic) — this distinguishes FKs from regular attributes. - ALWAYS include both structural cells (
id="0"andid="1"withparent="0") in every diagram.