跳到主要内容
知仓学习社ZHICANG

entity-relationship-diagram

Turn a data model into an entity-relationship (ER) diagram. Use when asked to design a schema, model data, show how tables/entities relate, or diagr…

不碰外部(只输出文字)无严重或高危命中mohitagw15856/pm-claude-skills

它会碰到什么

扫了多少1 个文本文件,3 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Entity-Relationship Diagram Skill

Before you write a migration, it pays to see the data model: the entities, their key fields, and how they

relate (one-to-many, many-to-many). This skill turns a described domain into a clean Mermaid ER diagram

with proper cardinality notation and the attributes that matter.

Required Inputs

Ask for these only if they aren't already provided:

  • The entities — the core objects/tables (User, Order, Product…).
  • Relationships — how they relate, and the cardinality (a user has many orders, an order has many line items).
  • Key attributes — the important fields per entity (especially keys); full column lists aren't required.
  • The domain — what the system does, so the model is realistic.

Output Format

[Domain] — data model

One line on the scope of the model.

erDiagram
    USER ||--o{ ORDER : places
    ORDER ||--|{ LINE_ITEM : contains
    PRODUCT ||--o{ LINE_ITEM : "appears in"
    USER {
        uuid id PK
        string email
        string name
    }
    ORDER {
        uuid id PK
        uuid user_id FK
        datetime created_at
        string status
    }
    LINE_ITEM {
        uuid id PK
        uuid order_id FK
        uuid product_id FK
        int qty
    }
    PRODUCT {
        uuid id PK
        string name
        decimal price
    }

Cardinality key||--o{ = one-to-many, }o--o{ = many-to-many, ||--|| = one-to-one.

Design notes — normalization choices, where a join table is needed, indexes worth adding, anything deferred.

Mermaid Rules (so it renders)

  • Start with erDiagram. Relationship line: A ||--o{ B : label.
  • Crow's-foot cardinality: || (exactly one), o{ (zero-or-many), |{ (one-or-many), o| (zero-or-one).
  • Attribute blocks: ENTITY { type name PK } — mark keys with PK / FK.
  • Entity names are usually UPPER_SNAKE; quote relationship labels that contain spaces.

Quality Checks

  • [ ] Every relationship has explicit, correct cardinality (not just a plain line)
  • [ ] Primary and foreign keys are marked (PK/FK)
  • [ ] Many-to-many relationships are resolved with a join entity where appropriate
  • [ ] Attribute types are sensible for the domain
  • [ ] The Mermaid block renders without edits

Anti-Patterns

  • [ ] Do not draw relationships without cardinality — "related" isn't a data model
  • [ ] Do not leave many-to-many unresolved when a join table is the right call
  • [ ] Do not dump every conceivable column — show the keys and the attributes that matter
  • [ ] Do not omit foreign keys — they're how the relationships are actually enforced
  • [ ] Do not break Mermaid with unquoted spaced labels

Based On

Data modeling (entity-relationship modeling, crow's-foot notation, normalization), expressed as renderable Mermaid.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

同名技能的其他版本

有 3 个不同仓库或目录里都有叫 entity-relationship-diagram 的技能。它们内容并不相同,别混用: