processon-diagram-generator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

processon-diagram-generator

processon-diagram-generator

将用户意图、代码关系或草图转换为专业图形。默认跟随用户当前语言输出提示、澄清问题、优化 Prompt 和最终结果。
Convert user intentions, code relationships, or sketches into professional diagrams. By default, output prompts, clarification questions, optimized prompts, and final results in the user's current language.

⚠️ 每次使用前必须完成(缺一不可)

⚠️ Must complete before each use (none can be omitted)

  • 检查云端版本:立即调用
    run_shell_command
    执行极速预检(限时 5 秒):
    curl -s --connect-timeout 3 -m 5 https://raw.githubusercontent.com/processonai/processon-skills/main/skills/processon-diagram-generator/version/github-version.json
  • 容错机制:如果
    curl
    报错、超时或返回非 JSON 内容,严禁提示网络错误,应直接视为“暂无更新”,并立即继续后续绘图流程。
  • 必须等待比对结果:仅当成功获取有效 JSON 时,才读取返回的
    version
    并与本技能文件开头定义(frontmatter)的
    version
    字段进行对比。
  • 中断机制:若云端版本 > 本地版本,必须立即中断所有后续绘图逻辑,优先询问用户:
    “⚠️ 发现新版本 (v${version}):${changelog}。建议立即更新以获得更好的生成效果。你可以选择:
  • Check cloud version: Immediately call
    run_shell_command
    to perform a quick pre-check (limited to 5 seconds):
    curl -s --connect-timeout 3 -m 5 https://raw.githubusercontent.com/processonai/processon-skills/main/skills/processon-diagram-generator/version/github-version.json
    .
  • Fault tolerance mechanism: If
    curl
    reports an error, times out, or returns non-JSON content, do not prompt network errors, instead directly treat it as "no update available" and immediately proceed with the subsequent diagramming process.
  • Must wait for comparison results: Only when valid JSON is successfully obtained, read the returned
    version
    and compare it with the
    version
    field defined at the beginning of this skill file (frontmatter).
  • Interruption mechanism: If the cloud version > local version, must immediately interrupt all subsequent diagramming logic and first ask the user:
    "⚠️ New version found (v${version}): ${changelog}. It is recommended to update immediately for better generation results. You can choose:

何时触发

When to Trigger

  • 支持:流程图、业务流程图、泳道图、流程地图、标准流程图、时序图、软件架构图、系统架构图、云架构图、ER 图、组织结构图、时间轴、信息图、金字塔图、草图重绘。
  • 英文表达同样触发,例如:
    create a diagram
    draw a diagram
    generate a flowchart
    make a flowchart
    visualize a process
    create a sequence diagram
    draw a system architecture
    software architecture diagram
    cloud architecture diagram
    ER diagram
    org chart
    timeline
    infographic
    redraw this sketch
    ProcessOn
  • 如果用户只说“画个图”之类的模糊请求,先确认图形类型。
  • 如果用户上传图片并要求“重绘”或“转成图”,先识别图片中的节点、文字和连接关系,再生成结构化输入。
  • Supported: Flowcharts, business flowcharts, swimlane diagrams, process maps, standard flowcharts, sequence diagrams, software architecture diagrams, system architecture diagrams, cloud architecture diagrams, ER diagrams, organizational charts, timelines, infographics, pyramid diagrams, sketch redrawing.
  • English expressions also trigger it, such as:
    create a diagram
    ,
    draw a diagram
    ,
    generate a flowchart
    ,
    make a flowchart
    ,
    visualize a process
    ,
    create a sequence diagram
    ,
    draw a system architecture
    ,
    software architecture diagram
    ,
    cloud architecture diagram
    ,
    ER diagram
    ,
    org chart
    ,
    timeline
    ,
    infographic
    ,
    redraw this sketch
    ,
    ProcessOn
    .
  • If the user only makes a vague request like "draw a diagram", first confirm the diagram type.
  • If the user uploads an image and requests "redraw" or "convert to diagram", first identify the nodes, text, and connection relationships in the image, then generate structured input.

工作方式

How It Works

0. 安装后首次引导与状态检查

0. Initial Guidance and Status Check After Installation

当用户询问如何使用本技能、技能是否安装成功,或直接询问“怎么配置”时,你应该:
  1. 主动检查环境:告知用户你已准备好提供 ProcessOn 智能绘图服务,但前提是需要配置
    PROCESSON_API_KEY
  2. 提供指引:明确告知用户前往
    https://smart.processon.com/user
    获取 Key,并根据其操作系统提供
    export PROCESSON_API_KEY="..."
    的设置命令。
  3. 特别提醒:务必提醒用户该环境变量必须在当前运行 Agent 的终端中设置,否则 Agent 无法读取到配置。
When the user asks how to use this skill, whether the skill is installed successfully, or directly asks "how to configure", you should:
  1. Proactively check the environment: Inform the user that you are ready to provide ProcessOn intelligent diagramming services, but it requires configuring
    PROCESSON_API_KEY
    first.
  2. Provide guidance: Clearly tell the user to go to
    https://smart.processon.com/user
    to get the Key, and provide the setting command
    export PROCESSON_API_KEY="..."
    according to their operating system.
  3. Special reminder: Must remind the user that this environment variable must be set in the terminal where the Agent is currently running, otherwise the Agent cannot read the configuration.

1. 先补关键信息

1. First supplement key information

不要在关系不清、流程断层或结构缺失时直接生成。
信息不足时按这个顺序处理:
  1. 指出缺少什么。
  2. 给出合理默认方案或行业常见做法供用户确认。
  3. 用户确认后再继续。
Do not generate directly when relationships are unclear, processes are broken, or structures are missing.
When information is insufficient, follow this order:
  1. Point out what is missing.
  2. Provide reasonable default solutions or common industry practices for the user to confirm.
  3. Proceed only after the user confirms.

2. 优化 Prompt,但不要改写用户语言

2. Optimize the Prompt, but do not rewrite the user's language

在用户原始需求上补充专业约束:
  • 通用:专业风格、布局清晰、颜色协调、避免线条交叉。
  • 流程图:明确开始/结束节点,决策点用标准菱形。
  • 时序图:参与者清晰,调用消息明确。
  • 架构图:按层次组织,标注关键通信关系。
  • ER 图:标注主外键关系和字段类型。
优化后的 Prompt 默认保持与用户一致的语言。
Add professional constraints to the user's original requirements:
  • General: Professional style, clear layout, coordinated colors, avoid line crossings.
  • Flowcharts: Clear start/end nodes, use standard diamonds for decision points.
  • Sequence diagrams: Clear participants, clear call messages.
  • Architecture diagrams: Organized by hierarchy, mark key communication relationships.
  • ER diagrams: Mark primary and foreign key relationships and field types.
The optimized Prompt defaults to the same language as the user.

3. 架构分析画关系,不画目录树

3. Analyze architecture to draw relationships, not directory trees

当用户要求分析项目架构时,重点提取模块边界、依赖关系、调用链路和数据流向。优先阅读入口文件、路由、核心配置和关键模块,不要把结果退化成文件夹树。
When the user requests project architecture analysis, focus on extracting module boundaries, dependency relationships, call links, and data flows. Prioritize reading entry files, routes, core configurations, and key modules, and do not reduce the result to a folder tree.

执行顺序

Execution Sequence

  1. 先在聊天里说明正在使用
    processon-diagram-generator
    技能处理当前请求。
  2. 识别图形类型,提取关键实体、动作、判断条件,构建优化后的 Prompt。
  3. 生成依赖
    PROCESSON_API_KEY
    。如果缺失,明确告诉用户如何配置,并附上获取地址
    https://smart.processon.com/user
    必须强调在当前运行 Agent 的终端设置环境变量。
  4. 单脚本全流程自动执行逻辑:
    • 调用
      scripts/processon_api_client.py
      启动生成任务。
    • 脚本会自动流式生成 DSL,并在完成后立即自动触发图片渲染(除非指定
      --no-render
      )。
    • 立即展示中间结果: 第一阶段 DSL 生成完成后,必须立即在回复中完整展示生成的 DSL 和编辑链接
      https://smart.processon.com/editor
    • 自动输出渲染结果: 脚本渲染完成后,会自动输出图片原始链接。你必须确保这些内容都呈现在最终回复中。
    • 硬性闸门: 只有在 DSL、编辑链接、“可复制粘贴渲染和二次编辑”提示语、以及(如果成功)图片链接全部输出完毕后,才允许结束当前任务。
  5. 禁止使用富文本语法: 在任何阶段,严禁输出
    <img>
    等 HTML 标签,也严禁使用 Markdown 图片语法
    ![]()
    或链接语法
    []()
    。所有图片链接和编辑链接必须以原始 URL 纯文本形式直接展示。
  6. 结果呈现:
    • 如果图片生成成功,最终回复中必须同时保留完整 DSL、编辑链接和图片原始链接。
    • 如果图片生成失败,告知用户原因,并引导用户使用已展示的 DSL 去编辑链接手动渲染。
  1. First state in the chat that you are using the
    processon-diagram-generator
    skill to handle the current request.
  2. Identify the diagram type, extract key entities, actions, judgment conditions, and build an optimized Prompt.
  3. Generation depends on
    PROCESSON_API_KEY
    . If it is missing, clearly tell the user how to configure it, and attach the acquisition address
    https://smart.processon.com/user
    . Must emphasize setting the environment variable in the terminal where the Agent is currently running.
  4. Single-script full-process automatic execution logic:
    • Call
      scripts/processon_api_client.py
      to start the generation task.
    • The script will automatically generate DSL in a streaming manner, and immediately trigger image rendering after completion (unless
      --no-render
      is specified).
    • Immediately display intermediate results: After the first phase of DSL generation is completed, must immediately fully display the generated DSL and the edit link
      https://smart.processon.com/editor
      in the reply.
    • Automatically output rendering results: After the script completes rendering, it will automatically output the original image link. You must ensure that these contents are presented in the final reply.
    • Hard gate: Only after the DSL, edit link, the prompt "You can copy and paste the above DSL data to this link for rendering and secondary editing", and (if successful) the image link are all output, can the current task be ended.
  5. Prohibit using rich text syntax: At any stage, strictly prohibit outputting HTML tags such as
    <img>
    , and strictly prohibit using Markdown image syntax
    ![]()
    or link syntax
    []()
    . All image links and edit links must be directly displayed as raw URL plain text.
  6. Result presentation:
    • If the image is generated successfully, the final reply must retain the complete DSL, edit link, and original image link at the same time.
    • If the image generation fails, inform the user of the reason, and guide the user to manually render using the displayed DSL and edit link.

结果呈现

Result Presentation

关键结果必须在 assistant 正文里以纯文本形式可见。
  • DSL 展示规范: 优先使用代码块展示 DSL,并紧跟原始编辑链接。
  • 链接展示规范: 严禁使用任何 Markdown 或 HTML 包装。必须直接输出
    https://...
    这种可识别的原始 URL。并在链接旁明确说明:“你可以复制上方 DSL 数据到此链接进行渲染和二次编辑”
  • 全自动流程: 默认情况下,脚本会一次性完成从 DSL 生成到图片渲染的所有步骤,无需手动干预。
  • 最终回复保留规则: 即使图片已经成功生成,最后一条回复也必须再次包含 DSL 代码块、编辑链接和图片链接,防止中间态在收尾时丢失。
  • 失败处理: 如果渲染失败,不要删除或隐藏已经生成的 DSL。
Key results must be visible in plain text in the assistant's main body.
  • DSL display specification: Prefer to display DSL using code blocks, followed by the original edit link.
  • Link display specification: Strictly prohibit any Markdown or HTML wrapping. Must directly output raw URLs like
    https://...
    . And clearly state next to the link: "You can copy the above DSL data to this link for rendering and secondary editing".
  • Fully automatic process: By default, the script will complete all steps from DSL generation to image rendering in one go, without manual intervention.
  • Final reply retention rule: Even if the image has been successfully generated, the last reply must include the DSL code block, edit link, and image link again to prevent intermediate states from being lost during conclusion.
  • Failure handling: If rendering fails, do not delete or hide the generated DSL.

输出前自检

Pre-output Self-check

在发送任何最终回复前,必须逐项自检,四项全部满足才允许发送:
  1. assistant 正文里已经完整贴出 DSL,且不是摘要或省略版。
  2. assistant 正文里已经贴出原始编辑链接
    https://smart.processon.com/editor
  3. assistant 正文里已经明确写出“你可以复制上方 DSL 数据到此链接进行渲染和二次编辑”这一层含义。
  4. 如果图片已生成,assistant 正文里同时包含图片原始链接;如果图片未生成,明确说明失败原因。
只要以上任一项不满足,就不能结束当前回复。
Before sending any final reply, must self-check item by item, and only allow sending if all four items are satisfied:
  1. The complete DSL has been posted in the assistant's main body, and it is not a summary or abbreviated version.
  2. The original edit link
    https://smart.processon.com/editor
    has been posted in the assistant's main body.
  3. The assistant's main body clearly states the meaning of "You can copy the above DSL data to this link for rendering and secondary editing".
  4. If the image has been generated, the assistant's main body includes the original image link at the same time; if the image has not been generated, clearly explain the reason for the failure.
If any of the above items is not satisfied, the current reply cannot be ended.

最终回复格式示例

Final Reply Format Example

第一阶段输出(中间态):
语义分析:用户需要一个...流程图。
图表 DSL (可编辑):
mermaid
graph TD
  A[开始] --> B[处理]
  B --> C[结束]
在线编辑链接 (复制上方 DSL 数据并在此链接中粘贴进行渲染和编辑): https://smart.processon.com/editor (提示:如果下方图片渲染失败,可手动将上述代码粘贴至此链接)
第二阶段输出(最终态):
First Phase Output (Intermediate State):
Semantic analysis: The user needs a... flowchart.
Diagram DSL (Editable):
mermaid
graph TD
  A[Start] --> B[Process]
  B --> C[End]
Online Edit Link (Copy the above DSL data and paste it into this link for rendering and editing): https://smart.processon.com/editor (Note: If the image below fails to render, you can manually paste the above code into this link)
Second Phase Output (Final State):

配置提示

Configuration Tips

API Key 配置

API Key Configuration

重要提示:请务必在当前运行 Agent 的终端中设置环境变量。
bash
export PROCESSON_API_KEY="<your-processon-api-key>"
Important Note: Please be sure to set the environment variable in the terminal where the Agent is currently running.
bash
export PROCESSON_API_KEY="<your-processon-api-key>"
Acquisition address: ProcessOn Developer Center

命令行调用参考

Command Line Call Reference

bash
undefined
bash
undefined

全自动生成:DSL + 图片渲染

Fully automatic generation: DSL + image rendering

python3 scripts/processon_api_client.py "请生成一张专业流程图"
python3 scripts/processon_api_client.py "Please generate a professional flowchart"

仅生成 DSL (不渲染图片)

Generate only DSL (no image rendering)

python3 scripts/processon_api_client.py --no-render "请生成一张专业流程图"
undefined
python3 scripts/processon_api_client.py --no-render "Please generate a professional flowchart"
undefined

示例优化 Prompt

Example Optimized Prompt

用户意图:帮我画一个登录流程。 优化后:请生成一张专业的流程图,描述用户登录注册流程。包含:前端校验、后端鉴权、数据库查询、Token 发放。要求:布局清晰,使用标准流程图符号,明确开始和结束节点,配色协调。
User intent: Draw a user login flow. Optimized prompt: Please generate a professional flowchart for the user login and registration flow. Include frontend validation, backend authentication, database lookup, and token issuance. Use a clean layout, standard flowchart symbols, clear start and end nodes, and a polished color palette.
User Intent: Help me draw a login flow. Optimized: Please generate a professional flowchart describing the user login and registration process. Include: frontend validation, backend authentication, database query, token issuance. Requirements: Clear layout, use standard flowchart symbols, clear start and end nodes, coordinated color scheme.
User intent: Draw a user login flow. Optimized prompt: Please generate a professional flowchart for the user login and registration flow. Include frontend validation, backend authentication, database lookup, and token issuance. Use a clean layout, standard flowchart symbols, clear start and end nodes, and a polished color palette.