mermaid-diagram-generator▌
rysweet/amplihack · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
This skill automatically converts text descriptions of system architectures, module specifications, workflow documentation, and design concepts into valid Mermaid diagram syntax. It enables clear visual communication of complex systems, ensuring diagrams are production-ready and embeddable in markdown documentation.
Mermaid Diagram Generator Skill
Purpose
This skill automatically converts text descriptions of system architectures, module specifications, workflow documentation, and design concepts into valid Mermaid diagram syntax. It enables clear visual communication of complex systems, ensuring diagrams are production-ready and embeddable in markdown documentation.
When to Use This Skill
- Architecture Visualization: Convert architecture descriptions into flowcharts or block diagrams
- Module Relationships: Create diagrams showing how brick modules connect via their studs (public contracts)
- Workflow Documentation: Visualize workflow states, decisions, and transitions (DDD phases, investigation stages)
- System Design: Display system components, data flow, and interactions
- Sequence Diagrams: Show agent interactions, request/response patterns, or call sequences
- Class Hierarchies: Document module structure and class relationships
- State Machines: Model workflow states and valid transitions
- Entity Relationships: Display data model structures and relationships
- Timeline Planning: Create Gantt charts for project phases or milestones
Supported Diagram Types
1. Flowcharts (Default)
Best for: workflow sequences, decision trees, process flows, module relationships
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Action A]
B -->|No| D[Action B]
C --> E[End]
D --> E
2. Sequence Diagrams
Best for: agent interactions, API calls, multi-step processes, request/response patterns
sequenceDiagram
participant User
participant API
participant Service
User->>API: Request
API->>Service: Process
Service-->>API: Response
API-->>User: Result
3. Class Diagrams
Best for: module structure, inheritance hierarchies, data models, component relationships
classDiagram
class Brick {
+String responsibility
+PublicContract studs
}
class Module {
+init()
+process()
}
Brick <|-- Module
4. State Diagrams
Best for: workflow states, state machines, workflow phases, condition-based transitions
stateDiagram-v2
[*] --> Planning
Planning --> Design
Design --> Implementation
Implementation --> Testing
Testing --> [*]
5. Entity Relationship Diagrams
Best for: data models, database schemas, entity relationships
erDiagram
MODULE ||--o{ FUNCTION : exports
MODULE ||--o{ DEPENDENCY : requires
FUNCTION }o--|| CONTRACT : implements
6. Gantt Charts
Best for: project timelines, workflow phases, milestone planning
gantt
title Project Timeline
section Phase 1
Planning :p1, 0, 30d
Design :p2, after p1, 20d
section Phase 2
Implementation :p3, after p2, 40d
Testing :p4, after p3, 25d
Step-by-Step Generation Process
Step 1: Understand the Source Material
- Read the architecture description, spec, or workflow document
- Identify the main entities or nodes
- Determine how they relate or flow
- Choose the appropriate diagram type
Step 2: Identify Diagram Type
| Source Material | Best Diagram Type |
|---|---|
| Workflow steps, process flow | Flowchart |
| Module relationships, brick connections | Flowchart or Class Diagram |
| Agent interactions, call sequences | Sequence Diagram |
| States and transitions | State Diagram |
| Data models, entities | Class Diagram or ERD |
| Database schema | ERD |
| Project timeline | Gantt Chart |
| Complex hierarchies | Class Diagram |
Step 3: Extract Entities and Relationships
- List all nodes/entities from the source
- Identify connections between them
- Determine connection types (data flow, inheritance, calling, etc.)
- Note any decision points or conditions
Step 4: Generate Mermaid Syntax
- Use appropriate Mermaid diagram declaration
- Create nodes with descriptive labels
- Draw connections with proper syntax
- Add styling if needed for clarity
- Ensure valid Mermaid syntax
Step 5: Validate and Enhance
- Ensure all entities are included
- Verify connections are accurate
- Add styling for important elements
- Make diagram readable and not cluttered
- Test syntax for validity
Step 6: Document and Embed
- Add title and description
- Include explanation of diagram
- Provide legend if needed
- Embed in markdown with proper formatting
Usage Examples
Example 1: Architecture Description to Flowchart
Input:
The authentication module handles JWT token validation. When a request arrives,
it first checks if a token exists. If not, it returns unauthorized. If it does,
it validates the token signature. If valid, it extracts the payload and continues.
If invalid, it returns forbidden. The payload is passed to the authorization
module for role-based access control.
Output:
flowchart TD
A[Request Arrives] --> B{Token Exists?}
B -->|No| C[Return Unauthorized]
B -->|Yes| D{Token Valid?}
D -->|No| E[Return Forbidden]
D -->|Yes| F[Extract Payload]
F --> G[Check Role-Based Access]
G --> H{Authorized?}
H -->|No| I[Return Access Denied]
H -->|Yes| J[Allow Request]
C --> K[End]
E --> K
I --> K
J --> K
Example 2: Module Spec to Class Diagram
Input:
Module: authentication
- Exports: validate_token, TokenPayload, AuthError
- Classes: TokenPayload (user_id, role, expires_at), AuthError (message, code)
- Functions: validate_token(token, secret) -> TokenPayload
- Internal: JWT (PyJWT library), Models (TokenPayload)
Output:
classDiagram
class AuthenticationModule {
+validate_token(token, secret)
+TokenPayload
+AuthError
}
class TokenPayload {
+String user_id
+String role
+DateTime expires_at
+to_dict()
}
class AuthError {
+String message
+Integer code
+__str__()
}
AuthenticationModule -- TokenPayload
AuthenticationModule -- AuthError
Example 3: Workflow to State Diagram
Input:
DDD Workflow: Phase 0 (Planning) -> Phase 1 (Documentation) ->
Approval Gate -> Phase 2 (Code Planning) -> Phase 3 (Implementation) ->
Phase 4 (Testing & Cleanup) -> Complete
Output:
stateDiagram-v2
[*] --> Planning
Planning --> Documentation
Documentation --> ApprovalGate
ApprovalGate --> CodePlanning
CodePlanning --> Implementation
Implementation --> Testing
Testing --> [*]
Example 4: Agent Interaction to Sequence Diagram
Input:
The prompt-writer agent clarifies requirements from the user. It then sends
the clarified requirements to the architect agent. The architect creates a
specification and sends it to the builder agent. The builder implements code
and sends it to the reviewer. The reviewer checks quality and sends feedback
back to the builder if issues are found, or to the user if complete.
Output:
sequenceDiagram
actor User
participant PromptWriter
participant Architect
participant Builder
participant Reviewer
User->>PromptWriter: Request Feature
PromptWriter->>Architect: Clarified Requirements
Architect->>Builder: Specification
Builder->>Reviewer: Implementation
Reviewer-->>Builder: Issues Found
Builder->>Reviewer: Fixed Implementation
Reviewer-->>User: Complete & Approved
Example 5: System Architecture to Flowchart
Input:
Client requests flow through API Gateway to Services. Services can be
Authentication Service, User Service, or Data Service. All services
connect to a shared Database and Logger. Services return responses
through the API Gateway back to Client.
Output:
flowchart LR
Client[Client]
Gateway[API Gateway]
Auth[Auth Service]
User[User Service]
Data[Data Service]
DB[(Database)]
Logger[Logger]
Client <--> Gateway
Gateway --> Auth
Gateway --> User
Gateway --> Data
Auth --> DB
User --> DB
Data --> DB
Auth --> Logger
User --> Logger
Data --> Logger
Mermaid Syntax Reference
Flowchart Nodes
A[Rectangle]
B(Rounded Rectangle)
C{Diamond/Decision}
D[(Database)]
E[/Parallelogram Right/]
F[\Parallelogram Left\]
G[[Subroutine]]
H((Circle))
Flowchart Connections
A --> B # Arrow
A -- Text --> B # Arrow with label
A ---|Yes| B # Arrow with yes/no
A -->|Condition| B
A -.-> B # Dotted line
A ==> B # Bold arrow
Styling
classDef className fill:#f9f,stroke:#333,stroke-width:2px,color:#000
class A,B className
style A fill:#f9f,stroke:#333,stroke-width:4px
Quality Checklist
Before presenting a diagram, verify:
- All entities from source are included
- Connections accurately represent relationships
- Diagram type matches content (flowchart for flows, sequence for interactions, etc.)
- Labels are clear and descriptive
- No circular logic or dead ends (unless intentional)
- Mermaid syntax is valid
- Diagram is readable and not overly complex
- Decision points have clear yes/no paths
- Legend provided if needed for understanding
- Comments explain non-obvious elements
Common Patterns
Brick Module Visualization
flowchart TD
B1["Brick Module 1<br/>(Responsibility)"]
B2["Brick Module 2<br/>(Responsibility)"]
S1["Stud: public_function"]
S2["Stud: public_class"]
B1 -->How to use mermaid-diagram-generator on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add mermaid-diagram-generator
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches mermaid-diagram-generator from GitHub repository rysweet/amplihack and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate mermaid-diagram-generator. Access the skill through slash commands (e.g., /mermaid-diagram-generator) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★66 reviews- ★★★★★Camila Zhang· Dec 24, 2024
Useful defaults in mermaid-diagram-generator — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Camila Liu· Dec 24, 2024
mermaid-diagram-generator fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Aarav Tandon· Dec 12, 2024
We added mermaid-diagram-generator from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Hana Nasser· Dec 4, 2024
We added mermaid-diagram-generator from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Tariq Desai· Nov 23, 2024
Keeps context tight: mermaid-diagram-generator is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Camila Torres· Nov 15, 2024
Registry listing for mermaid-diagram-generator matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Sophia Li· Nov 15, 2024
mermaid-diagram-generator is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Soo Zhang· Nov 3, 2024
Keeps context tight: mermaid-diagram-generator is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Advait Verma· Oct 22, 2024
mermaid-diagram-generator is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Zara Thompson· Oct 14, 2024
mermaid-diagram-generator is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
showing 1-10 of 66