visual-explainer by nicobailon/visual-explainer
npx skills add https://github.com/nicobailon/visual-explainer --skill visual-explainer为技术图表、可视化效果和数据表格生成自包含的 HTML 文件。加载此技能后,始终在浏览器中打开结果。切勿回退到 ASCII 艺术。
主动表格渲染。 当你即将在终端中以 ASCII 框线表格形式呈现表格数据时(比较、审计、功能矩阵、状态报告、任何结构化的行/列),请改为生成一个 HTML 页面。阈值:如果表格有 4 行以上或 3 列以上,则应放在浏览器中查看。不要等待用户要求——自动将其渲染为 HTML 并告知他们文件路径。你仍然可以在聊天中包含简短的文本摘要,但表格本身应该是 HTML 页面。
./commands/ 中有详细的提示模板。在 Pi 中,这些是斜杠命令(/diff-review)。在 Claude Code 中,是命名空间的(/visual-explainer:diff-review)。在 Codex 中,使用 /prompts:diff-review(如果安装到 ~/.codex/prompts/)或调用 $visual-explainer 并描述工作流程。
| 命令 | 功能 |
|---|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
generate-web-diagram| 为任何主题生成 HTML 图表 |
generate-visual-plan | 为功能生成可视化实施计划 |
generate-slides | 生成杂志质量的幻灯片 |
diff-review | 包含架构比较和代码审查的可视化差异审查 |
plan-review | 将计划与代码库进行比较并进行风险评估 |
project-recap | 用于切换回项目时的思维模型快照 |
fact-check | 根据实际代码验证文档的准确性 |
share | 将 HTML 页面部署到 Vercel 并获取实时 URL |
在编写 HTML 之前,确定一个方向。不要每次都默认使用“深色主题配蓝色点缀”。
视觉化始终是默认选项。 即使是论文、博客文章和文章也要进行视觉处理——将结构提取为卡片、图表、网格、表格。
散文模式(导语段落、引文、标注框)是视觉页面中的点缀元素,而不是一种独立的模式。使用它们来突出关键点或提供喘息空间,但页面结构保持视觉化。
关于散文点缀,请参阅 ./references/css-patterns.md 中的“散文页面元素”。对于其他所有内容,请使用以下美学指导下的标准自由形式方法。
谁在看? 是理解系统的开发人员?是看大局的产品经理?是审查提案的团队?这决定了信息密度和视觉复杂性。
什么类型的内容? 架构、流程图、序列图、数据流、模式/ER 图、状态机、思维导图、类图、C4 架构、数据表、时间线、仪表板,或散文优先的页面。每种都有不同的布局需求和渲染方法(见下文图表类型)。
什么美学风格? 选择一个并坚持。受约束的美学风格(蓝图、社论、纸张/墨水)更安全——它们有特定的要求,可以防止产生通用输出。灵活的风格(IDE 风格)需要更多的纪律性。
受约束的美学风格(优先选择这些):
websocket-implementation-plan.html#faf7f5 背景,赤陶土/鼠尾草色点缀,非正式感)灵活的美学风格(谨慎使用):
明确禁止:
每次都要改变选择。如果上一个图表是深色和技术性的,就让下一个是浅色和社论风格的。交换测试:如果你用通用的深色主题替换你的样式,没有人会注意到区别,那么你就没有设计任何东西。
在生成之前阅读参考资料。 不要死记硬背——每次都要阅读以吸收模式。
./templates/architecture.html./templates/mermaid-flowchart.html./templates/data-table.html--slides 标志或调用 /generate-slides 时):阅读 ./templates/slide-deck.html 和 ./references/slide-patterns.md./references/css-patterns.md 中的“散文页面元素”部分和 ./references/libraries.md 中的“按内容语气的排版”对于 CSS/布局模式和 SVG 连接器,阅读 ./references/css-patterns.md。
对于包含 4 个以上部分的页面(审查、回顾、仪表板),还需阅读 ./references/responsive-nav.md,了解桌面端带粘性侧边栏目录和移动端水平可滚动栏的部分导航。
选择渲染方法:
| 内容类型 | 方法 | 原因 |
|---|---|---|
| 架构(文本密集) | CSS Grid 卡片 + 流向箭头 | 丰富的卡片内容(描述、代码、工具列表)需要 CSS 控制 |
| 架构(拓扑导向) | Mermaid | 组件之间的可见连接需要自动边路由 |
| 流程图 / 流水线 | Mermaid | 自动节点定位和边路由 |
| 序列图 | Mermaid | 生命线、消息和激活框需要自动布局 |
| 数据流图 | Mermaid 带边标签 | 连接和数据描述需要自动边路由 |
| ER / 模式图 | Mermaid | 多个实体之间的关系线需要自动路由 |
| 状态机 | Mermaid | 带标签边的状态转换需要自动布局 |
| 思维导图 | Mermaid | 分层分支需要自动定位 |
| 类图 | Mermaid | 继承、组合、聚合线需要自动路由 |
| C4 架构图 | Mermaid | 使用 graph TD + subgraph 表示 C4(不要用原生的 C4Context——它忽略主题) |
| 数据表 | HTML <table> | 语义标记、可访问性、复制粘贴行为 |
| 时间线 | CSS(中心线 + 卡片) | 简单的线性布局不需要布局引擎 |
| 仪表板 | CSS Grid + Chart.js | 带嵌入式图表的卡片网格 |
Mermaid 主题化: 始终使用 theme: 'base' 并配合自定义的 themeVariables,以便颜色与你的页面调色板匹配。对于复杂图形,使用 layout: 'elk'(需要 @mermaid-js/layout-elk 包——参见 ./references/libraries.md 了解 CDN 导入)。使用 CSS 覆盖 Mermaid 的 SVG 类以实现像素级完美控制。完整的主题指南请参见 ./references/libraries.md。
Mermaid 容器: 始终使用 display: flex; justify-content: center; 居中 Mermaid 图表。为每个 .mermaid-wrap 容器添加缩放控件(+/-/重置/展开)。包含点击展开的 JavaScript,以便点击图表(或 ⛶ 按钮)在新标签页中全尺寸打开。
⚠️ 切勿使用裸的 <pre class="mermaid">。 它能渲染但没有缩放/平移控件——图表会变得极小且无法使用。始终使用 templates/mermaid-flowchart.html 中的完整 diagram-shell 模式:HTML 结构(.diagram-shell > .mermaid-wrap > .zoom-controls + .mermaid-viewport > .mermaid-canvas)、CSS 以及用于缩放/平移/适应的约 200 行 JS 模块。完整复制它。
Mermaid 缩放: 包含 10 个以上节点的图表默认渲染得太小。对于 10-12 个节点,将 themeVariables 中的 fontSize 增加到 18-20px,并将 INITIAL_ZOOM 设置为 1.5-1.6。对于 15 个以上的元素,不要尝试缩放——改用混合模式(简单的 Mermaid 概述 + CSS Grid 卡片)。参见下面的“架构 / 系统图”。
Mermaid 布局方向: 对于复杂图表,优先使用 flowchart TD(自上而下)而非 flowchart LR(从左到右)。LR 会水平展开,当节点众多时标签会变得难以阅读。仅对简单的 3-4 节点线性流程使用 LR。参见 ./references/libraries.md 中的“布局方向:TD 与 LR”。
Mermaid 流程图标签中的换行: 在引用的标签内使用 <br/>。切勿使用转义换行符如 \n(Mermaid 在 HTML 输出中将其渲染为字面文本)。示例:A["Copilot Backend<br/>/api + /api/voicebot"]。
Mermaid CSS 类冲突约束: 切勿将 .node 定义为页面级 CSS 类。Mermaid.js 在内部将 .node 用于 SVG <g> 元素,并带有 transform: translate(x, y) 进行定位。页面级的 .node 样式(悬停变换、盒阴影)会泄漏到图表中并破坏布局。对于卡片组件,请改用带命名空间的 .ve-card 类。样式化 Mermaid 的 .node 的唯一安全方法是将其限定在 .mermaid 下(例如,.mermaid .node rect)。
AI 生成插图(可选)。 如果 surf-cli 可用,你可以通过 Gemini 生成图像并将其嵌入页面,用于创意、说明、解释、教育或装饰目的。使用 which surf 检查可用性。如果可用:
# 生成到临时文件(使用 --aspect-ratio 进行控制)
surf gemini "描述性提示" --generate-image /tmp/ve-img.png --aspect-ratio 16:9
# 为自包含性进行 Base64 编码(macOS)
IMG=$(base64 -i /tmp/ve-img.png)
# Linux: IMG=$(base64 -w 0 /tmp/ve-img.png)
# 嵌入 HTML 并清理
# <img src="data:image/png;base64,${IMG}" alt="描述性替代文本">
rm /tmp/ve-img.png
图像容器样式(英雄横幅、内联插图、标题)请参见 ./references/css-patterns.md。
何时使用: 建立页面视觉基调的英雄横幅。Mermaid 无法表达的抽象系统的概念性插图(物理基础设施、用户旅程、思维模型)。受益于艺术或照片级真实感渲染的教育性图表。强化美学风格的装饰性点缀。
何时跳过: Mermaid 或 CSS 能很好处理的任何内容。不传达意义的通用装饰。图像会分散注意力的数据密集型页面。始终优雅降级——如果 surf 不可用,跳过图像而不报错。页面应仅凭 CSS 和排版就能独立存在。
提示词技巧: 使图像与页面的调色板和美学方向相匹配。指定样式(3D 渲染、技术插图、水彩、等距、扁平矢量等)并提及 CSS 变量中的主色调。英雄横幅使用 --aspect-ratio 16:9,内联插图使用 --aspect-ratio 1:1。保持提示词具体——“深海军蓝背景上带有青色节点的消息队列等距插图”比“队列图”更好。
将以下原则应用于每个图表:
排版就是图表。 从 ./references/libraries.md 中的列表中选择一个独特的字体配对。每次生成的页面都应使用与最近生成不同的配对。
禁止作为 --font-body 的字体: Inter、Roboto、Arial、Helvetica、单独的 system-ui。这些是 AI 垃圾信号的标志。
好的配对(使用这些):
通过 <head> 中的 <link> 加载。在 font-family 堆栈中包含系统字体回退,以提高离线恢复能力。
色彩讲述故事。 使用 CSS 自定义属性定义完整的调色板。至少定义:--bg、--surface、--border、--text、--text-dim 和 3-5 种强调色。每种强调色都应有一个完整变体和一个暗淡变体(用于背景)。尽可能使用语义化命名变量(--pipeline-step 而不是 --blue-3)。支持两种主题。
禁止的强调色: #8b5cf6 #7c3aed #a78bfa(靛蓝色/紫罗兰色)、#d946ef(紫红色)、青色-洋红色-粉色的组合。这些是 Tailwind 的默认值,表明零设计意图。
好的强调色调色板(使用这些):
#c2410c、#65a30d)——温暖、大地色系#0891b2、#0369a1)——技术性、精确#be123c、#881337)——社论风格、精致#d97706、#059669)——数据导向#1e3a5f、#d4a73a)——高级、精致将你的主要美学风格放在 :root 中,备用风格放在媒体查询中:
/* 浅色优先(社论、纸张/墨水、蓝图): */
:root { /* 浅色值 */ }
@media (prefers-color-scheme: dark) { :root { /* 深色值 */ } }
/* 深色优先(霓虹灯、IDE 风格、终端): */
:root { /* 深色值 */ }
@media (prefers-color-scheme: light) { :root { /* 浅色值 */ } }
表面低语,而非呐喊。 通过微妙的亮度变化(层级间 2-4%)而非剧烈的颜色变化来构建深度。边框应为低不透明度的 rgba(深色模式下为 rgba(255,255,255,0.08),浅色模式下为 rgba(0,0,0,0.08))——看时可见,不看时无形。
背景营造氛围。 不要对页面背景使用纯色。使用微妙的渐变、通过 CSS 实现的淡网格图案,或焦点区域后方柔和的径向发光。背景应该感觉像一个空间,而不是一个空洞。
视觉权重表示重要性。 并非每个部分都值得同等的视觉处理。执行摘要和关键指标应在加载时主导视口(更大的字体、更多的内边距、微妙的强调色调背景区域)。参考部分(文件映射、依赖列表、决策日志)应紧凑且不碍事。对于有用但非主要的部分,使用 <details>/<summary>——可折叠模式在 ./references/css-patterns.md 中。
表面深度创建层次结构。 改变卡片深度以指示重要性。英雄部分获得提升的阴影和强调色调背景(ve-card--hero 模式)。正文内容保持扁平(默认的 .ve-card)。代码块和次要内容感觉凹陷(ve-card--recessed)。参见 ./references/css-patterns.md 中的深度层级。不要把所有东西都提升——当所有东西都突出时,就没有东西突出了。
动画有其用武之地。 页面加载时的交错淡入几乎总是值得的——它们引导视线浏览图表的层次结构。根据角色混合动画类型:卡片用 fadeUp,KPI 和徽章用 fadeScale,SVG 连接器用 drawIn,英雄数字用 countUp。交互感元素上的悬停过渡使图表感觉生动。始终尊重 prefers-reduced-motion。CSS 过渡和关键帧处理大多数情况。对于编排的多元素序列,可通过 CDN 使用 anime.js(参见 ./references/libraries.md)。
禁止的动画:
@keyframes glow { box-shadow: 0 0 20px... })——这是 AI 垃圾保持动画有目的性:入口显示、悬停反馈和用户发起的交互。任何东西都不应自行发光或脉动。
输出位置: 写入 ~/.agent/diagrams/。使用基于内容的描述性文件名:modem-architecture.html、pipeline-flow.html、schema-overview.html。该目录在会话间持久存在。
在浏览器中打开:
open ~/.agent/diagrams/filename.htmlxdg-open ~/.agent/diagrams/filename.html告知用户文件路径,以便他们可以重新打开或分享。
根据复杂性有三种方法:
简单拓扑(少于 10 个元素): 使用 Mermaid。带有自定义 themeVariables 的 graph TD 可生成具有自动边路由的可读图表。
文本密集型概述(少于 15 个元素): 使用具有显式行/列放置的 CSS Grid。部分作为带有彩色边框和等宽标签的圆角卡片。部分之间的垂直流向箭头。./templates/architecture.html 处的参考模板演示了此模式。当卡片需要描述、代码引用、工具列表或其他 Mermaid 节点无法容纳的丰富内容时使用。
复杂架构(15 个以上元素): 使用混合模式——一个简单的 Mermaid 概述(5-8 个节点显示模块关系),后跟每个模块内部的详细 CSS Grid 卡片。这为你提供了视觉拓扑和可读的细节。概述图使用模块名称,并用 <small> 标签标注关键函数名。下面的卡片显示完整的函数列表,带有新增/修改徽章。切勿尝试将 15 个以上的元素塞进单个 Mermaid 图表中——即使有缩放控件,它也会渲染得难以阅读。
使用 Mermaid。 自动节点定位和边路由可生成带有连接线、决策菱形和平行分支的适当图表——比带有箭头字符的 CSS flexbox 好得多。优先使用 graph TD(自上而下);仅对简单的 3-4 节点线性流程使用 graph LR。使用 Mermaid 的 classDef 对节点类型进行颜色编码,或依赖 themeVariables 进行自动样式设置。
使用 Mermaid。 生命线、消息、激活框、注释和循环都需要自动布局。使用 Mermaid 的 sequenceDiagram 语法。通过 CSS 覆盖 .actor、.messageText、.activation 类来样式化参与者和消息。
使用 Mermaid。 数据流图强调连接而非方框——这正是 Mermaid 擅长的。使用 graph TD(或用于简单线性流的 graph LR)并带有用于数据描述的边标签。主要流使用更粗、彩色的边。通过 Mermaid 的 classDef 将源/汇节点样式化为与转换节点不同。
使用 Mermaid。 实体之间的关系线需要自动路由。使用 Mermaid 的 erDiagram 语法和实体属性。通过 themeVariables 和 CSS 覆盖 .er.entityBox 和 .er.relationshipLine 进行样式设置。
使用 Mermaid。 使用 stateDiagram-v2 表示带有标签转换的状态。支持嵌套状态、分支、合并和注释。决策树可以使用带有菱形决策节点的 graph TD。
stateDiagram-v2 标签注意事项: 转换标签有严格的解析器——冒号、括号、<br/>、HTML 实体和大多数特殊字符会导致静默解析失败(“文本中的语法错误”)。如果你的标签需要这些(例如,cancel()、curate: true、多行标签),请改用 flowchart TD,并带有圆角节点和带引号的边标签(|"标签文本"|)。流程图处理所有特殊字符并支持 <br/> 换行。将 stateDiagram-v2 保留用于简单的单字或纯文本标签。
使用 Mermaid。 使用 mindmap 语法表示从根节点的分层分支。Mermaid 自动处理径向布局。使用 themeVariables 样式化以控制每个深度级别的节点颜色。
使用 Mermaid。 使用 classDiagram 语法进行领域建模、OOP 设计和带有类型化属性及方法的实体关系。支持关系:关联(-->)、组合(*--)、聚合(o--)和继承(<|--)。添加多重性标签(例如,"1" --> "*")和抽象/接口标记(<<interface>>、<<abstract>>)。对于没有 OOP 语义的简单实体框(无方法、无继承),请改用 erDiagram——它能为纯数据建模生成更清晰的输出。
使用 Mermaid 流程图语法——而非原生 C4。 使用 graph TD 和 subgraph 块表示 C4 边界。原生的 C4Context 硬编码了锐角、自己的字体、蓝色图标和内联 SVG 颜色,这些都会忽略 themeVariables——它总是与自定义调色板冲突。
流程图作为 C4 的模式: 人员 → 圆角节点 (("名称")),系统 → 矩形 ["名称"],数据库 → 圆柱体 [("名称")],边界 → subgraph 块,关系 → 带标签的箭头 -->|"协议"|。使用 classDef + :::className 来视觉区分外部系统(例如,虚线边框)。这继承了 themeVariables、fontFamily 和 CSS 覆盖,就像其他 Mermaid 图表一样。
使用真正的 <table> 元素——而不是假装成表格的 CSS Grid。表格免费获得可访问性、复制粘贴行为和列对齐。./templates/data-table.html 处的参考模板演示了以下所有模式。
主动使用。 任何你会在终端中渲染 ASCII 框线表格的时候,都改为生成 HTML 表格。这包括:需求审计(请求 vs 计划)、功能比较、状态报告、配置矩阵、测试结果摘要、依赖列表、权限表、API 端点清单——任何结构化的行和列。
布局模式:
<thead> 以便在滚动长表格时标题保持可见tr:nth-child(even) 交替行背景(微妙,2-3% 的亮度变化)overflow-x: auto,用于宽于视口的表格<colgroup> 或 th 宽度提示列宽——让文本密集的列有呼吸空间状态指示器(使用样式化的 <span> 元素,切勿使用表情符号):
单元格内容:
<code><small> 并调暗颜色tabular-nums带有中心线(CSS 伪元素)的垂直或水平时间线。阶段标记作为线上的圆圈。内容卡片向左/右分支(交替)或全部在一侧。线上的日期标签。颜色从过去(柔和)到未来(鲜艳)渐变。
卡片网格布局。英雄数字大而突出。通过内联 SVG <polyline> 实现迷你图。通过 CSS linear-gradient 在 div 上实现进度条。对于真实图表(条形图、折线图、饼图),使用通过 CDN 的 Chart.js(参见 ./references/libraries.md)。带有趋势指示器(向上/向下箭头、百分比增量)的 KPI 卡片。
用于可视化实施计划、扩展设计或功能规范。目标是理解方法,而不是阅读完整的源代码。
不要转储完整文件。 内联显示整个源文件会使页面不堪重负,并违背视觉解释的目的。相反:
代码块需要显式格式化。 没有 white-space: pre-wrap,代码会挤在一起变成难以阅读的墙。正确的模式请参见 ./references/css-patterns.md 中的“代码块”部分。
实施计划的结构:
可视化文档时,将结构提取为视觉元素:
| 内容 | 视觉处理 |
|---|---|
| 功能 | 卡片网格(2-3 列) |
| 安装/设置步骤 | 编号卡片或垂直流程 |
| API 端点/命令 | 带粘性标题的表格 |
| 配置选项 | 表格 |
| 架构 | Mermaid 图表或 CSS 卡片布局 |
| 比较 | 并排面板或表格 |
| 警告/备注 | 标注框 |
不要仅仅格式化散文——要转换它。功能列表变成卡片网格。安装步骤变成编号流程。API 参考变成表格。
在视觉页面中谨慎使用这些元素来突出关键点或提供喘息空间。CSS 模式请参见 ./references/css-patterns.md 中的“散文页面元素”。
何时使用: 解释论文的视觉页面可能会使用导语段落陈述论点,然后使用卡片展示关键论点。README 可视化可能会使用标注框表示警告,但其他方面保持卡片/表格导向。
一种替代输出格式,用于将内容呈现为杂志质量的幻灯片演示,而非可滚动页面。仅限选择加入——当用户调用 /generate-slides、向现有提示传递 --slides(例如,/diff-review --slides)或明确要求幻灯片时,代理才会生成幻灯片。切勿自动选择幻灯片格式。
在生成幻灯片之前,阅读 ./references/slide-patterns.md(引擎 CSS、幻灯片类型、过渡、导航界面、预设)和 ./templates/slide-deck.html(展示所有 10 种类型的参考模板)。同时阅读 ./references/css-patterns.md 了解共享模式,阅读 ./references/libraries.md 了解 Mermaid/Chart.js 主题化。
幻灯片不是重新格式化的页面。 它们是不同的媒介。每张幻灯片恰好是一个视口高度(100dvh),没有滚动。排版是 2-3 倍大。构图更大胆。代理编排一个叙事弧线(影响 → 背景 → 深入探讨 → 解决方案),而不是机械地将源内容分页。
内容完整性。 改变媒介并不意味着丢弃内容。在编写任何 HTML 之前,请遵循 slide-patterns.md 中的“根据源文档规划幻灯片”流程:清点源内容,将每个项目映射到幻灯片,验证覆盖率。源文档中的每个部分、决策、数据点、规范和可折叠细节都必须出现在幻灯片中。如果计划有 7 个部分,幻灯片应涵盖所有 7 个。如果有 6 个决策,展示所有 6 个——而不是只适合一张幻灯片的 2 个。源文档中的可折叠细节成为它们自己的幻灯片。添加更多幻灯片,而不是削减内容。一个涵盖所有内容的 22 页幻灯片,胜过一个看起来精致但缺少 40% 源内容的 13 页幻灯片。
幻灯片类型(10 种): 标题、部分分隔符、内容、分屏、图表、仪表板、表格、代码、引文、全出血。每种在 slide-patterns.md 中都有定义的布局。超过幻灯片密度限制的内容会跨多张幻灯片分割——切勿在单张幻灯片内滚动。
视觉丰富度: 开始时检查 which surf。如果 surf-cli 可用,在编写 HTML 之前生成 2-4 张图像(标题幻灯片背景、全出血背景、可选的内容插图)——工作流程请参见 slide-patterns.md 中的“主动图像”部分。同时使用 SVG 装饰点缀、每张幻灯片的背景渐变、内联迷你图和小型 Mermaid 图表。视觉优先,文本其次。
构图多样性: 连续的幻灯片必须在空间方法上有所变化——居中、左重、右重、分屏、边缘对齐、全出血。连续三张居中幻灯片意味着需要将一张推离轴线。
精选预设: 四个幻灯片特定预设作为起点(午夜社论、温暖信号、终端单色、瑞士简洁),外加现有的 8 个美学方向适配为幻灯片。选择一个并坚持。预设 CSS 值请参见 slide-patterns.md。
现有提示上的 --slides 标志: 当用户向 /diff-review、/plan-review、/project-recap 或其他提示传递 --slides 时,代理使用提示的正常数据收集指令收集数据,然后将内容呈现为幻灯片而非可滚动页面。幻灯片版本以不同的结构和节奏讲述相同的故事——但覆盖范围相同。不要以幻灯片格式为借口来总结或跳过可滚动版本会包含的部分。
每个图表都是一个单独的自包含 .html 文件。除了 CDN 链接(字体、可选库)外,没有外部资源。结构:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>描述性标题</title>
<link href="https://fonts.googleapis.com/css2?family=...&display=swap" rel="stylesheet">
<style>
/* CSS 自定义属性、主题、布局、组件——全部内联 */
</style>
</head>
<body>
<!-- 语义化 HTML:部分、标题、列表、表格、内联 SVG -->
<!-- 静态纯 CSS 图表不需要脚本 -->
<!-- 可选:使用 Mermaid、Chart.js 或 anime.js 时的 <script> -->
</body>
</html>
通过 Vercel 即时分享视觉解释器页面。无需账户或身份验证。
用法:
bash {{skill_dir}}/scripts/share.sh <html-file>
示例:
bash {{skill_dir}}/scripts/share.sh ~/.agent/diagrams/my-diagram.html
# 输出:
# ✓ 分享成功!
# 实时 URL: https://skill-deploy-abc123.vercel.app
# 认领 URL: https://vercel.com/claim-deployment?code=...
工作原理:
index.html要求:
pi install npm:vercel-deploy)备注:
/share 命令模板请参见 ./commands/share.md。
交付前,验证:
min-width: 0。并排面板需要 overflow-wrap: break-word。切勿对 <li> 使用 display: flex 来显示标记字符——这会创建无法收缩的匿名 flex 项,导致包含许多内联 <code> 徽章的行溢出。对标记使用绝对定位。参见 ./references/css-patterns.md 中的“溢出保护”部分。.mermaid-wrap 容器必须具有缩放控件(+/-/重置/展开按钮)、Ctrl/Cmd+滚动缩放、点击拖动平移和点击展开(点击而不拖动会在新标签页中全尺寸打开图表)。展开按钮(⛶)提供相同的功能。完整模式(包括 openMermaidInNewTab() 函数)请参见 ./references/css-patterns.md。这些模式被明确禁止。它们标志着“AI 生成的模板”,并破坏了该技能生成独特、高质量图表的目的。根据此列表审查每个生成的页面。
禁止作为主要 --font-body 的字体:
要求: 从 ./references/libraries.md 中的字体配对中选择。每次生成都应使用与上一次不同的配对。
禁止的强调色:
#8b5cf6、#7c3aed、#a78bfa)——Tailwind 的默认紫色范围#06b6d4 → #d946ef → #f472b6)Generate self-contained HTML files for technical diagrams, visualizations, and data tables. Always open the result in the browser. Never fall back to ASCII art when this skill is loaded.
Proactive table rendering. When you're about to present tabular data as an ASCII box-drawing table in the terminal (comparisons, audits, feature matrices, status reports, any structured rows/columns), generate an HTML page instead. The threshold: if the table has 4+ rows or 3+ columns, it belongs in the browser. Don't wait for the user to ask — render it as HTML automatically and tell them the file path. You can still include a brief text summary in the chat, but the table itself should be the HTML page.
Detailed prompt templates in ./commands/. In Pi, these are slash commands (/diff-review). In Claude Code, namespaced (/visual-explainer:diff-review). In Codex, use /prompts:diff-review (if installed to ~/.codex/prompts/) or invoke $visual-explainer and describe the workflow.
| Command | What it does |
|---|---|
generate-web-diagram | Generate an HTML diagram for any topic |
generate-visual-plan | Generate a visual implementation plan for a feature |
generate-slides | Generate a magazine-quality slide deck |
diff-review | Visual diff review with architecture comparison and code review |
plan-review | Compare a plan against the codebase with risk assessment |
project-recap |
Before writing HTML, commit to a direction. Don't default to "dark theme with blue accents" every time.
Visual is always default. Even essays, blog posts, and articles get visual treatment — extract structure into cards, diagrams, grids, tables.
Prose patterns (lead paragraphs, pull quotes, callout boxes) are accent elements within visual pages, not a separate mode. Use them to highlight key points or provide breathing room, but the page structure remains visual.
For prose accents, see "Prose Page Elements" in ./references/css-patterns.md. For everything else, use the standard freeform approach with aesthetic directions below.
Who is looking? A developer understanding a system? A PM seeing the big picture? A team reviewing a proposal? This shapes information density and visual complexity.
What type of content? Architecture, flowchart, sequence, data flow, schema/ER, state machine, mind map, class diagram, C4 architecture, data table, timeline, dashboard, or prose-first page. Each has distinct layout needs and rendering approaches (see Diagram Types below).
What aesthetic? Pick one and commit. The constrained aesthetics (Blueprint, Editorial, Paper/ink) are safer — they have specific requirements that prevent generic output. The flexible ones (IDE-inspired) require more discipline.
Constrained aesthetics (prefer these):
websocket-implementation-plan.html for reference#faf7f5 background, terracotta/sage accents, informal feel)Flexible aesthetics (use with caution):
Explicitly forbidden:
Vary the choice each time. If the last diagram was dark and technical, make the next one light and editorial. The swap test: if you replaced your styling with a generic dark theme and nobody would notice the difference, you haven't designed anything.
Read the reference material before generating. Don't memorize it — read it each time to absorb the patterns.
./templates/architecture.html./templates/mermaid-flowchart.html./templates/data-table.html--slides flag is present or /generate-slides is invoked): read ./templates/slide-deck.html and ./references/slide-patterns.md./references/css-patterns.md and "Typography by Content Voice" in ./references/libraries.mdFor CSS/layout patterns and SVG connectors , read ./references/css-patterns.md.
For pages with 4+ sections (reviews, recaps, dashboards), also read ./references/responsive-nav.md for section navigation with sticky sidebar TOC on desktop and horizontal scrollable bar on mobile.
Choosing a rendering approach:
| Content type | Approach | Why |
|---|---|---|
| Architecture (text-heavy) | CSS Grid cards + flow arrows | Rich card content (descriptions, code, tool lists) needs CSS control |
| Architecture (topology-focused) | Mermaid | Visible connections between components need automatic edge routing |
| Flowchart / pipeline | Mermaid | Automatic node positioning and edge routing |
| Sequence diagram | Mermaid | Lifelines, messages, and activation boxes need automatic layout |
| Data flow | Mermaid with edge labels | Connections and data descriptions need automatic edge routing |
| ER / schema diagram | Mermaid | Relationship lines between many entities need auto-routing |
| State machine | Mermaid | State transitions with labeled edges need automatic layout |
Mermaid theming: Always use theme: 'base' with custom themeVariables so colors match your page palette. Use layout: 'elk' for complex graphs (requires the @mermaid-js/layout-elk package — see ./references/libraries.md for the CDN import). Override Mermaid's SVG classes with CSS for pixel-perfect control. See ./references/libraries.md for full theming guide.
Mermaid containers: Always center Mermaid diagrams with display: flex; justify-content: center;. Add zoom controls (+/−/reset/expand) to every .mermaid-wrap container. Include the click-to-expand JavaScript so clicking the diagram (or the ⛶ button) opens it full-size in a new tab.
⚠️ Never use bare<pre class="mermaid">. It renders but has no zoom/pan controls — diagrams become tiny and unusable. Always use the full diagram-shell pattern from templates/mermaid-flowchart.html: the HTML structure (.diagram-shell > .mermaid-wrap > .zoom-controls + .mermaid-viewport > .mermaid-canvas), the CSS, and the ~200-line JS module for zoom/pan/fit. Copy it wholesale.
Mermaid scaling: Diagrams with 10+ nodes render too small by default. For 10-12 nodes, increase fontSize in themeVariables to 18-20px and set INITIAL_ZOOM to 1.5-1.6. For 15+ elements, don't try to scale — use the hybrid pattern instead (simple Mermaid overview + CSS Grid cards). See "Architecture / System Diagrams" below.
Mermaid layout direction: Prefer flowchart TD (top-down) over flowchart LR (left-to-right) for complex diagrams. LR spreads horizontally and makes labels unreadable when there are many nodes. Use LR only for simple 3-4 node linear flows. See ./references/libraries.md "Layout Direction: TD vs LR".
Mermaid line breaks in flowchart labels: Use <br/> inside quoted labels. Never use escaped newlines like \n (Mermaid renders them as literal text in HTML output). Example: A["Copilot Backend<br/>/api + /api/voicebot"].
Mermaid CSS class collision constraint: Never define .node as a page-level CSS class. Mermaid.js uses .node internally on SVG <g> elements with transform: translate(x, y) for positioning. Page-level .node styles (hover transforms, box-shadows) leak into diagrams and break layout. Use the namespaced .ve-card class for card components instead. The only safe way to style Mermaid's .node is scoped under .mermaid (e.g., .mermaid .node rect).
AI-generated illustrations (optional). If surf-cli is available, you can generate images via Gemini and embed them in the page for creative, illustrative, explanatory, educational, or decorative purposes. Check availability with which surf. If available:
# Generate to a temp file (use --aspect-ratio for control)
surf gemini "descriptive prompt" --generate-image /tmp/ve-img.png --aspect-ratio 16:9
# Base64 encode for self-containment (macOS)
IMG=$(base64 -i /tmp/ve-img.png)
# Linux: IMG=$(base64 -w 0 /tmp/ve-img.png)
# Embed in HTML and clean up
# <img src="data:image/png;base64,${IMG}" alt="descriptive alt text">
rm /tmp/ve-img.png
See ./references/css-patterns.md for image container styles (hero banners, inline illustrations, captions).
When to use: Hero banners that establish the page's visual tone. Conceptual illustrations for abstract systems that Mermaid can't express (physical infrastructure, user journeys, mental models). Educational diagrams that benefit from artistic or photorealistic rendering. Decorative accents that reinforce the aesthetic.
When to skip: Anything Mermaid or CSS handles well. Generic decoration that doesn't convey meaning. Data-heavy pages where images would distract. Always degrade gracefully — if surf isn't available, skip images without erroring. The page should stand on its own with CSS and typography alone.
Prompt craft: Match the image to the page's palette and aesthetic direction. Specify the style (3D render, technical illustration, watercolor, isometric, flat vector, etc.) and mention dominant colors from your CSS variables. Use --aspect-ratio 16:9 for hero banners, --aspect-ratio 1:1 for inline illustrations. Keep prompts specific — "isometric illustration of a message queue with cyan nodes on dark navy background" beats "a diagram of a queue."
Apply these principles to every diagram:
Typography is the diagram. Pick a distinctive font pairing from the list in ./references/libraries.md. Every page should use a different pairing from recent generations.
Forbidden as--font-body: Inter, Roboto, Arial, Helvetica, system-ui alone. These are AI slop signals.
Good pairings (use these):
Load via <link> in <head>. Include a system font fallback in the font-family stack for offline resilience.
Color tells a story. Use CSS custom properties for the full palette. Define at minimum: --bg, --surface, --border, --text, --text-dim, and 3-5 accent colors. Each accent should have a full and a dim variant (for backgrounds). Name variables semantically when possible (--pipeline-step not --blue-3). Support both themes.
Forbidden accent colors: #8b5cf6 #7c3aed #a78bfa (indigo/violet), #d946ef (fuchsia), the cyan-magenta-pink combination. These are Tailwind defaults that signal zero design intent.
Good accent palettes (use these):
#c2410c, #65a30d) — warm, earthy#0891b2, #0369a1) — technical, precise#be123c, #881337) — editorial, refined#d97706, #059669) — data-focused#1e3a5f, #d4a73a) — premium, sophisticatedPut your primary aesthetic in :root and the alternate in the media query:
/* Light-first (editorial, paper/ink, blueprint): */
:root { /* light values */ }
@media (prefers-color-scheme: dark) { :root { /* dark values */ } }
/* Dark-first (neon, IDE-inspired, terminal): */
:root { /* dark values */ }
@media (prefers-color-scheme: light) { :root { /* light values */ } }
Surfaces whisper, they don't shout. Build depth through subtle lightness shifts (2-4% between levels), not dramatic color changes. Borders should be low-opacity rgba (rgba(255,255,255,0.08) in dark mode, rgba(0,0,0,0.08) in light) — visible when you look, invisible when you don't.
Backgrounds create atmosphere. Don't use flat solid colors for the page background. Subtle gradients, faint grid patterns via CSS, or gentle radial glows behind focal areas. The background should feel like a space, not a void.
Visual weight signals importance. Not every section deserves equal visual treatment. Executive summaries and key metrics should dominate the viewport on load (larger type, more padding, subtle accent-tinted background zone). Reference sections (file maps, dependency lists, decision logs) should be compact and stay out of the way. Use <details>/<summary> for sections that are useful but not primary — the collapsible pattern is in ./references/css-patterns.md.
Surface depth creates hierarchy. Vary card depth to signal what matters. Hero sections get elevated shadows and accent-tinted backgrounds (ve-card--hero pattern). Body content stays flat (default .ve-card). Code blocks and secondary content feel recessed (ve-card--recessed). See the depth tiers in ./references/css-patterns.md. Don't make everything elevated — when everything pops, nothing does.
Animation earns its place. Staggered fade-ins on page load are almost always worth it — they guide the eye through the diagram's hierarchy. Mix animation types by role: fadeUp for cards, fadeScale for KPIs and badges, drawIn for SVG connectors, countUp for hero numbers. Hover transitions on interactive-feeling elements make the diagram feel alive. Always respect prefers-reduced-motion. CSS transitions and keyframes handle most cases. For orchestrated multi-element sequences, anime.js via CDN is available (see ./references/libraries.md).
Forbidden animations:
@keyframes glow { box-shadow: 0 0 20px... }) — this is AI slopKeep animations purposeful: entrance reveals, hover feedback, and user-initiated interactions. Nothing should glow or pulse on its own.
Output location: Write to ~/.agent/diagrams/. Use a descriptive filename based on content: modem-architecture.html, pipeline-flow.html, schema-overview.html. The directory persists across sessions.
Open in browser:
open ~/.agent/diagrams/filename.htmlxdg-open ~/.agent/diagrams/filename.htmlTell the user the file path so they can re-open or share it.
Three approaches depending on complexity:
Simple topology (under 10 elements): Use Mermaid. A graph TD with custom themeVariables produces readable diagrams with automatic edge routing.
Text-heavy overviews (under 15 elements): CSS Grid with explicit row/column placement. Sections as rounded cards with colored borders and monospace labels. Vertical flow arrows between sections. The reference template at ./templates/architecture.html demonstrates this pattern. Use when cards need descriptions, code references, tool lists, or other rich content that Mermaid nodes can't hold.
Complex architectures (15+ elements): Use the hybrid pattern — a simple Mermaid overview (5-8 nodes showing module relationships) followed by detailed CSS Grid cards for each module's internals. This gives you visual topology AND readable details. The overview diagram uses module names with <small> tags for key function names. The cards below show full function lists with new/modified badges. Never try to cram 15+ elements into a single Mermaid diagram — it will render unreadably small even with zoom controls.
Use Mermaid. Automatic node positioning and edge routing produces proper diagrams with connecting lines, decision diamonds, and parallel branches — dramatically better than CSS flexbox with arrow characters. Prefer graph TD (top-down); use graph LR only for simple 3-4 node linear flows. Color-code node types with Mermaid's classDef or rely on themeVariables for automatic styling.
Use Mermaid. Lifelines, messages, activation boxes, notes, and loops all need automatic layout. Use Mermaid's sequenceDiagram syntax. Style actors and messages via CSS overrides on .actor, .messageText, .activation classes.
Use Mermaid. Data flow diagrams emphasize connections over boxes — exactly what Mermaid excels at. Use graph TD (or graph LR for simple linear flows) with edge labels for data descriptions. Thicker, colored edges for primary flows. Source/sink nodes styled differently from transform nodes via Mermaid's classDef.
Use Mermaid. Relationship lines between entities need automatic routing. Use Mermaid's erDiagram syntax with entity attributes. Style via themeVariables and CSS overrides on .er.entityBox and .er.relationshipLine.
Use Mermaid. Use stateDiagram-v2 for states with labeled transitions. Supports nested states, forks, joins, and notes. Decision trees can use graph TD with diamond decision nodes.
stateDiagram-v2 label caveat: Transition labels have a strict parser — colons, parentheses, <br/>, HTML entities, and most special characters cause silent parse failures ("Syntax error in text"). If your labels need any of these (e.g., cancel(), curate: true, multi-line labels), use flowchart TD instead with rounded nodes and quoted edge labels (|"label text"|). Flowcharts handle all special characters and support <br/> for line breaks. Reserve stateDiagram-v2 for simple single-word or plain-text labels.
Use Mermaid. Use mindmap syntax for hierarchical branching from a root node. Mermaid handles the radial layout automatically. Style with themeVariables to control node colors at each depth level.
Use Mermaid. Use classDiagram syntax for domain modeling, OOP design, and entity relationships with typed properties and methods. Supports relationships: association (-->), composition (*--), aggregation (o--), and inheritance (<|--). Add multiplicity labels (e.g., "1" --> "*") and abstract/interface markers (<<interface>>, <<abstract>>). For simple entity boxes without OOP semantics (no methods, no inheritance), prefer erDiagram instead — it produces cleaner output for pure data modeling.
Use Mermaid flowchart syntax — NOT native C4. Use graph TD with subgraph blocks for C4 boundaries. Native C4Context hardcodes sharp corners, its own font, blue icons, and inline SVG colors that ignore themeVariables — it always clashes with custom palettes.
Flowchart-as-C4 pattern: Persons → rounded nodes (("Name")), systems → rectangles ["Name"], databases → cylinders [("Name")], boundaries → subgraph blocks, relationships → labeled arrows -->|"protocol"|. Use classDef + :::className to visually differentiate external systems (e.g., dashed borders). This inherits themeVariables, fontFamily, and CSS overrides like every other Mermaid diagram.
Use a real <table> element — not CSS Grid pretending to be a table. Tables get accessibility, copy-paste behavior, and column alignment for free. The reference template at ./templates/data-table.html demonstrates all patterns below.
Use proactively. Any time you'd render an ASCII box-drawing table in the terminal, generate an HTML table instead. This includes: requirement audits (request vs plan), feature comparisons, status reports, configuration matrices, test result summaries, dependency lists, permission tables, API endpoint inventories — any structured rows and columns.
Layout patterns:
<thead> so headers stay visible when scrolling long tablestr:nth-child(even) (subtle, 2-3% lightness shift)overflow-x: auto for tables wider than the viewport<colgroup> or th widths — let text-heavy columns breatheStatus indicators (use styled <span> elements, never emoji):
Cell content:
<code> for technical references within cells<small> with dimmed colortabular-numsVertical or horizontal timeline with a central line (CSS pseudo-element). Phase markers as circles on the line. Content cards branching left/right (alternating) or all to one side. Date labels on the line. Color progression from past (muted) to future (vivid).
Card grid layout. Hero numbers large and prominent. Sparklines via inline SVG <polyline>. Progress bars via CSS linear-gradient on a div. For real charts (bar, line, pie), use Chart.js via CDN (see ./references/libraries.md). KPI cards with trend indicators (up/down arrows, percentage deltas).
For visualizing implementation plans, extension designs, or feature specifications. The goal is understanding the approach , not reading the full source code.
Don't dump full files. Displaying entire source files inline overwhelms the page and defeats the purpose of a visual explanation. Instead:
Code blocks require explicit formatting. Without white-space: pre-wrap, code runs together into an unreadable wall. See the "Code Blocks" section in ./references/css-patterns.md for the correct pattern.
Structure for implementation plans:
When visualizing documentation, extract structure into visual elements:
| Content | Visual Treatment |
|---|---|
| Features | Card grid (2-3 columns) |
| Install/setup steps | Numbered cards or vertical flow |
| API endpoints/commands | Table with sticky header |
| Config options | Table |
| Architecture | Mermaid diagram or CSS card layout |
| Comparisons | Side-by-side panels or table |
| Warnings/notes | Callout boxes |
Don't just format the prose — transform it. A feature list becomes a card grid. Install steps become a numbered flow. An API reference becomes a table.
Use these sparingly within visual pages to highlight key points or provide breathing room. See "Prose Page Elements" in ./references/css-patterns.md for CSS patterns.
When to use: A visual page explaining an essay might use a lead paragraph for the thesis, then cards for key arguments. A README visualization might use callout boxes for warnings but otherwise stay card/table-focused.
An alternative output format for presenting content as a magazine-quality slide presentation instead of a scrollable page. Opt-in only — the agent generates slides when the user invokes /generate-slides, passes --slides to an existing prompt (e.g., /diff-review --slides), or explicitly asks for a slide deck. Never auto-select slide format.
Before generating slides , read ./references/slide-patterns.md (engine CSS, slide types, transitions, nav chrome, presets) and ./templates/slide-deck.html (reference template showing all 10 types). Also read ./references/css-patterns.md for shared patterns and ./references/libraries.md for Mermaid/Chart.js theming.
Slides are not pages reformatted. They're a different medium. Each slide is exactly one viewport tall (100dvh) with no scrolling. Typography is 2–3× larger. Compositions are bolder. The agent composes a narrative arc (impact → context → deep dive → resolution) rather than mechanically paginating the source.
Content completeness. Changing the medium does not mean dropping content. Follow the "Planning a Deck from a Source Document" process in slide-patterns.md before writing any HTML: inventory the source, map every item to slides, verify coverage. Every section, decision, data point, specification, and collapsible detail from the source must appear in the deck. If a plan has 7 sections, the deck covers all 7. If there are 6 decisions, present all 6 — not the 2 that fit on one slide. Collapsible details in the source become their own slides. Add more slides rather than cutting content. A 22-slide deck that covers everything beats a 13-slide deck that looks polished but is missing 40% of the source.
Slide types (10): Title, Section Divider, Content, Split, Diagram, Dashboard, Table, Code, Quote, Full-Bleed. Each has a defined layout in slide-patterns.md. Content that exceeds a slide's density limit splits across multiple slides — never scrolls within a slide.
Visual richness: Check which surf at the start. If surf-cli is available, generate 2–4 images (title slide background, full-bleed background, optional content illustrations) before writing HTML — see the Proactive Imagery section in slide-patterns.md for the workflow. Also use SVG decorative accents, per-slide background gradients, inline sparklines, and small Mermaid diagrams. Visual-first, text-second.
Compositional variety: Consecutive slides must vary spatial approach — centered, left-heavy, right-heavy, split, edge-aligned, full-bleed. Three centered slides in a row means push one off-axis.
Curated presets: Four slide-specific presets as starting points (Midnight Editorial, Warm Signal, Terminal Mono, Swiss Clean) plus the existing 8 aesthetic directions adapted for slides. Pick one and commit. See slide-patterns.md for preset CSS values.
--slides flag on existing prompts: When a user passes --slides to /diff-review, /plan-review, /project-recap, or other prompts, the agent gathers data using the prompt's normal data-gathering instructions, then presents the content as a slide deck instead of a scrollable page. The slide version tells the same story with different structure and pacing — but the same breadth of coverage. Don't use the slide format as an excuse to summarize or skip sections that the scrollable version would have included.
Every diagram is a single self-contained .html file. No external assets except CDN links (fonts, optional libraries). Structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Descriptive Title</title>
<link href="https://fonts.googleapis.com/css2?family=...&display=swap" rel="stylesheet">
<style>
/* CSS custom properties, theme, layout, components — all inline */
</style>
</head>
<body>
<!-- Semantic HTML: sections, headings, lists, tables, inline SVG -->
<!-- No script needed for static CSS-only diagrams -->
<!-- Optional: <script> for Mermaid, Chart.js, or anime.js when used -->
</body>
</html>
Share visual explainer pages instantly via Vercel. No account or authentication required.
Usage:
bash {{skill_dir}}/scripts/share.sh <html-file>
Example:
bash {{skill_dir}}/scripts/share.sh ~/.agent/diagrams/my-diagram.html
# Output:
# ✓ Shared successfully!
# Live URL: https://skill-deploy-abc123.vercel.app
# Claim URL: https://vercel.com/claim-deployment?code=...
How it works:
index.htmlRequirements:
pi install npm:vercel-deploy)Notes:
See ./commands/share.md for the /share command template.
Before delivering, verify:
min-width: 0. Side-by-side panels need overflow-wrap: break-word. Never use display: flex on <li> for marker characters — it creates anonymous flex items that can't shrink, causing lines with many inline <code> badges to overflow. Use absolute positioning for markers instead. See the Overflow Protection section in ./references/css-patterns.md.These patterns are explicitly forbidden. They signal "AI-generated template" and undermine the skill's purpose of producing distinctive, high-quality diagrams. Review every generated page against this list.
Forbidden fonts as primary--font-body:
Required: Pick from the font pairings in ./references/libraries.md. Every generation should use a different pairing from the last.
Forbidden accent colors:
#8b5cf6, #7c3aed, #a78bfa) — Tailwind's default purple range#06b6d4 → #d946ef → #f472b6)Forbidden color effects:
background: linear-gradient(...); background-clip: text;) — this screams AI-generatedbox-shadow: 0 0 20px var(--glow); animation: glow 2s...)Required: Build palettes from the reference templates (terracotta/sage, teal/cyan, rose/cranberry, slate/blue) or derive from real IDE themes (Dracula, Nord, Solarized, Gruvbox, Catppuccin). Accents should feel intentional, not default.
Forbidden:
Required: Use styled monospace labels with colored dot indicators (see .section-label in templates), numbered badges (section__num pattern), or asymmetric section dividers. If an icon is genuinely needed, use an inline SVG that matches the palette — not emoji.
Forbidden:
Required: Vary visual weight. Hero sections should dominate (larger type, more padding, accent-tinted background). Reference sections should feel compact. Use the depth tiers (hero → elevated → default → recessed). Asymmetric layouts create interest.
Forbidden:
Required: Code blocks use a simple header with filename or language label. KPI cards vary by importance — hero numbers for the primary metric, subdued treatment for supporting metrics. Pick aesthetics with natural constraints: Blueprint (must feel technical/precise), Editorial (must have generous whitespace and serif typography), Paper/ink (must feel warm and informal).
Before delivering, apply this test: Would a developer looking at this page immediately think "AI generated this"? The telltale signs:
background-clip: text gradientIf two or more of these are present, the page is slop. Regenerate with a different aesthetic direction — Editorial, Blueprint, Paper/ink, or a specific IDE theme. These constrained aesthetics are harder to mess up because they have specific visual requirements that prevent defaulting to generic patterns.
Weekly Installs
162
Repository
GitHub Stars
6.9K
First Seen
Feb 16, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex153
opencode149
gemini-cli147
cursor147
github-copilot147
amp146
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
118,000 周安装
| Mental model snapshot for context-switching back to a project |
fact-check | Verify accuracy of a document against actual code |
share | Deploy an HTML page to Vercel and get a live URL |
| Mind map | Mermaid | Hierarchical branching needs automatic positioning |
| Class diagram | Mermaid | Inheritance, composition, aggregation lines with automatic routing |
| C4 architecture | Mermaid | Use graph TD + subgraph for C4 (not native C4Context — it ignores themes) |
| Data table | HTML <table> | Semantic markup, accessibility, copy-paste behavior |
| Timeline | CSS (central line + cards) | Simple linear layout doesn't need a layout engine |
| Dashboard | CSS Grid + Chart.js | Card grid with embedded charts |
.mermaid-wrap./references/css-patterns.mdopenMermaidInNewTab()