
Creating Mermaid Diagrams
Author correct Mermaid class and ER diagram syntax with visibility modifiers, relationship types, and cardinality for architecture and data-model documentation.
Install
npx skills add https://github.com/agents365-ai/365-skills --skill creating-mermaid-diagramsWhat is this skill?
- Class diagram basics with visibility modifiers (+ public, - private, # protected, ~ package)
- Seven relationship types including inheritance, composition, aggregation, association, dependency, and realization
- Cardinality notation (1, 0..1, *, 1..*, n..m) with worked User–Order examples
- ER diagram syntax with PK/FK fields and crow's-foot style relationship lines
- Copy-paste Mermaid blocks for classDiagram and erDiagram scopes
Adoption & trust: 729 installs on skills.sh; 8 GitHub stars; 3/3 security scanners passed (skills.sh audits).
Recommended Skills
Journey fit
Build docs is the primary shelf because the skill teaches diagram syntax for models and schemas developers embed in READMEs, ADRs, and agent context—not distribution or monitoring. Docs subphase covers visual architecture and data-model artifacts that accompany implementation in backend and frontend work.
Common Questions / FAQ
Is Creating Mermaid Diagrams safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Creating Mermaid Diagrams
# Class & ER Diagram Syntax ## Class Diagram ### Basic Structure ```mermaid classDiagram class User { +String name +String email -String passwordHash +login() bool +logout() } class Order { +int id +Date createdAt +float total +place() +cancel() } User "1" --> "*" Order : places ``` ### Visibility Modifiers | Symbol | Meaning | |--------|---------| | `+` | Public | | `-` | Private | | `#` | Protected | | `~` | Package/Internal | ### Relationships | Syntax | Type | Meaning | |--------|------|---------| | `<\|--` | Inheritance | extends | | `*--` | Composition | owns (lifecycle) | | `o--` | Aggregation | has (independent) | | `-->` | Association | uses | | `..>` | Dependency | depends on | | `..\|>` | Realization | implements | ### Cardinality ```mermaid classDiagram User "1" --> "*" Order : places Order "1" --> "1..*" OrderItem : contains Product "0..*" --> "0..*" Category : belongs to ``` | Notation | Meaning | |----------|---------| | `1` | Exactly one | | `0..1` | Zero or one | | `*` | Many | | `1..*` | One or more | | `n..m` | Range | --- ## ER Diagram ### Basic Structure ```mermaid erDiagram USER ||--o{ ORDER : places ORDER ||--|{ ORDER_ITEM : contains PRODUCT ||--o{ ORDER_ITEM : "included in" USER { int id PK string name string email datetime created_at } ORDER { int id PK int user_id FK float total string status } ORDER_ITEM { int order_id FK int product_id FK int quantity } ``` ### Relationship Notation | Left | Right | Meaning | |------|-------|---------| | `\|\|` | `\|\|` | One to one | | `\|\|` | `o{` | One to zero or many | | `\|\|` | `\|{` | One to one or many | | `o\|` | `o{` | Zero or one to zero or many | ### Attribute Types ```mermaid erDiagram PRODUCT { int id PK "Primary key" string name "Product name" float price int category_id FK "Foreign key" string sku UK "Unique key" } ``` Markers: `PK` (primary), `FK` (foreign), `UK` (unique) # Flowchart Syntax ## Basic Structure ```mermaid flowchart TD A[Client] --> B[API Gateway] B --> C[Auth Service] B --> D[Order Service] D --> E[(Order DB)] C --> F[(User DB)] subgraph Services C D end ``` ## Direction | Keyword | Direction | |---------|-----------| | `TD` / `TB` | Top to bottom | | `LR` | Left to right | | `RL` | Right to left | | `BT` | Bottom to top | ## Node Shapes | Syntax | Shape | Use for | |--------|-------|---------| | `[text]` | Rectangle | Default nodes | | `(text)` | Rounded rectangle | Processes | | `{text}` | Diamond | Decisions | | `[(text)]` | Cylinder | Databases | | `[[text]]` | Subroutine | External calls | | `((text))` | Circle | Start/end points | | `>text]` | Flag | Async events | | `{{text}}` | Hexagon | Preparation steps | ## Arrow Types | Syntax | Style | Use for | |--------|-------|---------| | `-->` | Arrow | Normal flow | | `---` | Line | Connection (no direction) | | `-.->` | Dashed arrow | Optional/async | | `==>` | Thick arrow | Important flow | | `--x` | X end | Termination | | `--o` | Circle end | Reference | ## Labels on Arrows ```mermaid flowchart LR A -->|yes| B A -->|no| C B -->|"with quotes"| D ``` ## Subgraphs ```mermaid flowchart TD subgraph "Frontend Layer" A[Web App] B[Mobile App] end subgraph "Backend Layer" C[API Server] D[Worker] end A & B --> C C --> D ``` ## Special Characters Wrap in quotes for special characters: ```mermaid flowchart LR A["Node: with colon"] B["Node (with parens)"] A --> B ``` # Other Diagram Types ## State Diagram ```mermaid stateDiagram-v2 [*] --> Pending Pending --> Processing : payment_received Processing --> Shipped : packed Shipped --> Delivered : received Processing --> Cancelled : cancel Pending --> Cancelled : cancel Delivered --> [*] Cancelled --> [*] ``` ### Composite States ```mermaid stateDiagram-v2 [*] --> Active stat