Mermaid Diagram Specialist
Overview
Purpose: Expert in creating comprehensive Mermaid diagrams for
documentation, architecture visualization, and process mapping
Category: Tech Primary Users: tech-writer, architecture-validator,
product-technical, tech-lead
When to Use This Skill
- Creating architecture documentation
- Visualizing workflows and processes
- Documenting data models (ERDs)
- Explaining sequence flows
- Creating state machines
- Documenting component relationships
- Creating decision trees
- Visualizing user journeys
Prerequisites
Required:
- Understanding of the system/process to document
- Access to technical specifications
- Knowledge of diagram type needed
Optional:
- Design system colors for consistency
- Existing documentation to reference
Input
What the skill needs:
- Process/system description
- Entities and relationships (for ERDs)
- Component interactions (for sequence diagrams)
- Architecture layers (for C4 diagrams)
- States and transitions (for state diagrams)
Workflow
Step 1: Diagram Type Selection
Objective: Choose appropriate diagram type for requirements
Available Diagram Types:
- Flowchart: Decision flows, algorithms, processes
- Sequence Diagram: API interactions, message flows
- ERD: Database schemas, entity relationships
- Class Diagram: Object-oriented design
- State Diagram: State machines, lifecycle
- Gantt Chart: Project timelines, schedules
- C4 Diagram: Architecture at different levels
- Pie/Bar Charts: Data visualization
- Git Graph: Version control flows
- User Journey: User experience flows
Decision Matrix:
- Process with decisions → Flowchart
- API/system interactions → Sequence Diagram
- Database structure → ERD
- System architecture → C4 Diagram
- Object relationships → Class Diagram
- State transitions → State Diagram
- Project timeline → Gantt Chart
Validation:
Output: Selected diagram type
Step 2: Flowchart Creation
Objective: Create process and decision flow diagrams
Syntax:
Node Shapes:
[Rectangle] - Process step
([Rounded]) - Start/End
{Diamond} - Decision
[/Parallelogram/] - Input/Output
[(Database)] - Data storage
((Circle)) - Connector
Direction Options:
TD - Top to Down
LR - Left to Right
BT - Bottom to Top
RL - Right to Left
Example - Booking Flow:
Validation:
Output: Process flowchart
Step 3: Sequence Diagram Creation
Objective: Document API interactions and message flows
Syntax:
Participant Types:
actor - Human user
participant - System/Service
database - Database
Arrow Types:
-> - Solid line (synchronous)
--> - Dotted line (response)
->> - Solid arrow (async message)
-->> - Dotted arrow (async response)
Example - Authentication Flow:
Validation:
Output: Sequence diagram
Step 4: ERD Creation
Objective: Document database schema and relationships
Syntax:
Relationship Types:
||--|| - One to one
||--o{ - One to many
}o--o{ - Many to many
||--o| - One to zero or one
Cardinality Symbols:
|| - Exactly one
o| - Zero or one
}o - Zero or more
}| - One or more
Example - Full Hospeda ERD:
Validation:
Output: ERD diagram
Step 5: C4 Architecture Diagrams
Objective: Document system architecture at different levels
Context Level (System in environment):
Container Level (Applications and data stores):
Component Level (Internal structure):
Validation:
Output: C4 architecture diagrams
Step 6: State Diagram Creation
Objective: Document state machines and lifecycles
Syntax:
Example - Booking Lifecycle:
Validation:
Output: State diagram
Step 7: Styling and Customization
Objective: Apply consistent styling to diagrams
Theme Application:
Class Styling:
Validation:
Output: Styled diagrams
Output
Produces:
- Mermaid diagram code in markdown
- Multiple diagram types as needed
- Styled and themed diagrams
- Documentation-ready visualizations
Success Criteria:
- Diagram accurately represents system
- All elements properly labeled
- Relationships clear and correct
- Styling consistent with brand
- Renders correctly in markdown
Best Practices
- Simplicity: Keep diagrams focused and uncluttered
- Labels: Clear, descriptive labels for all elements
- Direction: Consistent flow direction (usually top-down or left-right)
- Grouping: Use subgraphs to group related elements
- Colors: Use color to highlight important elements
- Notes: Add notes to explain complex logic
- Levels: Use appropriate abstraction level for audience
- Updates: Keep diagrams in sync with code
- Comments: Add comments in mermaid code for maintainability
- Testing: Verify diagrams render in target platform
Common Patterns
API Request Flow
Error Handling Flow
Notes
- Mermaid renders in GitHub, GitLab, Notion, and most markdown viewers
- Live editor available at mermaid.live
- Maximum complexity: Keep under 20 nodes for readability
- Use subgraphs for grouping related nodes
- Test rendering in target platform before committing
- Keep diagram source in markdown files, not images
- Version control diagrams with code
- Update diagrams during code review