Automatically invoked when creating visual diagrams (flowcharts, sequence diagrams, ERDs, state machines, user journeys). Ensures proper Mermaid syntax and diagram clarity.
This skill activates when you need to create visual documentation using Mermaid diagrams.
Automatically engage when:
Use for: Process flows, decision trees, algorithm logic Best when: Showing sequential steps and decision points
Use for: Component interactions, API calls, time-based processes Best when: Showing how components communicate over time
Use for: Database schemas, data models, relationships Best when: Designing or documenting data structure
Use for: State machines, lifecycle flows, status transitions Best when: Tracking object states and transitions
Use for: User experience flows, emotional journey, touchpoints Best when: Understanding user perspective through process
Match diagram type to information structure
flowchart TD
Start([Start]) --> Process[Process Step]
Process --> Decision{Decision?}
Decision -->|Yes| Action1[Action 1]
Decision -->|No| Action2[Action 2]
Action1 --> End([End])
Action2 --> End
[] Rectangle (process)() Rounded rectangle (start/end){} Diamond (decision)[()] Stadium (start/end alt)[[]] Subroutine[()] DatabaseTD or TB - Top to bottomLR - Left to rightRL - Right to leftBT - Bottom to topsequenceDiagram
participant A as Client
participant B as API
participant C as Database
A->>B: POST /users
activate B
B->>C: INSERT user
activate C
C-->>B: User ID
deactivate C
B-->>A: 201 Created
deactivate B
-> Solid line--> Dotted line->> Solid arrow-->> Dotted arrowactivate Actor - Show activedeactivate Actor - Show inactiveerDiagram
USER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
PRODUCT ||--o{ LINE_ITEM : "ordered in"
USER {
int id PK
string email UK
string name
datetime created_at
}
ORDER {
int id PK
int user_id FK
decimal total
string status
}
||--|| One to one||--o{ One to many}o--o{ Many to many||--o| One to zero or onePK - Primary KeyFK - Foreign KeyUK - Unique KeystateDiagram-v2
[*] --> Draft
Draft --> Submitted : submit()
Submitted --> Approved : approve()
Submitted --> Rejected : reject()
Approved --> Published : publish()
Published --> Archived : archive()
Rejected --> [*]
Archived --> [*]
[*] - Start/End statejourney
title Online Shopping Experience
section Browse
Visit site: 5: Customer
View products: 4: Customer
Filter results: 3: Customer
section Purchase
Add to cart: 5: Customer
Enter payment: 2: Customer
Complete order: 5: Customer
section Post-Purchase
Receive email: 4: Customer
Track shipment: 5: Customer
flowchart TD
ValidateInput[Validate User Input] --> CheckAuth{User Authenticated?}
flowchart TD
A[Validate] --> B{Auth?}
flowchart TD
Start([User Login]) --> ValidEmail{Valid Email?}
ValidEmail -->|Yes| CheckPassword{Valid Password?}
ValidEmail -->|No| ShowError[Show Email Error]
CheckPassword -->|Yes| Success[Login Success]
CheckPassword -->|No| ShowError2[Show Password Error]
Don't try to fit an entire system in one diagram - break into multiple focused diagrams
flowchart TD
A --> B
B --> C
C --> D
Organize nodes to minimize line crossings
When creating a diagram, provide:
# [Diagram Title]
[Brief description of what this diagram shows and why it's important]
```mermaid
[diagram code]
```
## Key Elements
- **[Element Name]**: Description of what it represents
- **[Element Name]**: Description
## Flow Description
[Step-by-step walkthrough if needed]
## Notes
- [Important consideration]
- [Edge case or special behavior]
Save diagrams to:
docs/architecture/diagrams/[name].mddocs/features/[feature-name]-[type].mddocs/architecture/models/[name].md[subject]-[diagram-type].md
Examples:
authentication-flow.mdorder-checkout-sequence.mduser-order-erd.mdorder-status-state.mdsequenceDiagram
Client->>API: Request
API->>Validation: Validate
alt Valid
API->>Service: Process
Service->>DB: Query
DB-->>Service: Data
Service-->>API: Result
API-->>Client: 200 OK
else Invalid
API-->>Client: 400 Bad Request
end
flowchart TD
Start([User Login]) --> Submit[Submit Credentials]
Submit --> Validate{Valid?}
Validate -->|Yes| CheckMFA{MFA Enabled?}
Validate -->|No| Error[Show Error]
CheckMFA -->|Yes| SendCode[Send MFA Code]
CheckMFA -->|No| Success[Login Success]
SendCode --> VerifyCode{Code Valid?}
VerifyCode -->|Yes| Success
VerifyCode -->|No| Error
Error --> Start
Success --> Dashboard[Redirect to Dashboard]
stateDiagram-v2
[*] --> Idle
Idle --> Loading : fetch()
Loading --> Success : data received
Loading --> Error : fetch failed
Success --> Idle : reset()
Error --> Idle : reset()
Error --> Loading : retry()
erDiagram
USER ||--o{ POST : writes
USER ||--o{ COMMENT : writes
POST ||--o{ COMMENT : has
USER {
int id PK
string email UK
string username UK
datetime created_at
}
POST {
int id PK
int author_id FK
string title
text content
datetime published_at
}
COMMENT {
int id PK
int post_id FK
int author_id FK
text content
datetime created_at
}
Before finalizing:
.claude/skills/generate-mermaid/references/mermaid-syntax.md.claude/skills/generate-mermaid/references/common-patterns.md