/visual-brainstorming:visual-brainstormingfrom visual-brainstorming
Visualizes code/document structure as architecture/flow diagrams (explore mode) or presents 2-4 design options for side-by-side comparison (decision mode). Outputs self-contained HTML locally.
Ships in visual-brainstorming. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
把适合“看”的东西可视化:要么帮你看懂一个项目的真实结构,要么帮你在几个候选方案里点选一个。需求澄清、理由和最终结论留在对话或项目文档中。
硬边界: 页面是 Agent 生成的 HTML/CSS/SVG 外部产物,不是模型隐藏思维、Token 轨迹、注意力权重或内部状态。
概念参考 obra/superpowers 的 Visual Companion / Visual Brainstorming;本 Skill 为独立实现。出处见 NOTICE.md 与 references/SOURCES.md。
两种模式共用同一个本地 companion、同一套会话目录和浏览器交互,但目标和触发条件不同。
| 理解模式(explore) | 决策模式(compare) | |
|---|---|---|
| 用户要什么 | 帮我看懂这个项目/系统 | 帮我在几个方案里选一个 |
| 典型触发 | “梳理这个项目”“架构图”“调用关系”“这个项目怎么跑的”“画个图帮我理解” | “帮我选”“哪个方案好”“对比一下这几个设计” |
| 输入 | 已有代码 + 文档(结构未知) | 2–4 个已想清的候选方案 |
| 默认产物 | 单文件 HTML 写到 local/,默认不开浏览器 | 本地浏览器并排点选 |
| 是否需要提炼 | 必须先提炼(EXTRACTION.md) | 不需要 |
判断顺序:
理解模式专属规则:
先提炼,后画图。 生成任何 HTML 之前,必须先按 references/EXTRACTION.md 产出 extraction.json,把 entities / edges / claims / paths 核对清楚,尤其要区分“文档声称(claimed)”“代码坐实(verified)”“存在冲突(contradicted)”。不允许凭印象直接画图。
默认不开浏览器。 提炼后用 export 把片段烘成自包含单文件 HTML 写到 local/(如 local/<project>-architecture.html),同时用 --extraction 把提炼 JSON 持久化到运行根的 exports/<id>/;产物内联了 frame CSS 和 explore helper,双击即可离线看。只有用户明确说“在浏览器里给我看”时,才走 companion.py show 打开本地页。
python3 -I -S "$SKILL_DIR/scripts/companion.py" export \
--source /tmp/arch.html \
--output "$PROJECT_ROOT/local/<project>-architecture.html" \
--project-dir "$PROJECT_ROOT" \
--extraction /tmp/extraction.json
提炼遇到真实架构分叉时,(例如“代码是单体,文档却说是三层”),把分叉整理成 2–3 个候选,转入决策模式让用户点选——这是两种模式的串联点。
渲染用 assets/templates/explore-map.html,节点用 data-node/data-flows/data-evidence 标注;交互由 assets/explore-helper.js 驱动(路径筛选、节点详情、证据边框、疑惑上报)。
下面第 1–6 节描述决策模式的完整流程。
127.0.0.1;正常工作流不得添加 --allow-remote。--url-host 必须是 Agent 主机实际持有的 literal loopback/private/link-local IP;不要把服务暴露到公网、不受信任局域网或另一台内网主机。正常执行只读取:
assets/templates/choice-grid.html 等,理解模式用 assets/templates/explore-map.html。不要默认读取 README.md、实现脚本、全部示例或全部参考资料。理解模式画图前必须先读 references/EXTRACTION.md;只有定制视觉时读 references/VISUAL_AUTHORING.md;运行失败时读 references/TROUBLESHOOTING.md。
仅在以下三个条件全部成立时使用:
不要用于:普通文字澄清、Markdown 表格足够的参数比较、代码或日志轨迹、只需一张简单图、没有明确待决策变量、隐藏推理请求,或用户已拒绝本次浏览器展示。
单张简单图优先使用 Mermaid、ASCII 或聊天内静态图。
这一项更适合并排看图。我可以打开一个仅本机可访问的页面,展示方案并记录你的点击;也可以继续只用聊天。是否启用?
用户拒绝后继续在聊天中完成,不再次推销。
SKILL_DIR:本 SKILL.md 所在目录;不要假设它等于插件根目录。PROJECT_ROOT:优先使用宿主或用户给定的项目根目录;否则使用 Git 根目录;再否则使用当前可写目录。会话数据写入 PROJECT_ROOT/.visual-brainstorming/;运行时会在其中自动写入 deny-all .gitignore。
写清:
默认给 2–3 个方案;只有第四个方案具有独立逻辑时才增加到 4 个。
按任务选择:
assets/templates/choice-grid.htmlassets/templates/ui-compare.htmlassets/templates/architecture-compare.htmlassets/templates/process-compare.html生成 UTF-8 HTML 片段,默认使用内置 CSS 类,不写自定义 JavaScript。每个可选元素必须包含:
<article data-choice="stable-id" data-label="方案名称">…</article>
页面要求:
把片段写到一个可写的临时文件,然后只运行一条命令:
python3 -I -S "$SKILL_DIR/scripts/companion.py" show \
--project-dir "$PROJECT_ROOT" \
--source "/absolute/path/to/draft.html" \
--name "decision-name" \
--open
show 会复用或启动服务、原子发布页面,并在发布完成后请求打开浏览器。不要再额外执行 start 和 status,除非排查故障。
首次 URL 的 fragment 含随机会话密钥;应使用 show 返回的完整 URL,不要公开到外网。页面加载后会把密钥保存在当前 origin/tab 的 sessionStorage 并清理地址栏;Cookie 不作为会话凭据。
发布后只说明:
然后结束当前轮次,不继续堆叠新问题。
读取最近事件:
python3 -I -S "$SKILL_DIR/scripts/companion.py" events \
--project-dir "$PROJECT_ROOT" --tail 20
处理规则:
choice,并同时考虑其后的 note;视觉探索结束后,把确认方向、放弃方案、理由和未验证假设写回项目设计文档或实现计划,然后停止服务:
python3 -I -S "$SKILL_DIR/scripts/companion.py" stop \
--project-dir "$PROJECT_ROOT"
本地 URL 不可达时,不声称页面已打开。保留 HTML,并改用静态图、Mermaid、ASCII 或结构化文字继续,不让浏览器能力阻塞任务。
建议项目忽略:
.visual-brainstorming/
历史 session 会保留用于审计。只有用户要求清理时才先运行 dry-run:
python3 -I -S "$SKILL_DIR/scripts/companion.py" prune \
--project-dir "$PROJECT_ROOT"
dry-run 会返回绑定精确候选列表的 plan。检查列表后,只有用户明确同意这些候选时,才用相同参数执行 --apply --plan "<dry-run-plan>";若 plan 失效则重新预览,不得绕过。不得清理当前或仍在运行的 session。
references/VISUAL_AUTHORING.mdreferences/WORKFLOW.md、references/PROTOCOL.mdreferences/TROUBLESHOOTING.mdreferences/ADAPTATION.mdreferences/BACKGROUND.md、references/EVALUATION.md、references/LEARNING_GUIDE.md、NOTICE.mdLICENSE.txt (opens in a new tab)NOTICE.md (opens in a new tab)README.md (opens in a new tab)agents/openai.yaml (opens in a new tab)assets/browser-shell.css (opens in a new tab)assets/browser-shell.html (opens in a new tab)assets/browser-shell.js (opens in a new tab)assets/explore-helper.css (opens in a new tab)assets/explore-helper.js (opens in a new tab)assets/frame.css (opens in a new tab)assets/icon.svg (opens in a new tab)assets/injected-helper.css (opens in a new tab)assets/injected-helper.js (opens in a new tab)assets/templates/architecture-compare.html (opens in a new tab)assets/templates/choice-grid.html (opens in a new tab)assets/templates/demo.html (opens in a new tab)assets/templates/explore-map.html (opens in a new tab)assets/templates/process-compare.html (opens in a new tab)assets/templates/ui-compare.html (opens in a new tab)examples/01-product-layout.html (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub blueskyxn/codex-is-all-you-need --plugin visual-brainstormingOther plugins' skills for the same job