skills/43-wentorai-research-plugins/skills/tools/diagram/mermaid-diagram-guide/SKILL.md
Create flowcharts, sequence diagrams, and architecture diagrams with Mermaid
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research mermaid-diagram-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Mermaid is a text-based diagramming tool that renders diagrams from Markdown-like syntax. For researchers, Mermaid offers a unique combination of version-controllable source code, instant rendering in documentation platforms (GitHub, GitLab, Notion, Obsidian), and enough expressiveness to create flowcharts, sequence diagrams, class diagrams, Gantt charts, and more.
Unlike graphical tools like draw.io or Lucidchart, Mermaid diagrams live as plain text in your documentation, making them easy to maintain alongside code and papers. They are especially valuable for research documentation, README files, software architecture diagrams in methods sections, and graphical abstracts.
This guide covers the most useful Mermaid diagram types for academic work, with complete syntax references and real-world examples from research contexts. Each diagram type includes a template you can copy and modify for your specific needs.
Flowcharts are the most common diagram type for describing algorithms, experimental procedures, and data processing pipelines.
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Process A]
B -->|No| D[Process B]
C --> E[End]
D --> E
| Shape | Syntax | Use Case |
|-------|--------|----------|
| Rectangle | A[text] | Process step |
| Rounded | A(text) | Start/end |
| Diamond | A{text} | Decision |
| Hexagon | A{{text}} | Preparation |
| Parallelogram | A[/text/] | Input/output |
| Circle | A((text)) | Connector |
| Stadium | A([text]) | Terminal |
flowchart TD
subgraph Data Collection
A[Raw Data] --> B[Quality Check]
B --> C{Pass QC?}
C -->|No| D[Exclude]
C -->|Yes| E[Clean Data]
end
subgraph Analysis
E --> F[Feature Extraction]
F --> G[Model Training]
G --> H[Cross-Validation]
end
subgraph Evaluation
H --> I{Significant?}
I -->|Yes| J[Report Results]
I -->|No| K[Revise Hypothesis]
K --> F
end
style A fill:#3B82F6,color:#fff
style J fill:#16A34A,color:#fff
style D fill:#EF4444,color:#fff
| Direction | Code | Description |
|-----------|------|-------------|
| Top to bottom | TD or TB | Default, vertical |
| Bottom to top | BT | Vertical, upward |
| Left to right | LR | Horizontal |
| Right to left | RL | Horizontal, reversed |
Sequence diagrams show interactions between components over time. They are ideal for describing API calls, protocol steps, and system interactions.
sequenceDiagram
participant U as User
participant F as Frontend
participant A as API Server
participant DB as Database
U->>F: Submit experiment
F->>A: POST /experiments
A->>DB: INSERT experiment
DB-->>A: experiment_id
A->>A: Queue processing job
Note over A: Async processing begins
A-->>F: 202 Accepted {id}
F-->>U: "Experiment submitted"
loop Every 5 seconds
F->>A: GET /experiments/{id}/status
A-->>F: {status: "running"}
end
A-->>F: {status: "complete", results: {...}}
F-->>U: Display results
| Arrow | Syntax | Meaning |
|-------|--------|---------|
| Solid with arrowhead | ->> | Synchronous call |
| Dotted with arrowhead | -->> | Response/return |
| Solid | -> | Message |
| Dotted | --> | Optional message |
| Cross | -x | Failed message |
Class diagrams document code architecture and data models:
classDiagram
class Experiment {
+String id
+String name
+DateTime created_at
+Status status
+run()
+get_results() Results
}
class Dataset {
+String path
+int n_samples
+int n_features
+load() DataFrame
+split(ratio) TrainTest
}
class Model {
+String architecture
+Dict hyperparams
+train(Dataset)
+predict(Dataset) Array
+evaluate(Dataset) Metrics
}
Experiment "1" --> "1..*" Dataset : uses
Experiment "1" --> "1..*" Model : trains
Model ..> Dataset : depends on
Gantt charts are useful for project timelines and research plans:
gantt
title Research Project Timeline
dateFormat YYYY-MM-DD
axisFormat %b %Y
section Literature Review
Survey existing work :done, lit1, 2026-01-01, 30d
Identify research gap :done, lit2, after lit1, 14d
section Methodology
Design experiments :active, meth1, after lit2, 21d
Implement baseline :meth2, after meth1, 14d
section Experiments
Run baseline experiments :exp1, after meth2, 21d
Run proposed method :exp2, after exp1, 21d
Ablation studies :exp3, after exp2, 14d
section Writing
Draft paper :write1, after exp2, 30d
Internal review :write2, after write1, 14d
Submit to conference :milestone, after write2, 0d
State diagrams model entity lifecycles:
stateDiagram-v2
[*] --> Draft
Draft --> UnderReview : Submit
UnderReview --> MinorRevision : Reviewer feedback
UnderReview --> MajorRevision : Reviewer feedback
UnderReview --> Rejected : Reviewer feedback
MinorRevision --> UnderReview : Resubmit
MajorRevision --> UnderReview : Resubmit
UnderReview --> Accepted : Final decision
Accepted --> Published : Camera-ready
Rejected --> Draft : Revise for new venue
Published --> [*]
Both platforms render Mermaid natively in Markdown files:
```mermaid
flowchart LR
A --> B --> C
```
# Install Mermaid CLI
npm install -g @mermaid-js/mermaid-cli
# Render to PNG
mmdc -i diagram.mmd -o diagram.png -w 1200
# Render to SVG (preferred for papers)
mmdc -i diagram.mmd -o diagram.svg
# Render to PDF
mmdc -i diagram.mmd -o diagram.pdf
% Include the SVG generated by mmdc
\usepackage{svg}
\begin{figure}[h]
\centering
\includesvg[width=0.8\textwidth]{diagram}
\caption{System architecture overview.}
\end{figure}
development
Conduct rigorous thematic analysis (TA) of qualitative data following Braun and Clarke's (2006) six-phase framework. Use whenever the user mentions 'thematic analysis', 'TA', 'Braun and Clarke', 'qualitative coding', 'identifying themes', or asks for help analysing interviews, focus groups, open-ended survey responses, or transcripts to identify patterns. Also trigger for questions about inductive vs theoretical coding, semantic vs latent themes, essentialist vs constructionist epistemology, building a thematic map, or writing up a qualitative findings section. Covers all six phases, the four upfront analytic decisions, the 15-point quality checklist, and the five common pitfalls. Produces a Word document write-up and an annotated thematic map. Does NOT cover IPA, grounded theory, discourse analysis, conversation analysis, or narrative analysis — use a different method for those.
development
Guide users through writing a systematic literature review (SLR) following the PRISMA 2020 framework. Use this skill whenever the user mentions 'systematic review', 'systematic literature review', 'SLR', 'PRISMA', 'PRISMA 2020', 'PRISMA flow diagram', 'PRISMA checklist', or asks for help writing, structuring, or auditing a literature review that follows reporting guidelines. Also trigger when the user asks about inclusion/exclusion criteria for a review, search strategies for databases like Scopus/WoS/PubMed, study selection processes, risk of bias assessment, or narrative synthesis for a review paper. This skill covers the full PRISMA 2020 checklist (27 items), produces a Word document manuscript in strict journal article format, generates an annotated PRISMA flow diagram, and enforces APA 7th Edition referencing throughout. It does NOT cover meta-analysis or statistical pooling. By Chuah Kee Man.
testing
Performs placebo-in-time sensitivity analysis with hierarchical null model and optional Bayesian assurance. Use when checking model robustness, verifying lack of pre-intervention effects, or estimating study power.
data-ai
Fit, summarize, plot, and interpret a chosen CausalPy experiment. Use after the causal method has been selected, including when configuring PyMC/sklearn models and scale-aware custom priors.