markdown-mermaid-writing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMarkdown and Mermaid Writing
Markdown与Mermaid撰写指南
Overview
概述
This skill teaches you — and enforces a standard for — creating scientific documentation
using markdown with embedded Mermaid diagrams as the default and canonical format.
The core bet: a relationship expressed as a Mermaid diagram inside a file is more
valuable than any image. It is text, so it diffs cleanly in git. It requires no build step.
It renders natively on GitHub, GitLab, Notion, VS Code, and any markdown viewer. It uses
fewer tokens than a prose description of the same relationship. And it can always be
converted to a polished image later — but the text version remains the source of truth.
.md"The more you get your reports and files in .md in just regular text, which mermaid is as well as being a simple 'script language'. This just helps with any downstream rendering and especially AI generated images (using mermaid instead of just long form text to describe relationships < tokens). Additionally mermaid can render along with markdown for easy use almost anywhere by humans or AI."— Clayton Young (@borealBytes), community discussion, 2026-02-19
本技能将教会你——并强制执行一套标准——如何使用嵌入Mermaid图表的Markdown作为默认且权威的格式创建科学文档。
核心理念:在文件中用Mermaid图表表达的关系,比任何图片都更具价值。它是文本格式,在git中能清晰显示差异;无需构建步骤;可在GitHub、GitLab、Notion、VS Code及任何Markdown查看器中原生渲染;相比用散文式描述表达相同关系,它占用的token更少;而且它随时可以转换为精美的图片——但文本版本始终是事实来源。
.md“你越是将报告和文件以纯文本的.md格式保存(Mermaid也属于一种简单的‘脚本语言’),就越有助于后续的渲染工作,尤其是AI生成图像(用Mermaid代替长篇文本描述关系,token消耗更少)。此外,Mermaid可与Markdown一起渲染,方便人类或AI在几乎任何场景下使用。”——Clayton Young (@borealBytes),社区讨论,2026-02-19
When to Use This Skill
何时使用本技能
Use this skill when:
- Creating any scientific document — reports, analyses, manuscripts, methods sections
- Writing any documentation — READMEs, how-tos, decision records, project docs
- Producing any diagram — workflows, data pipelines, architectures, timelines, relationships
- Generating any output that will be version-controlled — if it's going into git, it should be markdown
- Working with any other skill — this skill defines the documentation layer that wraps every other output
- Someone asks you to "add a diagram" or "visualize the relationship" — Mermaid first, always
Do NOT start with Python matplotlib, seaborn, or AI image generation for structural or relational diagrams.
Those are Phase 2 and Phase 3 — only used when Mermaid cannot express what's needed (e.g., scatter plots with real data, photorealistic images).
在以下场景中使用本技能:
- 创建任何科学文档——报告、分析、手稿、方法章节
- 编写任何文档——README、操作指南、决策记录、项目文档
- 制作任何图表——工作流、数据管道、架构、时间线、关系图
- 生成任何需要版本控制的输出内容——如果要存入git,就应该用Markdown格式
- 与任何其他技能配合使用——本技能定义了包裹所有其他输出内容的文档层
- 有人要求你“添加图表”或“可视化关系”时——优先使用Mermaid,始终如此
不要一开始就用Python的matplotlib、seaborn或AI图像生成工具来创建结构或关系型图表。这些属于第二阶段和第三阶段——仅当Mermaid无法表达所需内容时才使用(例如带真实数据的散点图、逼真图像)。
🎨 The Source Format Philosophy
🎨 源格式理念
Why text-based diagrams win
基于文本的图表为何更优
| What matters | Mermaid in Markdown | Python / AI Image |
|---|---|---|
| Git diff readable | ✅ | ❌ binary blob |
| Editable without regenerating | ✅ | ❌ |
| Token efficient vs. prose | ✅ smaller | ❌ larger |
| Renders without a build step | ✅ | ❌ needs hosting |
| Parseable by AI without vision | ✅ | ❌ |
| Works in GitHub / GitLab / Notion | ✅ | ⚠️ if hosted |
| Accessible (screen readers) | ✅ accTitle/accDescr | ⚠️ needs alt text |
| Convertible to image later | ✅ anytime | — already image |
| 关键特性 | Markdown中的Mermaid | Python/AI生成图像 |
|---|---|---|
| Git差异可读性 | ✅ | ❌ 二进制大对象 |
| 无需重新生成即可编辑 | ✅ | ❌ |
| 相比散文式描述更节省token | ✅ 占用更少 | ❌ 占用更多 |
| 无需构建步骤即可渲染 | ✅ | ❌ 需要托管 |
| 无需视觉能力即可被AI解析 | ✅ | ❌ |
| 在GitHub/GitLab/Notion中可用 | ✅ | ⚠️ 需托管 |
| 可访问性(屏幕阅读器) | ✅ 支持accTitle/accDescr | ⚠️ 需要替代文本 |
| 可随时转换为图像 | ✅ 任何时候 | —— 已是图像 |
The three-phase workflow
三阶段工作流
mermaid
flowchart LR
accTitle: Three-Phase Documentation Workflow
accDescr: Phase 1 Mermaid in markdown is always required and is the source of truth. Phases 2 and 3 are optional downstream conversions for polished output.
p1["📄 Phase 1<br/>Mermaid in Markdown<br/>(ALWAYS — source of truth)"]
p2["🐍 Phase 2<br/>Python Generated<br/>(optional — data charts)"]
p3["🎨 Phase 3<br/>AI Generated Visuals<br/>(optional — polish)"]
out["📊 Final Deliverable"]
p1 --> out
p1 -.->|"when needed"| p2
p1 -.->|"when needed"| p3
p2 --> out
p3 --> out
classDef required fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e3a5f
classDef optional fill:#fef9c3,stroke:#ca8a04,stroke-width:2px,color:#713f12
classDef output fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#14532d
class p1 required
class p2,p3 optional
class out outputPhase 1 is mandatory. Even if you proceed to Phase 2 or 3, the Mermaid source stays committed.
mermaid
flowchart LR
accTitle: Three-Phase Documentation Workflow
accDescr: Phase 1 Mermaid in markdown is always required and is the source of truth. Phases 2 and 3 are optional downstream conversions for polished output.
p1["📄 Phase 1<br/>Mermaid in Markdown<br/>(ALWAYS — source of truth)"]
p2["🐍 Phase 2<br/>Python Generated<br/>(optional — data charts)"]
p3["🎨 Phase 3<br/>AI Generated Visuals<br/>(optional — polish)"]
out["📊 Final Deliverable"]
p1 --> out
p1 -.->|"when needed"| p2
p1 -.->|"when needed"| p3
p2 --> out
p3 --> out
classDef required fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e3a5f
classDef optional fill:#fef9c3,stroke:#ca8a04,stroke-width:2px,color:#713f12
classDef output fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#14532d
class p1 required
class p2,p3 optional
class out output第一阶段是强制性的。即使你进入第二或第三阶段,Mermaid源文件也必须保留并提交。
What Mermaid can express
Mermaid可表达的内容
Mermaid covers 24 diagram types. Almost every scientific relationship fits one:
| Use case | Diagram type | File |
|---|---|---|
| Experimental workflow / decision logic | Flowchart | |
| Service interactions / API calls / messaging | Sequence | |
| Data model / schema | ER diagram | |
| State machine / lifecycle | State | |
| Project timeline / roadmap | Gantt | |
| Proportions / composition | Pie | |
| System architecture (zoom levels) | C4 | |
| Concept hierarchy / brainstorm | Mindmap | |
| Chronological events / history | Timeline | |
| Class hierarchy / type relationships | Class | |
| User journey / satisfaction map | User Journey | |
| Two-axis comparison / prioritization | Quadrant | |
| Requirements traceability | Requirement | |
| Flow magnitude / resource distribution | Sankey | |
| Numeric trends / bar + line charts | XY Chart | |
| Component layout / spatial arrangement | Block | |
| Work item status / task columns | Kanban | |
| Cloud infrastructure / service topology | Architecture | |
| Multi-dimensional comparison / skills radar | Radar | |
| Hierarchical proportions / budget | Treemap | |
| Binary protocol / data format | Packet | |
| Git branching / merge strategy | Git Graph | |
| Code-style sequence (programming syntax) | ZenUML | |
| Multi-diagram composition patterns | Complex Examples | |
💡 Pick the right type, not the easy one. Don't default to flowcharts for everything. A timeline beats a flowchart for chronological events. A sequence beats a flowchart for service interactions. Scan the table and match.
Mermaid支持24种图表类型。几乎所有科学关系都能找到对应的类型:
| 使用场景 | 图表类型 | 文件路径 |
|---|---|---|
| 实验工作流/决策逻辑 | 流程图 | |
| 服务交互/API调用/消息传递 | 序列图 | |
| 数据模型/schema | ER图 | |
| 状态机/生命周期 | 状态图 | |
| 项目时间线/路线图 | 甘特图 | |
| 比例/构成 | 饼图 | |
| 系统架构(缩放层级) | C4图 | |
| 概念层级/头脑风暴 | 思维导图 | |
| 时序事件/历史 | 时间线图 | |
| 类层级/类型关系 | 类图 | |
| 用户旅程/满意度地图 | 用户旅程图 | |
| 双轴对比/优先级排序 | 象限图 | |
| 需求可追溯性 | 需求图 | |
| 流大小/资源分布 | 桑基图 | |
| 数值趋势/柱状+折线图 | XY图表 | |
| 组件布局/空间排列 | 块图 | |
| 工作项状态/任务列 | 看板图 | |
| 云基础设施/服务拓扑 | 架构图 | |
| 多维对比/技能雷达 | 雷达图 | |
| 层级比例/预算 | 树状图 | |
| 二进制协议/数据格式 | 数据包图 | |
| Git分支/合并策略 | Git图 | |
| 代码风格序列(编程语法) | ZenUML | |
| 多图表组合模式 | 复杂示例 | |
💡 选择合适的类型,而非简单的类型。不要什么都默认用流程图。对于时序事件,时间线图比流程图更合适;对于服务交互,序列图比流程图更合适。浏览上表,匹配对应的类型。
🔧 Core workflow
🔧 核心工作流
Step 1: Identify the document type
步骤1:确定文档类型
Check if a template exists before writing from scratch:
| Document type | Template |
|---|---|
| Pull request record | |
| Issue / bug / feature request | |
| Sprint / project board | |
| Architecture decision (ADR) | |
| Presentation / briefing | |
| Research paper / analysis | |
| Project documentation | |
| How-to / tutorial | |
| Status report | |
在从头开始撰写前,先检查是否有可用的模板:
| 文档类型 | 模板路径 |
|---|---|
| 拉取请求记录 | |
| 问题/bug/功能请求 | |
| 迭代/项目看板 | |
| 架构决策记录(ADR) | |
| 演示/简报 | |
| 研究论文/分析报告 | |
| 项目文档 | |
| 操作指南/教程 | |
| 状态报告 | |
Step 2: Read the style guide
步骤2:阅读样式指南
Before writing any file: read .
.mdreferences/markdown_style_guide.mdKey rules to internalize:
- One H1 per document — the title. Never more.
- Emoji on H2 headings only — one emoji per H2, none in H3/H4
- Cite everything — every external claim gets a footnote with full URL
[^N] - Bold sparingly — max 2-3 bold terms per paragraph, never full sentences
- Horizontal rule after every — mandatory
</details> - Tables over prose for comparisons, configurations, structured data
- Diagrams over walls of text — if it describes flow, structure, or relationships, add Mermaid
在撰写任何文件前:阅读。
.mdreferences/markdown_style_guide.md需要牢记的关键规则:
- 每个文档仅一个H1标题——即文档标题,绝不能有多个。
- 仅在H2标题中使用表情符号——每个H2标题一个表情符号,H3/H4中不使用。
- 所有内容都要引用——每个外部观点都要添加脚注并附上完整URL。
[^N] - 谨慎使用粗体——每段最多2-3个粗体术语,绝不要整句加粗。
- 每个标签后必须添加水平分隔线——强制性要求。
</details> - 对比、配置、结构化数据优先使用表格而非散文式描述。
- 图表优先于大段文本——如果内容涉及流程、结构或关系,就添加Mermaid图表。
Step 3: Pick the diagram type and read its guide
步骤3:选择图表类型并阅读对应指南
Before creating any Mermaid diagram: read .
references/mermaid_style_guide.mdThen open the specific type file (e.g., ) for the exemplar, tips, and copy-paste template.
references/diagrams/flowchart.mdMandatory rules for every diagram:
accTitle: Short Name 3-8 Words
accDescr: One or two sentences explaining what this diagram shows.- No directives — breaks GitHub dark mode
%%{init} - No inline — use
styleonlyclassDef - One emoji per node max — at the start of the label
- node IDs — match the label
snake_case
在创建任何Mermaid图表前:阅读。
references/mermaid_style_guide.md然后打开对应类型的文件(例如),查看示例、技巧和可复制粘贴的模板。
references/diagrams/flowchart.md每个图表必须遵守的规则:
accTitle: 3-8字的简短名称
accDescr: 1-2句话解释该图表展示的内容。- 禁止使用指令——会破坏GitHub深色模式。
%%{init} - 禁止使用内联——仅使用
style。classDef - 每个节点最多一个表情符号——放在标签开头。
- 节点ID使用命名——与标签匹配。
snake_case
Step 4: Write the document
步骤4:撰写文档
Start from the template. Apply the markdown style guide. Place diagrams inline with related text — not in a separate "Figures" section.
从模板开始撰写。应用Markdown样式指南。将图表与相关文本内联放置——不要放在单独的“图表”章节中。
Step 5: Commit as text
步骤5:以文本形式提交
The file with embedded Mermaid is what gets committed. If you also generated a PNG or AI image, those are supplementary — the markdown is the source.
.md嵌入Mermaid的文件是需要提交的内容。如果你还生成了PNG或AI图像,这些只是补充内容——Markdown文件才是源文件。
.md⚠️ Common pitfalls
⚠️ 常见陷阱
Radar chart syntax (radar-beta
)
radar-beta雷达图语法(radar-beta
)
radar-betaWRONG:
mermaid
radar
title Example
x-axis ["A", "B", "C"]
"Series" : [1, 2, 3]CORRECT:
mermaid
radar-beta
title Example
axis a["A"], b["B"], c["C"]
curve series["Series"]{1, 2, 3}
max 3- Use not
radar-beta(the bare keyword doesn't exist)radar - Use to define dimensions, not
axisx-axis - Use to define data series, not quoted labels with colon
curve - No /
accTitle— radar-beta doesn't support accessibility annotations; always add a descriptive italic paragraph above the diagramaccDescr
错误写法:
mermaid
radar
title Example
x-axis ["A", "B", "C"]
"Series" : [1, 2, 3]正确写法:
mermaid
radar-beta
title Example
axis a["A"], b["B"], c["C"]
curve series["Series"]{1, 2, 3}
max 3- **使用**而非
radar-beta(后者不存在)radar - **使用**定义维度,不要使用
axisx-axis - **使用**定义数据系列,不要使用带冒号的引号标签
curve - 不要添加/
accTitle——radar-beta不支持无障碍注释;务必在图表上方添加一段描述性的斜体文字accDescr
XY Chart vs Radar confusion
XY图表与雷达图的混淆
| Diagram | Keyword | Axis syntax | Data syntax |
|---|---|---|---|
| XY Chart (bars/lines) | | | |
| Radar (spider/web) | | | |
| 图表 | 关键字 | 轴语法 | 数据语法 |
|---|---|---|---|
| XY图表(柱状/折线) | | | |
| 雷达图(蜘蛛/网状) | | | |
Forgetting accTitle
/accDescr
on supported types
accTitleaccDescr忘记在支持的类型中添加accTitle
/accDescr
accTitleaccDescrOnly some diagram types support /. For those that don't, always place a descriptive italic paragraph directly above the code block:
accTitleaccDescrRadar chart comparing three methods across five performance dimensions. Note: Radar charts do not support accTitle/accDescr.
mermaid
radar-beta
...只有部分图表类型支持/。对于不支持的类型,务必在代码块上方直接添加一段描述性的斜体文字:
accTitleaccDescr雷达图比较了三种方法在五个性能维度上的表现。注意:雷达图不支持accTitle/accDescr。
mermaid
radar-beta
...🔗 Integration with other skills
🔗 与其他技能的集成
With scientific-schematics
scientific-schematics与scientific-schematics
集成
scientific-schematicsscientific-schematicsWorkflow:
1. Create the concept as Mermaid in .md (this skill — Phase 1)
2. Describe the same concept to scientific-schematics for a polished PNG (Phase 3)
3. Commit both — the .md as source, the PNG as a supplementary figurescientific-schematics工作流:
1. 用本技能将概念创建为.md文件中的Mermaid图表(第一阶段)
2. 向scientific-schematics描述同一概念以生成精美的PNG(第三阶段)
3. 同时提交两者——.md文件作为源文件,PNG作为补充图表With scientific-writing
scientific-writing与scientific-writing
集成
scientific-writingWhen produces a manuscript, all diagrams and structural figures should use this skill's standards. The writing skill handles prose and citations; this skill handles visual structure.
scientific-writingWorkflow:
1. Use scientific-writing to draft the manuscript
2. For every figure that shows a workflow, architecture, or relationship:
- Replace placeholder with a Mermaid diagram following this skill's guide
3. Use scientific-schematics only for figures that truly need photorealistic/complex rendering当生成手稿时,所有图表和结构图形都应遵循本技能的标准。写作技能负责散文内容和引用;本技能负责视觉结构。
scientific-writing工作流:
1. 使用scientific-writing起草手稿
2. 对于每个展示工作流、架构或关系的图表:
- 按照本技能的指南,用Mermaid图表替换占位符
3. 仅当图表确实需要逼真/复杂渲染时,才使用scientific-schematicsWith literature-review
literature-review与literature-review
集成
literature-reviewLiterature review produces summaries with lots of relationship data. Use this skill to:
- Create concept maps (Mindmap) of the literature landscape
- Show publication timelines (Timeline or Gantt)
- Compare methodologies (Quadrant or Radar)
- Diagram data flows described in papers (Sequence or Flowchart)
文献综述会生成包含大量关系数据的摘要。使用本技能可以:
- 创建文献格局的概念图(思维导图)
- 展示出版时间线(时间线图或甘特图)
- 比较方法论(象限图或雷达图)
- 绘制论文中描述的数据流(序列图或流程图)
With any skill that produces output documents
与任何生成输出文档的技能集成
Before finalizing any document from any skill, apply this skill's checklist:
- Does the document use a template? If so, did I start from the right one?
- Are all diagrams in Mermaid with +
accTitle?accDescr - No , no inline
%%{init}, onlystyle?classDef - Are all external claims cited with ?
[^N] - One H1, emoji on H2 only?
- Horizontal rules after every ?
</details>
在最终确定任何技能生成的文档前,应用本技能的检查清单:
- 文档是否使用了模板?如果是,是否从正确的模板开始?
- 所有图表是否都是带+
accTitle的Mermaid图表?accDescr - 没有,没有内联
%%{init},仅使用style?classDef - 所有外部观点是否都用引用了?
[^N] - 仅一个H1标题,仅H2标题带表情符号?
- 每个标签后都有水平分隔线?
</details>
📚 Reference index
📚 参考索引
Style guides
样式指南
| Guide | Path | Lines | What it covers |
|---|---|---|---|
| Markdown Style Guide | | ~733 | Headings, formatting, citations, tables, Mermaid integration, templates, quality checklist |
| Mermaid Style Guide | | ~458 | Accessibility, emoji set, color classes, theme neutrality, type selection, complexity tiers |
| 指南 | 路径 | 行数 | 涵盖内容 |
|---|---|---|---|
| Markdown样式指南 | | ~733 | 标题、格式、引用、表格、Mermaid集成、模板、质量检查清单 |
| Mermaid样式指南 | | ~458 | 可访问性、表情符号集、颜色类、主题中立性、类型选择、复杂度层级 |
Diagram type guides (24 types)
图表类型指南(24种)
Each file contains: production-quality exemplar, tips specific to that type, and a copy-paste template.
references/diagrams/每个文件包含:生产级示例、特定类型的技巧、可复制粘贴的模板。
references/diagrams/Document templates (9 types)
文档模板(9种)
templates/templates/Examples
示例
assets/examples/example-research-report.mdassets/examples/example-research-report.md📝 Attribution
📝 署名
All style guides, diagram type guides, and document templates in this skill are ported from the repository under the Apache-2.0 License.
SuperiorByteWorks-LLC/agent-project- Source: https://github.com/SuperiorByteWorks-LLC/agent-project
- Author: Clayton Young / Superior Byte Works, LLC (@borealBytes)
- License: Apache-2.0
This skill (as part of academic-skills) is distributed under the MIT License. The included Apache-2.0 content is compatible for downstream use with attribution retained, as preserved in the file headers throughout this skill.
本技能中的所有样式指南、图表类型指南和文档模板均源自仓库,遵循Apache-2.0许可证。
SuperiorByteWorks-LLC/agent-project- 来源:https://github.com/SuperiorByteWorks-LLC/agent-project
- 作者:Clayton Young / Superior Byte Works, LLC (@borealBytes)
- 许可证:Apache-2.0
本技能(作为academic-skills的一部分)以MIT许可证分发。所包含的Apache-2.0许可内容可兼容下游使用,需保留署名,正如本技能中所有文件头所保留的那样。