系统架构图生成
architecture-diagram
生成专业的深色主题系统架构图,输出为独立的 HTML/SVG 文件。结果自包含,无外部依赖。基于 Cocoon AI 的 architecture-diagram-generator(MIT 许可)。
- License 许可
- MIT
- 所属仓库
- ajoslin/dot
- 最近更新
- 2026-07-04
- Stars
- ★ 24
- Forks
- 7
01 前言 Front Matter
- name
- architecture-diagram
- author
- Cocoon AI (hello@cocoon-ai.com), ported by Hermes Agent
- license
- MIT
- version
- 1.0.0
- metadata
- { "hermes": { "tags": [ "architecture", "diagrams", "SVG", "HTML", "visualization", "infrastructure", "cloud" ], "related_skills": [ "excalidraw" ] } }
- description
- Generate professional dark-themed system architecture diagrams as standalone HTML/SVG files. Self-contained output with no external dependencies. Based on Cocoon AI's architecture-diagram-generator (MIT).
- dependencies
- []
02 资源文件 1
- 参考文档templates/template.html17.6 KB
03 SKILL.md 正文
Architecture Diagram Skill
Generate professional, dark-themed technical architecture diagrams as standalone HTML files with inline SVG graphics. No external tools, no API keys, no rendering libraries — just write the HTML file and open it in a browser.
Based on Cocoon AI's architecture-diagram-generator (MIT).
Workflow
- User describes their system architecture (components, connections, technologies)
- Generate the HTML file following the design system below
- Save with
write_fileto a.htmlfile (e.g.~/architecture-diagram.html) - User opens in any browser — works offline, no dependencies
Output Location
Save diagrams to a user-specified path, or default to the current working directory:
./[project-name]-architecture.html
Preview
After saving, suggest the user open it:
# macOS
open ./my-architecture.html
# Linux
xdg-open ./my-architecture.html
Design System & Visual Language
Color Palette (Semantic Mapping)
Use specific rgba fills and hex strokes to categorize components:
| Component Type | Fill (rgba) | Stroke (Hex) |
|---|---|---|
| Frontend | rgba(8, 51, 68, 0.4) |
#22d3ee (cyan-400) |
| Backend | rgba(6, 78, 59, 0.4) |
#34d399 (emerald-400) |
| Database | rgba(76, 29, 149, 0.4) |
#a78bfa (violet-400) |
| AWS/Cloud | rgba(120, 53, 15, 0.3) |
#fbbf24 (amber-400) |
| Security | rgba(136, 19, 55, 0.4) |
#fb7185 (rose-400) |
| Message Bus | rgba(251, 146, 60, 0.3) |
#fb923c (orange-400) |
| External | rgba(30, 41, 59, 0.5) |
#94a3b8 (slate-400) |
Typography & Background
- Font: JetBrains Mono (Monospace), loaded from Google Fonts
- Sizes: 12px (Names), 9px (Sublabels), 8px (Annotations), 7px (Tiny labels)
- Background: Slate-950 (
#020617) with a subtle 40px grid pattern
<!-- Background Grid Pattern -->
<pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
<path d="M 40 0 L 0 0 0 40" fill="none" stroke="#1e293b" stroke-width="0.5"/>
</pattern>
Technical Implementation Details
Component Rendering
Components are rounded rectangles (rx="6") with 1.5px strokes. To prevent arrows from showing through semi-transparent fills, use a double-rect masking technique:
- Draw an opaque background rect (
#0f172a) - Draw the semi-transparent styled rect on top
Connection Rules
- Z-Order: Draw arrows early in the SVG (after the grid) so they render behind component boxes
- Arrowheads: Defined via SVG markers
- Security Flows: Use dashed lines in rose color (
#fb7185) - Boundaries:
- Security Groups: Dashed (
4,4), rose color - Regions: Large dashed (
8,4), amber color,rx="12"
- Security Groups: Dashed (
Spacing & Layout Logic
- Standard Height: 60px (Services); 80-120px (Large components)
- Vertical Gap: Minimum 40px between components
- Message Buses: Must be placed in the gap between services, not overlapping them
- Legend Placement: CRITICAL. Must be placed outside all boundary boxes. Calculate the lowest Y-coordinate of all boundaries and place the legend at least 20px below it.
Document Structure
The generated HTML file follows a four-part layout:
- Header: Title with a pulsing dot indicator and subtitle
- Main SVG: The diagram contained within a rounded border card
- Summary Cards: A grid of three cards below the diagram for high-level details
- Footer: Minimal metadata
Info Card Pattern
<div class="card">
<div class="card-header">
<div class="card-dot cyan"></div>
<h3>Title</h3>
</div>
<ul>
<li>• Item one</li>
<li>• Item two</li>
</ul>
</div>
Output Requirements
- Single File: One self-contained
.htmlfile - No External Dependencies: All CSS and SVG must be inline (except Google Fonts)
- No JavaScript: Use pure CSS for any animations (like pulsing dots)
- Compatibility: Must render correctly in any modern web browser
Template Reference
Load the full HTML template for the exact structure, CSS, and SVG component examples:
skill_view(name="architecture-diagram", file_path="templates/template.html")
The template contains working examples of every component type (frontend, backend, database, cloud, security), arrow styles (standard, dashed, curved), security groups, region boundaries, and the legend — use it as your structural reference when generating diagrams.
04 同仓库更多 Skills
OpenCode 本地记忆检索
opencode-memory
浏览并回忆存储在用户机器上的 OpenCode 本地记忆:本地会话、计划、对话、提示历史及项目上下文。当用户询问查看历史、之前的会话、过往聊天、我们之前做了什么、上次、查看计划、会话历史、回忆、记忆、记住、先前工作、之前的上下文,或我们是否做过这件事时立即使用。在恢复工作、继续项目、引用先前决策、调试重复出现的问题、重温早期计划,或任何早期 OpenCode 上下文可能有帮助的后续任务中主动触发。此处特指 OpenCode 本地历史/文件,而非 ChatGPT/Claude 云端历史、通用网络搜索或不相关的产品记忆系统。不要用于没有相关历史的新任务,或当前文件/git 已能回答问题的场景。
React 组件组合模式
vercel-composition-patterns
可扩展的 React 组合模式。当重构存在布尔 prop 泛滥的组件、构建灵活的组件库或设计可复用 API 时使用。在涉及复合组件、render props、context providers 或组件架构的任务时触发。包含 React 19 API 变更。