diagram
Designed diagrams of real systems — architecture, flowchart, entity-relationship, state machine or sequence — drawn from the code you read, laid out by the browser and styled by the active design system.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1.1k
- Forks
- 104
01 前言 Front Matter
- od
- { "mode": "prototype", "craft": { "requires": [ "color", "accessibility-baseline" ] }, "preview": { "type": "html", "entry": "index.html" }, "platform": "desktop", "scenario": "engineering", "design_system": { "requires": false }, "example_prompt": "Diagram how this repo's packages depend on each other: read each package.json and the imports, group the shared packages and the hosts, and mark build-time copies differently from runtime dependencies." }
- name
- diagram
- tags
- [ "diagram", "architecture", "flowchart", "erd", "sequence", "state machine", "图表", "架构图" ]
- emoji
- 🧭
- en_name
- Diagram
- zh_name
- 代码图表
- category
- diagram
- scenario
- engineering
- triggers
- [ "diagram", "architecture diagram", "flowchart", "flow chart", "sequence diagram", "er diagram", "erd", "state machine", "system diagram", "how does this work", "架构图", "流程图" ]
- description
- Designed diagrams of real systems — architecture, flowchart, entity-relationship, state machine or sequence — drawn from the code you read, laid out by the browser and styled by the active design system.
- en_description
- Designed diagrams of real systems — architecture, flowchart, entity-relationship, state machine or sequence — drawn from the code you read, laid out by the browser and styled by the active design system.
- zh_description
- 根据真实代码绘制的架构图、流程图、ER 图、状态图和时序图, 由浏览器排版, 使用当前设计系统的样式
02 资源文件 1
- 其他.od-local-overlay82 B
03 SKILL.md 正文
Diagram
Intent. One clear, designed diagram of a real system, true to the code, that someone can read in ten seconds. It is an HTML page: you write the content (nodes, links, groups) and the browser lays it out. Never hand-place coordinates.
1. Read before you draw
Every node and link must come from something you read, never from what such systems usually look like.
- Architecture / dependencies: package manifests (
package.json,go.mod,Cargo.toml,pyproject.toml), workspace config, import statements, service and deployment config (docker-compose.yml, Kubernetes manifests). - Flowchart / request flow: the entry point and the functions it calls, route definitions, middleware, queue consumers.
- Entity-relationship: schema files (
schema.prisma, migrations, ORM models,.sql). - State machine: the reducer, state enum or transition table.
- Sequence: one concrete call path, followed through the code in order.
Keep the list of files you read: you register them as sources. If the user's question is broader than what you can read (another service's repo), say what you could see and draw only that.
2. Decide the graph, then the grid
Pick 5–25 nodes. Merge leaf details into their parent; split into two diagrams rather than drawing 40 boxes.
Each node gets two small integers:
data-rank: its step along the flow direction (1 = first). Sources, entry points or foundations come first; things that depend on or are called by earlier nodes come later.data-lane: its position across the flow (1 = top forright, left fordown). Order lanes so linked nodes sit next to each other: that is what keeps links short and off other nodes. Two nodes may not share the same rank and lane.
Direction: right for flows and dependency graphs (wide screens), down for hierarchies and state machines with long chains.
Groups (data-group) mark real boundaries: a package set, a process, a network zone, a team. Members of one group should occupy a contiguous block of ranks and lanes, or the group's box will cover other nodes.
3. Write the page
One self-contained HTML file: a title, an optional one-line subtitle saying what the diagram shows and as of when (commit or date), the diagram, a small legend when you use more than one link style, and a Sources footer listing the files you read.
<div data-od-diagram data-direction="right">
<div class="node" data-od-node="api" data-rank="2" data-lane="1" data-group="backend" data-od-source="services/api/package.json">
<strong>api</strong><small>Express, REST</small>
</div>
…
<i data-od-group="backend" data-label="Backend" hidden></i>
<i data-od-link data-from="web" data-to="api" data-label="HTTPS" hidden></i>
<i data-od-link data-from="api" data-to="queue" data-style="dashed" hidden></i>
</div>
- Node content is yours: a name, optionally a one-line role, an icon drawn in inline SVG. Keep labels short (2–4 words); widths stay similar across a rank.
- Link labels only where they add information (protocol, event name, cardinality). Use
data-style="dashed"for a second kind of link (async, optional, build-time) and explain it in the legend. - Entity-relationship: each table is a node whose content lists its key columns (primary key first, foreign keys marked); links carry the cardinality as their label (
1 — n). - State machine: states are nodes (the initial state at rank 1), transitions are links labelled with the event; use
direction="down"when there are more than 5 states in a row. - Sequence:
<div data-od-diagram="sequence">with participants (data-od-participant, in order left to right) and messages in order (<i data-od-message data-from data-to data-label hidden>,data-kind="return"for replies). Use 3–6 participants and at most 15 messages.
Style from the active design system: node background from --surface, border from --border, text from --fg, secondary text from --muted, one emphasised node at most with --accent. Set the link and group look on the container with the runtime's custom properties (--od-edge-color, --od-edge-width, --od-group-border, --od-group-bg, --od-rank-gap, --od-lane-gap). Don't style the generated SVG or labels any other way.
4. Add the runtime, register, check
- Call
add_open_design_diagram_runtimewith the entry path. It inserts the layout runtime into the file. Never write, copy or edit that<script data-od-runtime="diagram">block yourself. - Call
register_open_design_artifactwith kinddiagram, the title, andsourcesset to the files you read in step 1. - Call
check_open_design_artifact. Fix everydiagram-error(unknown ids, missing rank or lane). Foredge-through-node,node-overlaporgroup-overlap, reorder lanes or ranks rather than nudging anything with CSS. Look at the screenshot: the main path should read left to right (or top to bottom) without the eye jumping back.
When stale-sources is reported later, offer to redraw from the changed files.
04 同仓库更多 Skills
youtube-clipper
YouTube clip generation and editing with automated workflows — pull source video, slice highlights, add captions, and export.
writing-guidelines
Review docs/prose for Writing Guidelines compliance. Use when asked to "review my docs", "check writing style", "audit prose", "review docs voice and tone", or "check this page against the writing handbook".
wpds
WordPress Design System. Apply WordPress's official design tokens, typography, and component patterns to themes and sites.
weread-year-in-review-video-template
WeRead-inspired HyperFrames video template for vertical annual reading reports, personal reading dashboards, book-note recaps, and shareable year-in-review stories. Use when users want a 9:16 HTML-to-MP4 reading report with warm paper texture, editorial Chinese typography, book-page metaphors, data highlights, and deterministic motion.
web-design-guidelines
Review UI code for Web Interface Guidelines compliance by the Vercel engineering team. Covers layout, typography, color, motion, and accessibility for product UI.
web-clone
网站复刻 / 克隆方法论。USE WHEN 用户说 复刻网站、克隆网站、clone website、抄个站、仿站、 照着这个站做一个、reproduce site、还原某个网页效果、把这个站搬下来改成我的、 复刻某个交互/WebGL/Canvas/Three.js 效果。提供「先拿真源码 → 判路径 → 逆向拆解 → 搭工程 → 替换内容」的可移植决策树,覆盖静态站 / React-Vue-Next 内容站 / WebGL-Canvas 重前端站三大分支,并强制核对任何 AI 二手分析里的可执行代码。