architecture-diagram
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseArchitecture Diagram Generator
架构图生成器
Produces self-contained files: inline SVG icons, CSS Grid nested zones, JS-driven SVG connection overlay with color-coded semantic line types and arrowhead markers. Zero external dependencies.
.html生成独立的文件:包含内联SVG图标、CSS Grid嵌套区域、JS驱动的SVG连接覆盖层(带颜色编码的语义线条类型和箭头标记)。无外部依赖。
.htmlWorkflow
工作流程
- Parse user input → extract: components (with descriptions), containment hierarchy (zones/nesting), connections (with semantic types), and any provider context
- Read — select or create icons for each component
references/icons.md - Read — choose topology pattern, set grid-template-columns
references/layout-patterns.md - Read — define connection array with types, side-forcing, routing
references/connections.md - Start from — use its CSS/JS structure as the base
assets/template.html - Assemble the HTML:
- Set ,
{{DIAGRAM_TITLE}},{{BG_COLOR}}{{MAX_WIDTH}} - Populate — one entry per connection type used
{{LEGEND_ITEMS}} - Build zone hierarchy as nested
div.zone > span.zone-label + div.zone-content - Place nodes with , each containing:
data-node-id(inline SVG),.node-icon,.node-title.node-desc - Populate the JS array
connections - Apply provider theming if applicable
- Set
- Output final to the working directory or user-specified path
.html
- 解析用户输入→提取:组件(含描述)、包含层次结构(区域/嵌套)、连接(含语义类型)以及任何提供商上下文
- 读取——为每个组件选择或创建图标
references/icons.md - 读取——选择拓扑模式,设置grid-template-columns
references/layout-patterns.md - 读取——定义包含类型、强制侧边、路由的连接数组
references/connections.md - 基于——使用其CSS/JS结构作为基础
assets/template.html - 组装HTML:
- 设置、
{{DIAGRAM_TITLE}}、{{BG_COLOR}}{{MAX_WIDTH}} - 填充——每个使用的连接类型对应一个条目
{{LEGEND_ITEMS}} - 构建区域层次结构,格式为嵌套的
div.zone > span.zone-label + div.zone-content - 放置带有的节点,每个节点包含:
data-node-id(内联SVG)、.node-icon、.node-title.node-desc - 填充JS数组
connections - 如有需要,应用提供商主题
- 设置
- 输出最终的文件到工作目录或用户指定路径
.html
Node construction
节点构造
Every node must have:
- Unique (semantic:
data-node-id,fusion-hcm, notedi-adaptor)node-7 - with inline SVG from the icon registry (or custom-generated following registry constraints)
.node-icon - — short name (1–3 words, bold)
.node-title - — extended description text (protocols, module lists, capabilities). Populate this whenever the user provides detail beyond just a name. This is critical for professional-quality diagrams.
.node-desc
每个节点必须包含:
- 唯一的(语义化命名:如
data-node-id、fusion-hcm,而非edi-adaptor)node-7 - ,包含来自图标注册表的内联SVG(或遵循注册表约束自定义生成)
.node-icon - ——短名称(1-3个词,加粗)
.node-title - ——扩展描述文本(协议、模块列表、功能)。只要用户提供了名称之外的详细信息,就需要填充此字段。这对生成专业质量的图表至关重要。
.node-desc
Key structural invariants
关键结构约束
- Every has exactly one
div.zoneand onespan.zone-labeldiv.zone-content - Every has explicit
div.zone-contentstyle="grid-template-columns: ..." - Zone depth class (to
zone-depth-0) matches actual nesting levelzone-depth-3 - All SVG icons are inline inside — no external image references
.node-icon - Connection overlay SVG with (arrow markers for each color) sits after the diagram div
<defs> - Connection renderer is last before
<script></body> - Legend div sits above the diagram div, containing only types actually used
- 每个恰好包含一个
div.zone和一个span.zone-labeldiv.zone-content - 每个都有明确的
div.zone-contentstyle="grid-template-columns: ..." - 区域深度类(至
zone-depth-0)与实际嵌套层级匹配zone-depth-3 - 所有SVG图标都内联在中——无外部图片引用
.node-icon - 带有(每种颜色对应箭头标记)的连接覆盖层SVG位于图表div之后
<defs> - 连接渲染器位于
<script>之前的最后位置</body> - 图例div位于图表div上方,仅包含实际使用的类型
Connection type selection
连接类型选择
Match connection semantics to the appropriate type:
- (blue solid): REST, SOAP, API calls, synchronous requests, real-time data
realtime - (red dashed): SFTP, file transfers, EDI, scheduled batch jobs, bulk data
batch - (green solid): event-driven triggers, pub-sub, webhooks, callbacks, business events
event - (orange dashed): management plane, monitoring, config push, admin flows
control - (blue solid): when semantic type is ambiguous or only one flow type exists
default
When the user doesn't specify flow semantics, default all connections to type and omit the legend.
default将连接语义与适当类型匹配:
- (蓝色实线):REST、SOAP、API调用、同步请求、实时数据
realtime - (红色虚线):SFTP、文件传输、EDI、定时批处理作业、批量数据
batch - (绿色实线):事件驱动触发器、发布-订阅、Webhooks、回调、业务事件
event - (橙色虚线):管理平面、监控、配置推送、管理流程
control - (蓝色实线):当语义类型不明确或仅存在一种流类型时
default
当用户未指定流语义时,将所有连接默认设置为类型,并省略图例。
defaultDesign defaults
设计默认值
- Background: (warm neutral) or
#f0ece4(cool blue-gray) — choose based on provider/context#e8eef5 - Zone borders: dashed, colored by depth (warm browns → reds)
- Icons: 44×44px, (or provider-specific)
--icon-color: #3a3a3a - Node title: 12px bold, node desc: 10.5px regular #555
- Connections: 2px stroke, curved by default
- Font: Segoe UI / system-ui stack
- Max-width: 1400px typical, increase for complex diagrams
- 背景:(暖中性色)或
#f0ece4(冷蓝灰色)——根据提供商/上下文选择#e8eef5 - 区域边框:虚线,按深度着色(暖棕色→红色)
- 图标:44×44px,(或提供商特定颜色)
--icon-color: #3a3a3a - 节点标题:12px加粗,节点描述:10.5px常规#555
- 连接:2px描边,默认弯曲
- 字体:Segoe UI / system-ui栈
- 最大宽度:通常1400px,复杂图表可增大
Handling ambiguity
歧义处理
- Infer zone nesting from naming conventions (Region > VPC > Subnet, etc.)
- Default to connections and no legend if flow types are unspecified
default - Place management/observability services outside the main data-path zones
- Use generic icon set and warm-neutral background unless provider is specified
- Ask for clarification only when component list or topology is fundamentally ambiguous
- 从命名约定推断区域嵌套(如Region > VPC > Subnet等)
- 如果未指定流类型,默认所有连接为类型并省略图例
default - 将管理/可观测性服务放置在主数据路径区域之外
- 除非指定提供商,否则使用通用图标集和暖中性背景
- 仅当组件列表或拓扑存在根本性歧义时才请求澄清
Error Handling
错误处理
| Problem | Cause | Fix |
|---|---|---|
| File deleted or skill directory incomplete | Regenerate from skill defaults: reconstruct the CSS/JS skeleton using the structure documented in this SKILL.md and the reference files |
Icon reference not found in | Component type not in the registry | Fall back to the generic box icon defined in |
| Connection lines overlap or route through nodes | Dense graph with auto-routing conflicts | Adjust zone layout: increase |
| Playwright render failure during HTML-to-image export | Chromium not installed or script error | Run |
| Zone nesting exceeds depth-3 styling | Architecture has more than 4 containment levels | Flatten by combining the deepest two levels into a single zone, or split into two separate diagrams linked by description |
| 问题 | 原因 | 修复方案 |
|---|---|---|
| 文件删除或技能目录不完整 | 从技能默认值重新生成:使用本SKILL.md和参考文件中记录的结构重建CSS/JS框架 |
| 组件类型不在注册表中 | 回退到 |
| 连接线重叠或穿过节点 | 密集图的自动路由冲突 | 调整区域布局:增大 |
| HTML转图片导出时Playwright渲染失败 | Chromium未安装或脚本错误 | 运行 |
| 区域嵌套超出depth-3样式 | 架构包含超过4个包含层级 | 通过将最深的两个层级合并为单个区域来扁平化,或拆分为两个通过描述关联的独立图表 |
References
参考资料
- — 28+ SVG icon definitions, custom icon rules, provider color table
references/icons.md - — node structure, zone nesting, 5 topology patterns, interior grid guidance, sizing table
references/layout-patterns.md - — connection schema, 6 semantic types with colors, side-forcing, route modes, legend markup
references/connections.md - — complete HTML skeleton: CSS, legend, zone/node styles, marker defs for all colors, connection renderer JS with auto side-detection
assets/template.html
- ——28+个SVG图标定义、自定义图标规则、提供商颜色表
references/icons.md - ——节点结构、区域嵌套、5种拓扑模式、内部网格指南、尺寸表
references/layout-patterns.md - ——连接 schema、6种带颜色的语义类型、强制侧边、路由模式、图例标记
references/connections.md - ——完整HTML框架:CSS、图例、区域/节点样式、所有颜色的标记定义、带自动侧边检测的连接渲染器JS
assets/template.html