Mermaid Diagrams
by FullFran
Expert guidance on creating accurate, visually polished Mermaid diagrams for architecture documentation.
Skill Details
Repository Files
1 file in this skill directory
name: mermaid-diagrams description: Expert guidance on creating accurate, visually polished Mermaid diagrams for architecture documentation.
Mermaid Diagrams Skill
This skill provides patterns and best practices for creating high-quality Mermaid diagrams that accurately document software architecture.
When to Use
- Creating C4 zoom-in diagrams for services
- Documenting sequence flows with parallel execution
- Visualizing component dependencies
- Building flowcharts for decision logic
Diagram Types
1. Sequence Diagrams (Temporal Flow)
Best for showing how components interact over time.
sequenceDiagram
autonumber
participant A as ComponentA
participant B as ComponentB
participant C as ExternalService
A->>B: method_call(args)
activate B
par Parallel Operations
B->>C: async_operation_1()
C-->>B: result_1
and
B->>C: async_operation_2()
C-->>B: result_2
end
B-->>A: combined_result
deactivate B
Key elements:
autonumber: Adds step numbers for referenceactivate/deactivate: Shows component lifecyclepar/and/end: Visualizes parallel executionNote over X: Adds contextual annotations
2. Flowchart (Component Diagram)
Best for showing static dependencies between components.
flowchart TB
subgraph Service["ServiceName"]
direction TB
method1["public_method()"]
method2["_private_method()"]
method1 --> method2
end
subgraph Interfaces["Abstractions"]
direction LR
IInterface1([Interface1])
IInterface2[(Interface2)]
end
method1 -.->|uses| IInterface1
method2 -.->|calls| IInterface2
%% Styling
style Service fill:#1a1a2e,stroke:#16213e,stroke-width:2px,color:#eaeaea
style Interfaces fill:#0f3460,stroke:#1a1a2e,stroke-width:2px,color:#eaeaea
style method1 fill:#e94560,stroke:#1a1a2e,color:#fff
style method2 fill:#533483,stroke:#1a1a2e,color:#fff
Key elements:
subgraph: Groups related componentsdirection TB/LR: Controls flow direction-.->: Dashed arrows for dependenciesstyle: Custom colors per node
3. C4 Container Diagram
For high-level system architecture:
flowchart TB
subgraph System["System Boundary"]
subgraph Layer1["Presentation Layer"]
UI[Web UI]
CLI[CLI Tool]
end
subgraph Layer2["Service Layer"]
SVC[Core Service]
end
subgraph Layer3["Data Layer"]
DB[(Database)]
Cache[(Cache)]
end
end
UI --> SVC
CLI --> SVC
SVC --> DB
SVC --> Cache
%% Layer colors
style Layer1 fill:#2d3436,stroke:#636e72
style Layer2 fill:#0984e3,stroke:#74b9ff
style Layer3 fill:#00b894,stroke:#55efc4
Styling Guidelines
Color Palette (Dark Theme)
| Layer | Fill | Stroke | Text |
|---|---|---|---|
| Container | #1a1a2e |
#16213e |
#eaeaea |
| Interfaces | #0f3460 |
#1a1a2e |
#eaeaea |
| Public Methods | #e94560 |
#1a1a2e |
#fff |
| Private Methods | #533483 |
#1a1a2e |
#fff |
| External | #0f4c75 |
#1b262c |
#bbe1fa |
Node Shapes
| Shape | Syntax | Use Case |
|---|---|---|
| Rectangle | [Label] |
Methods, components |
| Stadium | ([Label]) |
Interfaces |
| Cylinder | [(Label)] |
Databases, repositories |
| Circle | ((Label)) |
Entry/exit points |
| Hexagon | {{Label}} |
Decision nodes |
Best Practices
- Match the code: Use actual method/class names from the implementation
- Show parallelism: Use
parblocks for concurrent operations - Layer by abstraction: Group by architectural layer (UI, Service, Data)
- Consistent styling: Apply the same color scheme across all diagrams
- Add context: Use
Noteannotations for non-obvious logic - Test rendering: Verify in mermaid.live before committing
Documentation Template
When documenting a service, include:
- Responsibility: One-paragraph description of the component's role
- Sequence Diagram: For the primary use case flow
- Component Diagram: For static dependencies
- Method Table: Key methods with brief descriptions
Verification Checklist
- Diagram renders without errors in Mermaid preview
- All node names match actual code identifiers
- Parallel operations are properly visualized
- Colors are consistent with the project palette
- Arrows correctly show dependency direction
Related Skills
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Clinical Decision Support
Generate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug develo
Scientific Schematics
Create publication-quality scientific diagrams using Nano Banana Pro AI with smart iterative refinement. Uses Gemini 3 Pro for quality review. Only regenerates if quality is below threshold for your document type. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.
Mermaid Diagrams
Comprehensive guide for creating software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams (domain modeling, object-oriented design), sequence diagrams (application flows, API interactions, code execution), flowcharts (processes, algorithms, user journeys), entity relationship diagrams (database schemas), C4 architecture diagrams (system context, containers, components), state diagrams, git graphs, pie charts,
Diagram Generation
Mermaid diagram generation for architecture visualization, data flow diagrams, and component relationships. Use for documentation, PR descriptions, and architectural analysis.
Scientific Schematics
Create publication-quality scientific diagrams using Nano Banana Pro AI with smart iterative refinement. Uses Gemini 3 Pro for quality review. Only regenerates if quality is below threshold for your document type. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.
Clinical Decision Support
Generate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug develo
Materialize Docs
Materialize documentation for SQL syntax, data ingestion, concepts, and best practices. Use when users ask about Materialize queries, sources, sinks, views, or clusters.
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Mermaidjs V11
Create 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.
