Introduction¶
When creating diagrams for documentation, reviews, or proposals, it is common to write Mermaid by hand or let an AI model “write a snippet” and then fix the syntax manually. The latter often leads to issues such as incorrect arrow syntax, unquoted Chinese labels, or layout corruption caused by overly long node names, resulting in the diagram failing to render directly in the Markdown preview.
The following is an introduction to Mermaid Diagram (coordinate @clawhub_pupujanet-eng/mermaid-diagram) on SkillHub. It integrates “diagram type selection, adherence to output rules, and reference to syntax guides” into the Skill instructions, guiding the Agent to generate syntactically valid Mermaid diagrams. It covers common types such as flowcharts, sequence diagrams, mind maps, ER diagrams, and user journeys. This Skill is marked with requires_api_key=false and does not depend on an additional API key.
What is this¶
Mermaid Diagram is an Agent Skill for coding assistants (based on the general SKILL.md format). It is maintained by pupujanet-eng, distributed via clawhub, categorized under dev-programming on SkillHub, and is currently at version 1.0.0.
It can be summarized in one sentence: based on text or product descriptions, it generates Mermaid code blocks that can be directly inserted into Markdown, while attempting to avoid common syntax errors.
- SkillHub Page: https://www.skillhub.cn/skills/clawhub_pupujanet-eng/mermaid-diagram
- Upstream Description: https://clawhub.ai/pupujanet-eng/mermaid-diagram
- Installation Entry (API Coordinate): https://api.skillhub.cn/zcwl/mermaid-diagram
Core Functions¶
The following capabilities are derived from the upstream Skill documentation and have been verified.
Supported Diagram Types¶
The Skill includes a “Requirement → Recommended Type → Mermaid Keyword” mapping table to facilitate selection based on the scenario:
| Requirement | Recommended Type | Mermaid Keyword |
|---|---|---|
| Business/Logic Flow | Flowchart | flowchart TD |
| System Interaction / API Sequence | Sequence | sequenceDiagram |
| Product Architecture / System Structure | Flowchart / C4 | flowchart LR |
| State Machine / User Status | State | stateDiagram-v2 |
| Brainstorming / Feature Tree | Mindmap | mindmap |
| Database Structure | ER | erDiagram |
| Project Timeline | Timeline | timeline |
| User Journey | Journey | journey |
Output Rules¶
When the Agent outputs according to the Skill’s conventions, it must ensure that:
- The result is always enclosed in a
```mermaidcode block. - If the user describes the content in Chinese, node names and labels should preferably be in Chinese.
- For complex diagrams, use
%%comments to indicate section meanings. - Keep node names as short as possible (the documentation suggests under 10 characters) to mitigate layout issues.
- Logically self-check syntax before outputting, and avoid issues such as: unquoted labels with spaces or Chinese characters, mixed arrow syntax (
-->/---/->>), or unclosed brackets.
Reference Materials¶
The Skill mentions references/diagram-patterns.md, which contains diagram patterns commonly used by product managers and complete examples. When a user specifies a diagram type or requires a complex multi-node diagram, the Agent should read this reference.
Installation and Activation¶
Via SkillHub (Recommended for domestic environments)¶
First, check if SkillHub CLI is already installed on your machine:
command -v skillhub && skillhub --version
If it is not installed, you can follow the official installation documentation to perform a full installation or install only the CLI:
# Full installation (CLI + Default Skills, Recommended)
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash
# CLI only installation
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash -s -- --cli-only
When installing this Skill, you must use --dir to point to the current Agent’s skills directory; otherwise, it defaults to ./skills/ and may not be recognized. In Cursor, the common path is:
skillhub install @clawhub_pupujanet-eng/mermaid-diagram --dir ~/.cursor/skills/
You can also send the prompt below to an AI to let it complete the installation according to https://skillhub.cn/install/skillhub.md:
Please install `@clawhub_pupujanet-eng/mermaid-diagram` based on https://skillhub.cn/install/skillhub.md.
Common skills directories for other clients (excerpted from SkillHub installation documentation for comparison):
- Claude Code:
~/.claude/skills/ - Codex:
~/.codex/skills/or.agents/skills/in the project
Via OpenClaw / ClawHub¶
The installation command provided on the upstream page is:
openclaw skills install @pupujanet-eng/mermaid-diagram
The coordinate on the SkillHub side is @clawhub_pupujanet-eng/mermaid-diagram, while on ClawHub it is @pupujanet-eng/mermaid-diagram. These represent the same skill in different namespaces; use the one corresponding to the store CLI you are currently using.
After installation, restart or refresh the skills directory according to the requirements of the Agent being used to activate the Skill.
Typical Usage¶
Once the Skill is enabled, simply describe “what to draw and who it is for” in natural language; the Agent should select the correct diagram type and return a mermaid code block. The following snippets are from the upstream Quick Syntax Reference and can be used directly as conversation examples or self-check templates.
Flowchart Example:
flowchart TD
A[Start] --> B{Condition}
B -- Yes --> C[Execute Operation]
B -- No --> D[End]
C --> D
Sequence Diagram Example:
sequenceDiagram
User->>Server: Initiate Request
Server->>Database: Query Data
Database-->>Server: Return Result
Server-->>User: Response
Mindmap Example:
mindmap
root((Product Name))
Feature A
Sub-feature 1
Sub-feature 2
Feature B
In actual conversations, requests can be more specific, such as: “Use flowchart TD to draw user login branches with Chinese labels” or “Draw a sequenceDiagram for API order placement, including payment callbacks.” For complex scenarios, you can explicitly ask the Agent to consult diagram-patterns.md.
Use Cases and Notes¶
Who it is for
- Developers who need to quickly insert Mermaid into PRs, design documents, and Wikis.
- Scenarios where users want to reduce “model output diagram syntax errors and repeated manual corrections.”
- Product or architecture discussions requiring standard diagram types (flowcharts, sequences, ER, journeys) with unified output rules.
Usage Notes
- The Skill constrains generation standards but does not replace your verification of Mermaid version and feature compatibility on the target platform (GitHub, Notion, self-built renderers).
- When there are too many nodes, the layout may become crowded even if the syntax is correct; you can request splitting into multiple diagrams or shortening node names.
- The ratings and download counts displayed on the SkillHub page change over time; please refer to the current page data.
Conclusion¶
Mermaid Diagram integrates diagram type selection, output formatting, and common syntax pitfalls into a Skill, enabling the Agent to deliver renderable Mermaid more reliably for “diagrammatic” tasks. To install from a domestic store, you can start from the SkillHub page or the installation API coordinate:
https://www.skillhub.cn/skills/clawhub_pupujanet-eng/mermaid-diagram
https://api.skillhub.cn/zcwl/mermaid-diagram
```