external-diagram-mermaid-generate

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

external-diagram-mermaid-generate: Salesforce Diagram Generation

external-diagram-mermaid-generate:Salesforce图表生成

Use this skill when the user needs text-based diagrams: Mermaid diagrams for architecture, OAuth, integration flows, ERDs, or Agentforce structure, plus ASCII fallback when plain-text compatibility matters.
当用户需要基于文本的图表时使用此技能:可生成用于架构、OAuth、集成流程、ERD或Agentforce结构的Mermaid图表,当需要纯文本兼容性时还可提供ASCII格式作为备选。

Scope

适用范围

In Scope

适用场景

Use
external-diagram-mermaid-generate
when the user wants:
  • Mermaid output
  • ASCII fallback diagrams
  • architecture, sequence, flowchart, or ERD views in markdown-friendly form
  • diagrams that can live directly in docs, READMEs, or issues
当用户有以下需求时使用
external-diagram-mermaid-generate
  • Mermaid格式输出
  • ASCII备选图表
  • 兼容Markdown的架构图、序列图、流程图或ERD视图
  • 可直接嵌入文档、README或问题中的图表

Out of Scope — Delegate elsewhere when the user wants:

不适用场景——请转至其他技能:

  • rendered PNG/SVG images or polished mockups → external-diagram-visual-generate
  • non-Salesforce systems only → use a more general diagramming skill
  • object discovery before an ERD → platform-custom-object-generate or platform-custom-field-generate

  • 渲染后的PNG/SVG图片或精美的模型图 → external-diagram-visual-generate
  • 仅非Salesforce系统的图表 → 使用更通用的绘图技能
  • 生成ERD前的对象发现 → platform-custom-object-generateplatform-custom-field-generate

Supported Diagram Families

支持的图表类型

TypePreferred Mermaid formTypical use
OAuth / auth flows
sequenceDiagram
Authorization Code, JWT, PKCE, Device Flow
ERD / data model
flowchart LR
object relationships and sharing context
integration sequence
sequenceDiagram
request/response or event choreography
system landscape
flowchart
high-level architecture
role / access hierarchy
flowchart
users, profiles, permissions
Agentforce behavior map
flowchart
agent → topic → action relationships

类型首选Mermaid形式典型用途
OAuth/认证流程
sequenceDiagram
授权码、JWT、PKCE、设备流程
ERD/数据模型
flowchart LR
对象关系与共享上下文
集成序列
sequenceDiagram
请求/响应或事件编排
系统全景
flowchart
高层架构
角色/权限层级
flowchart
用户、配置文件、权限
Agentforce行为映射
flowchart
Agent→主题→动作关系

Required Context to Gather First

需先收集的必要信息

Ask for or infer:
  • diagram type
  • scope and entities / systems involved
  • output preference: Mermaid only, ASCII only, or both
  • whether styling should be minimal, documentation-first, or presentation-friendly
  • for ERDs: whether org metadata is available for grounding

询问或推断以下内容:
  • 图表类型
  • 涉及的范围和实体/系统
  • 输出偏好:仅Mermaid、仅ASCII,或两者都要
  • 样式需求:极简风格、文档优先风格,或演示友好风格
  • 针对ERD:是否可用组织元数据作为基础

Recommended Workflow

推荐工作流程

1. Pick the right diagram structure

1. 选择合适的图表结构

  • use
    sequenceDiagram
    for time-ordered interactions
  • use
    flowchart LR
    for ERDs and capability maps
  • keep a single primary story per diagram when possible
  • 对于按时间顺序的交互,使用
    sequenceDiagram
  • 对于ERD和能力映射,使用
    flowchart LR
  • 尽可能让每个图表只聚焦一个核心主题

2. Gather data

2. 收集数据

For ERDs and grounded diagrams:
  • use platform-custom-object-generate or platform-custom-field-generate when real schema discovery is needed
  • optionally use the local metadata helper script for counts / relationship context when appropriate
针对ERD和基于元数据的图表:
  • 当需要真实的架构发现时,使用platform-custom-object-generateplatform-custom-field-generate
  • 必要时可使用本地元数据辅助脚本获取数量/关系上下文

3. Generate Mermaid first

3. 先生成Mermaid图表

Apply:
  • accurate labels
  • simple readable node text
  • consistent relationship notation
  • restrained styling that renders cleanly in markdown viewers
遵循以下规则:
  • 标签准确
  • 节点文本简洁易读
  • 关系符号保持一致
  • 样式克制,确保在Markdown查看器中能清晰渲染

4. Add ASCII fallback when useful

4. 按需添加ASCII备选方案

Provide an ASCII version when the user wants terminal compatibility or plaintext documentation.
当用户需要终端兼容性或纯文本文档时,提供ASCII版本

5. Explain the diagram briefly

5. 简要说明图表

Call out the key relationships, flow direction, and any assumptions.

指出关键关系、流向以及任何假设

High-Signal Rules

高优先级规则

For sequence diagrams

针对序列图

  • use
    autonumber
    when step order matters
  • distinguish requests vs responses clearly
  • use notes sparingly for protocol detail
  • 当步骤顺序重要时使用
    autonumber
  • 清晰区分请求与响应
  • 仅在需要说明协议细节时少量使用注释

For ERDs

针对ERD

  • prefer
    flowchart LR
  • keep object cards simple
  • use clear relationship arrows
  • avoid field overload unless the user explicitly asks for field-level detail
  • color-code object types only when it improves readability
  • 优先使用
    flowchart LR
  • 对象卡片保持简洁
  • 使用清晰的关系箭头
  • 除非用户明确要求,否则避免过多字段信息
  • 仅当有助于提高可读性时才对对象类型进行颜色编码

For ASCII output

针对ASCII输出

  • keep width reasonable
  • align arrows and boxes consistently
  • optimize for readability over decoration

  • 保持合理宽度
  • 箭头和方框对齐一致
  • 优先优化可读性而非装饰性

Output Format

输出格式

markdown
undefined
markdown
undefined

<Diagram Title>

<图表标题>

Mermaid Diagram

Mermaid图表

mermaid
<diagram>
mermaid
<diagram>

ASCII Fallback

ASCII备选方案

text
<ascii>
text
<ascii>

Notes

说明

  • <key point>
  • <assumption or limitation>

---
  • <关键点>
  • <假设或限制>

---

Cross-Skill Integration

跨技能集成

NeedDelegate toReason
real object / field definitionsplatform-custom-object-generate / platform-custom-field-generategrounded ERD generation
rendered diagram / image outputexternal-diagram-visual-generatevisual polish beyond Mermaid
connected-app auth setup contextintegration-connectivity-connected-app-configureaccurate OAuth flows
Agentforce logic visualizationagentforce-generatesource-of-truth behavior details
Flow behavior diagramsautomation-flow-generateactual Flow logic grounding

需求转至技能原因
真实对象/字段定义platform-custom-object-generate / platform-custom-field-generate生成基于真实数据的ERD
渲染后的图表/图片输出external-diagram-visual-generate提供超出Mermaid的视觉优化
连接应用认证设置上下文integration-connectivity-connected-app-configure生成准确的OAuth流程
Agentforce逻辑可视化agentforce-generate获取真实的行为细节
流行为图表automation-flow-generate基于实际流逻辑生成

Gotchas

注意事项

IssueResolution
Mermaid renderer not availableProvide ASCII fallback automatically; note that the Mermaid block still carries the diagram for copy-paste into a renderer
ERD becomes unreadable with too many objectsSplit into sub-diagrams by domain (Sales, Service, etc.) and link them in prose
Sequence diagram step order unclearUse
autonumber
directive to make step ordering explicit
OAuth flow actors differ by grant typeRead the relevant asset template first before generating to avoid actor mismatch

问题解决方案
Mermaid渲染器不可用自动提供ASCII备选方案;说明Mermaid代码块仍可复制粘贴到支持的渲染器中使用
ERD因对象过多而难以阅读按领域(销售、服务等)拆分为子图表,并在文本中建立链接
序列图步骤顺序不清晰使用
autonumber
指令明确步骤顺序
OAuth流程参与者因授权类型而异生成前先查阅相关资产模板,避免参与者不匹配

Reference File Index

参考文件索引

Conventions & rules — read before generating

约定与规则——生成前阅读

  • references/diagram-conventions.md — consistency rules for all diagram types
  • references/mermaid-reference.md — Mermaid syntax quick reference
  • references/usage-examples.md — worked examples per diagram type
  • references/diagram-conventions.md — 所有图表类型的一致性规则
  • references/mermaid-reference.md — Mermaid语法速查
  • references/usage-examples.md — 各图表类型的示例

Styling

样式

  • references/mermaid-styling.md — theming and annotation patterns
  • references/color-palette.md — color-blind-friendly palette with hex values
  • references/erd-conventions.md — ERD-specific layout and notation rules
  • references/mermaid-styling.md — 主题与注释模式
  • references/color-palette.md — 色盲友好的调色板及十六进制值
  • references/erd-conventions.md — ERD特定的布局与符号规则

Preview

预览

  • references/preview-guide.md — how to render Mermaid locally
  • scripts/README.md — setup and usage instructions for all scripts in this skill
  • scripts/mermaid_preview.py — live-reload preview server; run to preview diagrams in browser
  • scripts/query-org-metadata.py — queries org schema to ground ERD generation
  • references/preview-guide.md — 本地渲染Mermaid的方法
  • scripts/README.md — 本技能中所有脚本的安装与使用说明
  • scripts/mermaid_preview.py — 实时重载预览服务器;运行后可在浏览器中预览图表
  • scripts/query-org-metadata.py — 查询组织架构以生成基于真实数据的ERD

OAuth flow templates — load the matching template when generating OAuth diagrams

OAuth流程模板——生成OAuth图表时加载对应模板

  • assets/oauth/authorization-code.md — Authorization Code grant
  • assets/oauth/authorization-code-pkce.md — PKCE variant for mobile/SPA
  • assets/oauth/jwt-bearer.md — JWT Bearer server-to-server
  • assets/oauth/client-credentials.md — Client Credentials service accounts
  • assets/oauth/device-authorization.md — Device Flow for CLI/IoT
  • assets/oauth/refresh-token.md — Refresh Token renewal flow
  • assets/oauth/user-agent-social-sign-on.md — User-Agent / Social Sign-On
  • assets/oauth/authorization-code.md — 授权码授权
  • assets/oauth/authorization-code-pkce.md — 适用于移动/SPA的PKCE变体
  • assets/oauth/jwt-bearer.md — JWT Bearer服务器到服务器
  • assets/oauth/client-credentials.md — 客户端凭证服务账户
  • assets/oauth/device-authorization.md — 适用于CLI/IoT的设备流程
  • assets/oauth/refresh-token.md — 刷新令牌续期流程
  • assets/oauth/user-agent-social-sign-on.md — 用户代理/社交登录

Data model ERD templates — load the matching template when generating ERDs

数据模型ERD模板——生成ERD时加载对应模板

  • assets/datamodel/salesforce-erd.md — core Salesforce objects
  • assets/datamodel/sales-cloud-erd.md — Sales Cloud objects
  • assets/datamodel/service-cloud-erd.md — Service Cloud objects
  • assets/datamodel/b2b-commerce-erd.md — B2B Commerce objects
  • assets/datamodel/campaigns-erd.md — Campaigns and campaign member model
  • assets/datamodel/consent-erd.md — Consent and privacy objects
  • assets/datamodel/files-erd.md — Files and ContentDocument model
  • assets/datamodel/forecasting-erd.md — Forecasting objects
  • assets/datamodel/fsl-erd.md — Field Service Lightning objects
  • assets/datamodel/party-model-erd.md — Party model objects
  • assets/datamodel/quote-order-erd.md — Quote and Order objects
  • assets/datamodel/revenue-cloud-erd.md — Revenue Cloud objects
  • assets/datamodel/scheduler-erd.md — Scheduler objects
  • assets/datamodel/territory-management-erd.md — Territory Management objects
  • assets/datamodel/salesforce-erd.md — Salesforce核心对象
  • assets/datamodel/sales-cloud-erd.md — 销售云对象
  • assets/datamodel/service-cloud-erd.md — 服务云对象
  • assets/datamodel/b2b-commerce-erd.md — B2B商务对象
  • assets/datamodel/campaigns-erd.md — 营销活动及营销活动成员模型
  • assets/datamodel/consent-erd.md — 同意与隐私对象
  • assets/datamodel/files-erd.md — 文件与ContentDocument模型
  • assets/datamodel/forecasting-erd.md — 预测对象
  • assets/datamodel/fsl-erd.md — 现场服务闪电(Field Service Lightning)对象
  • assets/datamodel/party-model-erd.md — 参与方模型对象
  • assets/datamodel/quote-order-erd.md — 报价与订单对象
  • assets/datamodel/revenue-cloud-erd.md — 收入云对象
  • assets/datamodel/scheduler-erd.md — 调度器对象
  • assets/datamodel/territory-management-erd.md — 区域管理对象

Other diagram templates

其他图表模板

  • assets/architecture/system-landscape.md — system landscape overview template
  • assets/integration/api-sequence.md — API callout sequence template
  • assets/agentforce/agent-flow.md — Agentforce agent → topic → action flow
  • assets/role-hierarchy/user-hierarchy.md — role and permission hierarchy template

  • assets/architecture/system-landscape.md — 系统全景概览模板
  • assets/integration/api-sequence.md — API调用序列模板
  • assets/agentforce/agent-flow.md — Agentforce的Agent→主题→动作流程
  • assets/role-hierarchy/user-hierarchy.md — 角色与权限层级模板

Output Expectations

输出预期

Deliverables produced by this skill for each request:
  • Mermaid code block — fenced
    ```mermaid
    block ready to paste into GitHub, Confluence, or any Mermaid-capable renderer
  • ASCII fallback (when requested or when Mermaid renderer is unavailable) — text-only diagram using box/arrow characters
  • Brief explanation — 2-5 bullet points calling out key relationships, flow direction, and any assumptions or limitations in the diagram
  • For ERDs: object cards with field labels and relationship type annotations
  • For sequence diagrams: numbered steps (
    autonumber
    ) with clear actor labels

此技能为每个请求提供以下交付物:
  • Mermaid代码块 — 使用
    ```mermaid
    包裹的代码块,可直接粘贴到GitHub、Confluence或任何支持Mermaid的渲染器中
  • ASCII备选方案(当用户要求或Mermaid渲染器不可用时)—— 使用方框/箭头字符的纯文本图表
  • 简要说明 — 2-5个要点,指出关键关系、流向以及图表中的任何假设或限制
  • 针对ERD:包含字段标签和关系类型注释的对象卡片
  • 针对序列图:带有清晰参与者标签的编号步骤(
    autonumber

Score Guide

评分指南

ScoreMeaning
72–80production-ready diagram
60–71clear and useful with minor polish left
48–59functional but could be clearer
35–47needs structural improvement
< 35inaccurate or incomplete
分数含义
72–80可直接用于生产环境的图表
60–71清晰实用,仅需少量优化
48–59可用,但可进一步提升清晰度
35–47需要调整结构
< 35不准确或不完整