返回技能列表

utility-mermaid-diagrams

product-on-purpose
更新于 2 days ago
8 次查看
239
33
239
在 GitHub 上查看
ai

关于

This skill teaches developers to create valid Mermaid diagrams by selecting the correct diagram type and following syntax rules. It covers all 15 diagram types with practical examples and includes validation techniques. Use it for embedding diagrams in documentation and debugging rendering issues.

快速安装

Claude Code

推荐
主要方式
npx skills add product-on-purpose/pm-skills -a claude-code
插件命令备选方式
/plugin add https://github.com/product-on-purpose/pm-skills
Git 克隆备选方式
git clone https://github.com/product-on-purpose/pm-skills.git ~/.claude/skills/utility-mermaid-diagrams

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

<!-- PM-Skills | https://github.com/product-on-purpose/pm-skills | Apache 2.0 -->

Mermaid Diagrams

Create effective, syntactically valid mermaid diagrams for product documents.

When to Use

  • Creating mermaid diagrams for PRDs, specs, roadmaps, or stakeholder presentations
  • Choosing which of 15 diagram types fits a specific communication need
  • Debugging mermaid code that won't render or renders incorrectly
  • Reviewing diagrams for clarity, accuracy, and accessibility

When NOT to Use

  • Exporting diagrams to image files (PNG/SVG) . that's a rendering tool concern
  • Using non-mermaid diagramming tools (Figma, Lucidchart, draw.io)
  • Creating purely decorative visuals with no informational purpose

The Cardinal Rule

Don't diagram what a list can say.

Diagrams earn their place when they reveal relationships, branching, or flow that prose flattens. Before creating any diagram, ask:

Does this show branching, relationships, or flow that a list or table would flatten?

  • Yes → proceed with a diagram
  • No → use a numbered list, bullet list, or table instead

A 5-step linear process is a list. A 5-step process with two decision points and a retry loop is a diagram.

Diagram Selection Guide

I need to show...UseAlso consider
A decision or approval processFlowchartState
Multi-service or multi-party interactionsSequenceFlowchart
Feature lifecycle or status transitionsStateFlowchart
Work stages or pipeline statusKanbanState
Release or sprint timeline with dependenciesGanttTimeline
Version history or chronological milestonesTimelineGantt
2D prioritization (effort/impact, risk/value)Quadrant.
Allocation breakdown or compositionPieTreemap
Problem decomposition or brainstormingMindmap.
Domain models or data relationshipsERClass
API or object contractsClassER
System topology or infrastructureArchitectureFlowchart
Flow quantities or budget allocationSankeyPie
Hierarchical proportional dataTreemapPie
Trends or time-series metricsXY-Chart.

For worked examples organized by PM task, see references/pm-use-cases.md. For full syntax and options per type, see references/diagram-catalog.md.

Syntax Validity Principles

Six rules that prevent most rendering failures:

  1. Quote labels . Any label containing spaces, parentheses, brackets, colons, commas, or reserved words must be quoted with double quotes
  2. Escape special characters . Characters with mermaid or markdown meaning (>, <, - at line start, #) need escaping or quoting
  3. Declare before referencing . Define a node before using it in an edge; referencing an undeclared node causes silent failures in some types
  4. Respect limits . Each diagram type has a maximum node/participant count beyond which readability collapses (see references/diagram-catalog.md for per-type limits)
  5. Comment your intent . Use %% comments to document non-obvious choices (why this layout direction, why this grouping)
  6. Test before shipping . Paste into a mermaid renderer (mermaid.live, VS Code preview, or your target environment) and verify it renders correctly

For the complete syntax reference, see references/syntax-guide.md.

Instructions

  1. Identify what you're communicating . What relationship, flow, hierarchy, or proportion needs to be visible? Who is the audience?
  2. Apply the cardinal rule . Confirm a diagram adds value over a list or table
  3. Select a diagram type . Use the selection guide above, browse references/pm-use-cases.md by task, or browse references/diagram-catalog.md by type
  4. Plan the diagram . Fill out the planning worksheet in references/TEMPLATE.md: purpose, audience, node inventory, type rationale
  5. Write the mermaid code . Follow references/syntax-guide.md rules; start with the minimal syntax example from references/diagram-catalog.md and expand
  6. Validate . Run through the quality checklist below
  7. Embed . Place the validated mermaid code block in your document

Output Contract

  • Planning artifact: A completed diagram planning worksheet (references/TEMPLATE.md)
  • Final output: A syntactically valid mermaid code block embedded in the target document
  • Quality gate: All items in the quality checklist pass

Quality Checklist

  • Diagram renders without error in target environment
  • Cardinal rule satisfied . a list or table would not communicate this more clearly
  • No linear sequences without branching, relationships, or hierarchy
  • All labels with spaces or special characters are properly quoted
  • Special characters escaped where needed
  • Node/participant count within type-specific limits
  • Colors are accessible (WCAG AA 3:1 contrast minimum, black text on light backgrounds)
  • Color is never the sole differentiator . shapes and labels also distinguish elements
  • Diagram has a descriptive title or surrounding prose context
  • %% comments document any non-obvious layout or grouping choices

References

FilePurpose
references/TEMPLATE.mdDiagram planning worksheet . fill out before writing mermaid code
references/EXAMPLE.mdWorked example: PM creating 4 diagrams for a product launch
references/diagram-catalog.mdAll 15 diagram types: syntax, PM examples, limits, pitfalls
references/pm-use-cases.mdPM task → diagram type mapping with mini worked examples
references/syntax-guide.mdComplete syntax validity rules, escaping, styling, and validation checklist

GitHub 仓库

product-on-purpose/pm-skills
路径: skills/utility-mermaid-diagrams
0
agent-skillsai-skillsclaude-codeclaude-desktopdesign-sprintfoundation-sprint

相关推荐技能

content-collections

Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。

查看技能

polymarket

这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。

查看技能

creating-opencode-plugins

该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。

查看技能

sglang

SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。

查看技能