umple-diagram-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUmple Diagram Generator Skill
Umple 图表生成工具 Skill
Overview
概述
Generate an Umple model from requirements and render it to SVG (Umple + Graphviz).
.ump从需求生成Umple 模型,并渲染为SVG(基于Umple + Graphviz)。
.umpSupported diagram types
支持的图表类型
| Type | Umple generator | Read before writing Umple |
|---|---|---|
| | |
| | |
| 类型 | Umple 生成器 | 编写Umple前请阅读 |
|---|---|---|
| | |
| | |
Script
脚本
Entry point: (run with Bun via ).
scripts/main.tsnpx -y bun入口文件:(通过 运行)。
scripts/main.tsnpx -y bunQuick start
快速开始
bash
undefinedbash
undefinedFolder mode: organized output with all files (.ump, .gv, .svg)
Folder mode: organized output with all files (.ump, .gv, .svg)
npx -y bun ${SKILL_DIR}/scripts/main.ts --input model.ump --output ./diagrams --name "light-controller"
npx -y bun ${SKILL_DIR}/scripts/main.ts --input model.ump --output ./diagrams --name "light-controller"
Exact path mode: save SVG to specific file path
Exact path mode: save SVG to specific file path
npx -y bun ${SKILL_DIR}/scripts/main.ts --input model.ump --output ./my-diagram.svg
npx -y bun ${SKILL_DIR}/scripts/main.ts --input model.ump --output ./my-diagram.svg
Class diagram with custom name
Class diagram with custom name
npx -y bun ${SKILL_DIR}/scripts/main.ts --input model.ump --output ./diagrams --name "user-system" --type class-diagram
Replace `${SKILL_DIR}` with the absolute path to this skill directory.npx -y bun ${SKILL_DIR}/scripts/main.ts --input model.ump --output ./diagrams --name "user-system" --type class-diagram
将 `${SKILL_DIR}` 替换为该工具目录的绝对路径。Script options
脚本选项
| Option | Description |
|---|---|
| Input |
| Output path: directory for folder mode, or |
| Diagram name for folder mode (optional, triggers folder mode) |
| Diagram type: |
| GvStateDiagram suboption (repeatable) |
| JSON output with details |
| Show help |
| 选项 | 描述 |
|---|---|
| 输入 |
| 输出路径:文件夹模式对应目录,精确路径模式对应 |
| 文件夹模式下的图表名称(可选,指定后触发文件夹模式) |
| 图表类型: |
| GvStateDiagram 子选项(可重复使用) |
| 输出包含详细信息的JSON格式结果 |
| 显示帮助信息 |
Output modes
输出模式
Folder Mode (when is specified or is a directory):
--name--output- Creates organized folder with timestamped name
- Includes all files: (source),
.ump(graphviz),.gv(diagram).svg
Folder naming:
- With :
--name<sanitized-name>_<timestamp>/ - Without :
--name<diagram-type>_<timestamp>/
Example:
diagrams/
└── light-controller_20260121_183045/
├── model.ump
├── model.gv
└── model.svgExact Path Mode (when ends with ):
--output.svg- Saves only the SVG file to the exact specified path
- Useful when user specifies a specific output location
Example:
bash
npx -y bun ${SKILL_DIR}/scripts/main.ts --input model.ump --output /path/to/my-diagram.svg文件夹模式(当指定 或 为目录时):
--name--output- 创建带时间戳的规整文件夹
- 包含所有文件:(源文件)、
.ump(Graphviz文件)、.gv(图表).svg
文件夹命名规则:
- 指定 时:
--name<清理后的名称>_<时间戳>/ - 未指定 时:
--name<图表类型>_<时间戳>/
示例:
diagrams/
└── light-controller_20260121_183045/
├── model.ump
├── model.gv
└── model.svg精确路径模式(当 以 结尾时):
--output.svg- 仅将SVG文件保存到指定的精确路径
- 适用于用户指定具体输出位置的场景
示例:
bash
npx -y bun ${SKILL_DIR}/scripts/main.ts --input model.ump --output /path/to/my-diagram.svgResult: /path/to/my-diagram.svg (only SVG, no folder created)
结果:/path/to/my-diagram.svg(仅生成SVG,不创建文件夹)
undefinedundefinedExit codes
退出码
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Missing dependencies (umple or dot) |
| 2 | Umple validation/compilation failed |
| 3 | SVG generation failed or unsupported diagram type |
| 代码 | 含义 |
|---|---|
| 0 | 执行成功 |
| 1 | 缺少依赖(umple 或 dot) |
| 2 | Umple 验证/编译失败 |
| 3 | SVG生成失败或不支持的图表类型 |
Workflow
工作流程
- Pre-flight: verify deps
command -v umple- If missing, stop and ask the user to install them.
command -v dot
- Clarify only what you must
- State machine: initial state, events, finals, guards/actions
- Class diagram: entities, attributes, relationships, multiplicities
- Write Umple
- Read the relevant guidance file (table above) before writing.
- Render
- Prefer folder mode unless the user explicitly provides an output path.
.svg
- Prefer folder mode unless the user explicitly provides an
- Validate
- On failure: fix Umple and retry up to 3 times.
- 预检查:验证依赖
- 执行
command -v umple - 执行 若缺失,停止操作并提示用户安装。
command -v dot
- 执行
- 仅澄清必要信息
- 状态机:初始状态、事件、终态、守卫/动作
- 类图:实体、属性、关系、多重性
- 编写Umple代码
- 编写前请阅读对应指南文件(见上方表格)。
- 渲染图表
- 除非用户明确提供 输出路径,否则优先使用文件夹模式。
.svg
- 除非用户明确提供
- 验证结果
- 若失败:修改Umple代码并重试最多3次。
Repair loop
修复循环
If rendering fails: read script output, apply a focused fix, re-run the same command.
若渲染失败:读取脚本输出,针对性修复问题,重新运行相同命令。
Output contract
输出约定
- Diagram type
- Generated Umple (single block)
umple - Exact command run
- Output paths (folder + SVG, or exact SVG path)
- 图表类型
- 生成的Umple代码(单个 代码块)
umple - 执行的精确命令
- 输出路径(文件夹+SVG,或精确SVG路径)
Guardrails
约束规则
- Prefer a smaller valid Umple model over guessing syntax.
- Use exact path mode only when the user provides an path.
.svg - Do not install system dependencies.
- Keep actions/guards minimal (no secrets, no I/O).
- 优先选择小型但有效的Umple模型,而非猜测语法。
- 仅当用户提供 路径时使用精确路径模式。
.svg - 不要安装系统依赖。
- 动作/守卫保持最简(不包含敏感信息,无输入输出操作)。