一键导入
insight-diagram
为任意项目生成 UML 图、架构图和流程图。分析代码库后让用户选择要生成的图表类型,使用 architecture-diagram skill 渲染为 HTML+SVG,保存到 docs/ 目录。适用于任何软件项目的文档可视化。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
为任意项目生成 UML 图、架构图和流程图。分析代码库后让用户选择要生成的图表类型,使用 architecture-diagram skill 渲染为 HTML+SVG,保存到 docs/ 目录。适用于任何软件项目的文档可视化。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Graph engineering for parallel task execution: convert a task, PRD, SPEC, or issue set into a dependency graph (DAG), layer it into supersteps, then implement each independent node concurrently with subagents — each node runs /goal → /review-it → /ship-it in an isolated git worktree, with a fan-in barrier between waves. Triggers on: graph, graph engineering, build a graph, task graph, dependency graph, DAG, parallel implement, 并发实现, 并行实现, 任务图, 把任务变成图, fan-out fan-in, superstep, dynamic workflow.
Generate a Product Requirements Document (PRD) for a new feature. Use when planning a feature, starting a new project, or when asked to create a PRD. After PRD is confirmed, use /prd-to-spec (optional) for technical design, then /to-issues to create implementable tickets. Triggers on: create a prd, write prd for, plan this feature, requirements for, spec out, 写PRD, 需求文档, 需求分析, 规格说明.
Modernize Go code by applying version-appropriate idioms and APIs (gofix-style transformations). Scans go.mod for the Go version, then transforms Go source files to use modern patterns—from Go 1.0 through 1.26+. Use when the user says "现代化","现代Go语言", "地道的", "idiomatic", "modernize", "modern-go", "update Go code", "gofix", or wants to upgrade Go idioms.
Illustrate an article (Markdown, HTML, etc.) with animated-style icons from itshover.com/icons. Fetches icons as clean inline SVG and places them at section headings, key concepts, lists, and callouts. Triggers on: /article-icons, 配图, 给文章配图标, add icons to article, illustrate with icons.
Detect software architecture bad smells, algorithmic complexity hotspots, and anti-patterns in a codebase. Produces a detailed markdown report identifying violations of architectural principles, design patterns, code quality, and performance complexity. Triggers on: smell, code smell, architecture smell, find anti-patterns, detect bad smells, complexity analysis, 代码坏味道, 架构坏味道, 反模式, 找出坏味道, 复杂度分析.
Generate a design document (design proposal) from a PRD, in the style of Go's official design proposals — Abstract / Background / Design / Rationale / Compatibility / Implementation, heavy on the 'why' and tradeoffs. Triggers on: to-design, prd-to-design, prd转设计文档, 生成设计文档, 写设计文档, design doc, design proposal, 设计提案, 技术设计文档.
| name | insight-diagram |
| description | 为任意项目生成 UML 图、架构图和流程图。分析代码库后让用户选择要生成的图表类型,使用 architecture-diagram skill 渲染为 HTML+SVG,保存到 docs/ 目录。适用于任何软件项目的文档可视化。 |
分析任意代码库,自动生成 UML 14种图 + 架构图 + 流程图,使用 /architecture-diagram 渲染为 HTML+SVG。
描述系统的物理组成和静态结构。
| 编号 | 图表类型 | 英文标识 | 关注点 |
|---|---|---|---|
| 1 | 系统架构图 | architecture | 组件关系、全局视角(非UML,最常用) |
| 2 | 类图 | class | 定义类、属性、操作及关系 |
| 3 | 对象图 | object | 特定时刻的对象实例及其关系 |
| 4 | 组件图 | component | 系统组件及其依赖关系 |
| 5 | 部署图 | deployment | 物理硬件、节点及软件部署 |
| 6 | 包图 | package | 将模型元素分组组织 |
| 7 | 复合结构图 | composite-structure | 类的内部结构 |
| 8 | 剖面图 | profile | 扩展UML元模型、自定义构造型 |
描述系统与外部参与者或系统内部的交互过程。
| 编号 | 图表类型 | 英文标识 | 关注点 |
|---|---|---|---|
| 9 | 流程图 | flowchart | 主流程与分支(非UML,最常用) |
| 10 | 用例图 | usecase | 从用户角度展示系统功能 |
| 11 | 活动图 | activity | 过程的流程或步骤 |
| 12 | 状态机图 | state-machine | 对象生命周期的状态变迁 |
| 13 | 序列图 | sequence | 按时间顺序展示对象间交互 |
| 14 | 通信图 | communication | 侧重于对象间的组织关系 |
| 15 | 定时图 | timing | 侧重于状态变化的时间约束 |
| 16 | 交互概览图 | interaction-overview | 结合活动图和时序图 |
| 17 | 泳道图 | swimlane | 跨组件/角色职责流程(活动图变体) |
本技能的 examples/ 目录包含 13 个已完成的图表 HTML 文件,作为视觉样式和内容结构的参考模板。生成任何图表前,必须先阅读对应的示例文件,以确保风格一致、结构规范。
| 文件 | 图表类型 | 英文标识 |
|---|---|---|
examples/architecture.html | 系统架构图 | architecture |
examples/class.html | 类图 | class |
examples/object.html | 对象图 | object |
examples/component.html | 组件图 | component |
examples/deployment.html | 部署图 | deployment |
examples/flowchart.html | 流程图 | flowchart |
examples/usecase.html | 用例图 | usecase |
examples/activity.html | 活动图 | activity |
examples/sequence.html | 序列图 | sequence |
examples/communication.html | 通信图 | communication |
examples/dfd.html | 数据流图 | dfd |
examples/interaction-overview.html | 交互概览图 | interaction-overview |
examples/swimlane.html | 泳道图 | swimlane |
生成前必读: 调用 /architecture-diagram 前,先用 Read 工具阅读对应类型的示例文件,从中提取:
结构对齐: 生成的图表应与示例保持相同的结构层次:
内容替换而非照搬: 示例中的业务数据(NovaShield 风控系统)是虚构的参考案例,生成时需替换为目标项目的真实架构信息。只参考布局和样式,不复制业务内容。
无对应示例的类型: 对于包图 (package)、复合结构图 (composite-structure)、剖面图 (profile)、状态机图 (state-machine)、定时图 (timing) 这 5 种没有示例文件的图表类型,参考最相近的已有示例(如包图参考组件图,状态机图参考活动图),并沿用相同的视觉语言。
读取项目关键文件,提取架构信息:
CLAUDE.md(如存在)获取项目概览CLAUDE.md(如存在)获取模块细节**/*.go, **/*.py, **/*.ts 等)main.go, app.py, index.ts 等)识别顶层组件从以上信息中提炼出:
使用 AskUserQuestion 让用户选择要生成的图表(multiSelect: true),分4组展示:
第1组 — 结构性图形(静态):
第2组 — 结构性图形续 + 部署:
第3组 — 行为性图形(动态):
第4组 — 交互图 + 常用非UML:
默认推荐:architecture + sequence + flowchart
对每个选中的图表类型:
examples/<标识>.html(如 examples/architecture.html),提取布局模式、节点样式、标注方式/architecture-diagram skill,传入图表类型、标题、内容描述、输出路径,必须指定 light 风格docs/<标识>.html(如 docs/architecture.html)生成规则:
批量生成顺序(宏观→微观): architecture → component → deployment → package → composite-structure → profile → class → object → usecase → flowchart → activity → state-machine → swimlane → sequence → communication → timing → interaction-overview
生成的 SVG 常见三类几何缺陷,必须用脚本逐张校验并修正:
python3 skills/insight-diagram/scripts/review_svg.py docs/<标识>.html --min-gap 8
# 批量: python3 skills/insight-diagram/scripts/review_svg.py docs/*.html --min-gap 8
脚本检查(与三条核心要求一一对应):
ERROR 深入框内:端点穿入框内部 >8px → 缩短连线,让它止于边缘。WARNING 空接:端点悬空、距最近框 >8px 且不汇入任何其它连线 → 把端点对齐到框边或汇合点。ERROR):非嵌套的两个框在水平、垂直两个方向都有交叠 → 必须移开其中一个。嵌套(一个完全包住另一个,如分组边界框包子节点)是允许的。WARNING):投影相邻的两框净间距 < --min-gap(默认 8px)→ 拉开距离。处理原则:
docs/<标识>.html 里对应的 <rect>/<line>/<path> 坐标,而非重新生成整张图。--strict 让 WARNING 也阻断。全部完成后输出: