跳到正文
Skillpedia
技术文档18k · #10737

mermaid-diagrams

它能做什么

这个技能帮助 AI 智能体在文档页面中绘制简单而准确的图表。适合撰写技术文档、希望用图示说明流程和结构的人。

适用场景

  • ✓当页面说明的请求或流程用图片更容易理解时。
  • ✓当页面描述的生命周期包含多个状态或一组相互关联的数据表时。
  • ✓当更新涉及已有图表的页面,需要让图表保持同步时。

技能链接

https://github.com/langchain-ai/openwiki/blob/main/skills/mermaid-diagrams/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/langchain-ai/openwiki/blob/main/skills/mermaid-diagrams/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我在文档页面中添加一张图,说明请求如何经过我们的 API。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会选择适合内容的图表类型,例如时序图或状态图,并用 Mermaid 格式编写。它只绘制代码所支持的内容,并在每张图下方添加简短说明。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Mermaid Diagrams In Generated Wiki Pages

Diagrams are part of high-quality wiki generation, not decoration. Where a flow, lifecycle, or data model is easier to grasp visually, embed a Mermaid diagram in a fenced ```mermaid block on the most relevant page.

Choosing a diagram type

  • sequenceDiagram for runtime and request flows across components (auth flows, request lifecycles, agent tool loops).
  • stateDiagram-v2 for lifecycles and state machines (job states, connection states, run phases).
  • erDiagram for the data model: entities and their relationships.
  • flowchart TD for branching control flow and decision logic.

Discipline

  • Ground every diagram in inspected source. Do not invent participants, states, entities, or relationships the code does not support.
  • Cover the high-value cases: add a diagram wherever a page documents a request or runtime flow, a call sequence, a lifecycle or state machine, or a data model. A repository wiki usually has several such diagrams, not one overall. Skip pages that are navigation, reference tables, or pure configuration.
  • Still prefer a few strong diagrams over decorating every page: one accurate diagram on the page that needs it beats a diagram forced onto every page.
  • Give each diagram a one-line caption directly below it stating what it shows.
  • OpenWiki validates every mermaid fence after your run and converts fences that fail to parse into plain text fences. A degraded diagram is a quality failure; follow the syntax rules below so it does not happen.

Syntax safety

These rules prevent the most common render breakages. When in doubt, rephrase the label.

  • Never place semicolons or pipes inside node, message, or edge labels.
  • Never place unescaped angle brackets in labels; write "returns Promise of User" instead of "returns Promise<User>".
  • In flowchart, wrap any label containing parentheses, brackets, or other punctuation in double quotes: A["calls foo(bar)"].
  • In flowchart, never use the bare word end as a node id, and never start a node id with o or x followed by a dash (both are edge-marker syntax); rename the node.
  • In sequenceDiagram, participant names with spaces or punctuation need an alias: participant AS as Auth Service.
  • Never use a Mermaid reserved word as a participant name, alias, or node id: note, end, loop, alt, opt, par, and, else, activate, deactivate, class, state, click, link. For example a notification participant must be Notifier, not Note (which collides with the note keyword).
  • In erDiagram, entity and attribute names must be single identifier-like tokens; put human phrasing in the relationship label.
  • Keep labels short. Move explanation into the surrounding prose or the caption, not the diagram.

Update runs

  • A wrong diagram is a stale claim, not existing structure to preserve. If a source change makes a diagram inaccurate, update the diagram in the same edit as the surrounding prose.
  • Do not rewrite a diagram that is still accurate. Regenerating unchanged diagrams creates diff noise.
  • If a page contains a text fence preceded by an HTML comment starting with "openwiki: mermaid parse failed", that is a diagram a previous run degraded. Fix the syntax using the parser error in the comment, restore the ```mermaid fence, and delete the comment.
常见问题

它能绘制哪些类型的图表?

它可以绘制时序图、状态图、实体关系图和流程图。

它会为每个页面都添加图表吗?

不会。它宁可使用少量有效的图表,也不会为每个页面都添加装饰性图表。

谁来检查图表是否正确?

该技能说明图表必须与检查过的源代码一致,运行结束后 wiki 工具还会对图表进行验证。

详情

作者的原始描述

Embed Mermaid diagrams in generated wiki pages. Use whenever documenting a runtime or request flow, a call sequence, a state machine or lifecycle, a data model or entity relationships, or non-trivial control flow, since these are clearer as a diagram than as prose. Also use when an update run touches a page that already contains a mermaid fence, or a page that contains a text fence a previous run degraded.

repo: langchain-ai/openwiki

热度

GitHub 星标
18k
排名
#10737
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能