DangQuangSE/team-development-skills / .cursor/skills/mermaidjs-v11
mermaidjs-v11
VerifiedCreate diagrams and visualizations using Mermaid.js v11 syntax. Use when generating flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, user journeys, timelines, architecture diagrams, or any of 24+ diagram types. Supports JavaScript API integration, CLI rendering to SVG/PNG/PDF, theming, configuration, and accessibility features. Essential for documentation, technical diagrams, project planning, system architecture, and visual communication.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.3 KB |
| agents/openai.yaml | config | 365 B |
| references/cli-usage.md | markdown | 4.1 KB |
| references/configuration.md | markdown | 4.6 KB |
| references/diagram-types.md | markdown | 4.9 KB |
| references/examples.md | markdown | 7.0 KB |
| references/integration.md | markdown | 5.7 KB |
references/examples.md
View on GitHub# Mermaid.js Practical Examples
Real-world patterns and use cases for common documentation scenarios.
## Software Architecture
**Microservices Architecture:**
```mermaid
flowchart TB
Client[Web Client]
Gateway[API Gateway]
Auth[Auth Service]
User[User Service]
Order[Order Service]
Payment[Payment Service]
DB1[(Users DB)]
DB2[(Orders DB)]
Cache[(Redis Cache)]
Client --> Gateway
Gateway --> Auth
Gateway --> User
Gateway --> Order
User --> DB1
Order --> DB2
Order --> Payment
User --> Cache
```
**System Components (C4):**
```mermaid
C4Context
Person(customer, "Customer", "A user of the system")
System(app, "Web Application", "Delivers content")
System_Ext(email, "Email System", "Sends emails")
Rel(customer, app, "Uses")
Rel(app, email, "Sends via")
```
## API Documentation
**Authentication Flow:**
```mermaid
sequenceDiagram
participant C as Client
participant A as API
participant D as Database
C->>A: POST /auth/login
activate A
A->>D: Verify credentials
D-->>A: User found
A->>A: Generate JWT
A-->>C: 200 OK + token
deactivate A
C->>A: GET /protected (Bearer token)
activate A
A->>A: Validate JWT
A->>D: Fetch data
D-->>A: Data
A-->>C: 200 OK + data
deactivate A
```
**REST API Endpoints:**
```mermaid
flowchart LR
API[API]
Users[/users]
Posts[/posts]
Comments[/comments]
API --> Users
API --> Posts
API --> Comments
Users --> U1[GET /users]
Users --> U2[POST /users]
Users --> U3[GET /users/:id]
Users --> U4[PUT /users/:id]
Users --> U5[DELETE /users/:id]
```
## Database Design
**E-Commerce Schema:**
```mermaid
erDiagram
CUSTOMER ||--o{ ORDER : places
CUSTOMER {
int id PK
string email
string name
}
ORDER ||--|{ LINE_ITEM : contains
ORDER {
int id PK
int customer_id FK
date created_at
string status
}
PRODUCT ||--o{ LINE_ITEM : includes
PRODUCT {
int id PK
string name
decimal price
int inventory
}
LINE_ITEM {
int order_id FK
int product_id FK
int quantity
decimal unit_price
}
```
## State Machines
**Order Processing:**
```mermaid
stateDiagram-v2
[*] --> Pending
Pending --> Processing : payment_received
Pending --> Cancelled : timeout
Processing --> Shipped : items_packed
Processing --> Failed : error
Shipped --> Delivered : confirmed
Delivered --> [*]
Failed --> Refunded : refund_processed
Cancelled --> [*]
Refunded --> [*]
```
**User Authentication States:**
```mermaid
stateDiagram-v2
[*] --> LoggedOut
LoggedOut --> LoggingIn : submit_credentials
LoggingIn --> LoggedIn : success
LoggingIn --> LoggedOut : failure
LoggedIn --> VerifyingMFA : requires_2fa
VerifyingMFA --> LoggedIn : mfa_success
VerifyingMFA --> LoggedOut : mfa_failure
LoggedIn --> LoggedOut : logout
LoggedIn --> [*]
```
## Project Planning
**Sprint Timeline:**
```mermaid
gantt
title Sprint 12 (2 weeks)
dateFormat YYYY-MM-DD
section Backend
API endpoints :done, api, 2024-01-01, 3d
Database migration :active, db, after api, 2d
Testing :test, after db, 2d
section Frontend
UI components :done, ui, 2024-01-01, 4d
Integration :active, int, after ui, 3d
section DevOps
CI/CD setup :crit, cicd, 2024-01-06, 2d
Deployment :milestone, deploy, after cicd, 1d
```
**Feature Development Journey:**
```mermaid
journey
title Feature Implementation Journey
section Planning
Requirements gathering: 5: PM, Dev, Designer
Tech design: 4: Dev, Architect
section Development
Backend API: 3: Dev
Frontend UI: 4: Dev, Designer
Testing: 5: QA, Dev
section Deployment
Code review: 4: Dev, Lead
Production deploy: 5: DevOps, Dev
```
## Object-Oriented Design
**Payment System Classes:**
```mermaid
classDiagram
class PaymentProcessor {
<<interface>>
+processPayment(amount)
+refund(transactionId)
}
class StripeProcessor {
-apiKey: string
+processPayment(amount)
+refund(transactionId)
}
class PayPalProcessor {
-clientId: string
-secret: string
+processPayment(amount)
+refund(transactionId)
}
class PaymentService {
-processor: PaymentProcessor
+charge(customer, amount)
+issueRefund(orderId)
}
PaymentProcessor <|.. StripeProcessor
PaymentProcessor <|.. PayPalProcessor
PaymentService --> PaymentProcessor
```
## CI/CD Pipeline
**Deployment Flow:**
```mermaid
flowchart LR
Code[Push Code] --> CI{CI Checks}
CI -->|Pass| Build[Build]
CI -->|Fail| Notify1[Notify Team]
Build --> Test[Run Tests]
Test -->|Pass| Stage[Deploy Staging]
Test -->|Fail| Notify2[Notify Team]
Stage --> Manual{Manual Approval}
Manual -->|Approved| Prod[Deploy Production]
Manual -->|Rejected| End1[End]
Prod --> Monitor[Monitor]
Monitor --> End2[End]
```
**Git Branching Strategy:**
```mermaid
gitGraph
commit
branch develop
checkout develop
commit
branch feature/auth
checkout feature/auth
commit
commit
checkout develop
merge feature/auth
checkout main
merge develop tag: "v1.0.0"
checkout develop
branch feature/payments
checkout feature/payments
commit
checkout develop
merge feature/payments
checkout main
merge develop tag: "v1.1.0"
```
## User Experience
**Customer Onboarding:**
```mermaid
journey
title New Customer Onboarding
section Discovery
Visit website: 3: Customer
Browse products: 4: Customer
section Signup
Create account: 2: Customer
Email verification: 3: Customer, System
section First Purchase
Add to cart: 5: Customer
Checkout: 4: Customer
Payment: 3: Customer, Payment Gateway
section Post-purchase
Order confirmation: 5: Customer, System
First delivery: 5: Customer, Delivery
```
## Cloud Infrastructure
**AWS Architecture:**
```mermaid
architecture-beta
group vpc(cloud)[VPC]
group public(cloud)[Public Subnet] in vpc
group private(cloud)[Private Subnet] in vpc
service lb(internet)[Load Balancer] in public
service web(server)[Web Servers] in public
service api(server)[API Servers] in private
service db(database)[RDS Database] in private
service cache(disk)[ElastiCache] in private
lb:B --> T:web
web:B --> T:api
api:R --> L:db
api:R --> L:cache
```
## Data Visualization
**Traffic Analysis:**
```mermaid
pie showData
title Traffic Sources Q4 2024
"Organic Search" : 45.5
"Direct" : 25.3
"Social Media" : 15.8
"Referral" : 8.4
"Paid Ads" : 5.0
```
**Team Skills Assessment:**
```mermaid
radar-beta
axis Frontend, Backend, DevOps, Testing, Design
curve Alice{5, 3, 2, 4, 2}
curve Bob{3, 5, 4, 3, 1}
curve Carol{4, 4, 5, 5, 3}
```
## Best Practices
**Naming Conventions:**
- Use descriptive node IDs: `userService` not `A`
- Clear labels: `[User Service]` not `[US]`
- Meaningful connections: `-->|authenticates|` not `-->`
**Styling Tips:**
```mermaid
%%{init: {'theme':'dark', 'themeVariables': {'primaryColor':'#ff6347'}}}%%
flowchart TD
classDef important fill:#f96,stroke:#333,stroke-width:4px
A[Critical Path]:::important
B[Regular Task]
```
**Security:**
Use `securityLevel: 'strict'` to prevent XSS in user-generated diagrams.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |