/goal-workflow-skills:understandfrom goal-workflow-skills
Builds an interactive review webpage for uncommitted AI-generated code changes, showing a file tree, syntax-highlighted diffs, and per-segment requirement annotations and plain-language explanations.
Ships in goal-workflow-skills. 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.
把「本次(AI)新生成的代码变更」变成一个可交互的审阅网页:左侧按真实项目布局列出变更文件树,右侧显示所选文件的 diff(高亮、增删与未变更代码明显区分),并在右侧边栏逐段给出相关单位需求与代码解释;解释下方可按需提供「伪代码」「调用树」两个展开式文本视图(参考 show-me skill 的呈现方式)。
始终用中文产出解释与需求。
/understand、"review 这次改动"、"解释下新写的代码"、"看看这次变更做了啥"。skill 目录下三件套(都在 ~/.claude/skills/understand/):
understand.py — 纯标准库生成器,两个子命令:scan(解析 git diff → data.json + annotations.json 骨架)、render(合并注释 → report.html)。template.html — Claude light 主题两栏页面(占位符 __UNDERSTAND_PAYLOAD__ 注入数据),Prism.js 走 CDN 做语法高亮。在**用户当前工作目录(仓库内)**执行以下步骤。全程把 SKILL_DIR 当作本 skill 目录的绝对路径(即本文件所在目录)。
python3 "$SKILL_DIR/understand.py" scan
--base <ref>(例如只看最后一次提交用 --base HEAD~1)。.understand/(相对 CWD)。可用 --out <dir> 改。data.json / annotations.json 路径、以及 paths(变更文件列表)。读这个输出了解改了哪些文件。先把改动读懂,再落注释。建议:
Read 每个变更文件(结合 data.json 里的 hunks 看具体增删行号),必要时读周边未改代码补足上下文。docs/ 需求文档、代码注释里写的需求编号/背景、相关 issue。找到真实需求就照写;确实找不到,就基于代码逻辑写「推测意图」并在注释里把 inferred 置为 true(前端会标成灰色「推测意图」而非「需求」,避免把猜测伪装成事实)。然后编辑 .understand/annotations.json(scan 已生成骨架,保留其 files[].path 顺序,逐个填充)。结构:
{
"title": "本次变更的一句话主题",
"summary": "整体在做什么、为什么(2~4 句,可用 **加粗** 与 `代码`)",
"files": [
{
"path": "src/main/java/.../PwaTierInvitationService.java",
"summary": "这个文件这次改了什么、为何改(1~3 句)",
"annotations": [
{
"side": "new",
"start": 52,
"end": 53,
"requirement": "expires_at 为 timestamptz,需正确编码",
"explanation": "Vert.x PG 客户端不支持 `java.time.Instant`,改绑 `OffsetDateTime`(`atOffset(UTC)`),否则运行期报 coercion 错误。",
"pseudocode": "on(save)\n if content is unchanged\n return cached result\n write new content\n return fresh result",
"callTree": "submitForm\n createSession\n persistPrompt\n launchAgent\n navigateToSession",
"inferred": false
}
]
}
]
}
注释字段:
side — "new" 锚定新版本行号(增行/上下文),"old" 锚定旧版本行号(删行)。绝大多数解释用 "new"。start / end — 该段代码的行号区间(data.json 里对应 side 的 newNo/oldNo;单行时 end 可省或等于 start)。行号是文件真实行号,不是 diff 里的序号。requirement — 该段对应的单位需求(简短一句,作为标签展示)。可留空。explanation — 代码解释:讲清这段在干嘛、为什么这么写、有何风险/前提。可用 `code` 和 **bold**。pseudocode / callTree — 可选的两种补充视图(参考 show-me skill),给了字段,该卡片解释下方才会出现「伪代码」「调用树」按钮,点击展开文本面板:
pseudocode — 把这段的逻辑/算法写成语言无关的伪代码:两空格缩进表结构与分支,只保留关键判断、边界与数据流向,不照抄源码(不写变量声明、类型等噪音)。callTree — 这段代码运行期的控制流调用树:根节点是本段入口,两空格缩进表调用层级,只列真正会执行到的调用(必要处可带一句 # 注释 说明分支条件),不列未走过的分支。inferred — 需求为推测时置 true。注释密度:聚焦关键/易错/体现需求的段落(新增的核心逻辑、边界处理、并发/事务、类型坑、SQL 口径等),不必逐行;每个重要文件给 1~5 条即可。可参考项目记忆里的常见坑(如 Vert.x Future.await()、PG = ANY 数值数组、timestamptz 编码)来判断哪些点值得解释。
python3 "$SKILL_DIR/understand.py" render
open .understand/report.html # macOS;Linux 用 xdg-open
render 会把 data.json + annotations.json 合并注入模板,产出 .understand/report.html(单文件,纯前端,Prism 走 CDN)。用浏览器打开即可:左树选文件 → 右侧看 diff → 边栏卡片点「定位 →」跳到对应代码行(会高亮闪一下);若注释写了 pseudocode/callTree,卡片解释下方会出现「伪代码」「调用树」按钮,点击展开/收起(同卡片内两个视图互斥)。左侧文件树栏可拖动分隔条调整宽度(宽度记忆在 localStorage,双击分隔条恢复默认)。
最后用中文向用户简述:改了几个文件、核心变更是什么、有哪些值得注意的点,并给出 report.html 路径。
.understand/ 是产物目录,建议提醒用户按需 git clean 或加 .gitignore,别误提交。data.json 为空(无变更),如实告知用户没有检测到改动,不要硬造。data.json:annotations.json 里的 start/end 用文件真实行号,side 决定用新/旧行号系。填错会导致边栏卡片锚不到代码行(不报错,但点「定位」无反应)。.understand/ 下的产物。What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
code-review, diff-viewer, ai-code-review, change-explanation
npx claudepluginhub smallnest/goal-workflow --plugin goal-workflow-skills22 skills in this plugin
/article-iconsIllustrate an article (Markdown, HTML, etc.) with animated-style icons from itshover.com/icons. Fetches icons as clean inline SVG and places them at section headings, key concepts, lists, and callouts. Triggers on: /article-icons, 配图, 给文章配图标, add icons to article, illustrate with icons./code-to-specReverse-engineer a SPEC document from an existing project. Analyzes code, config, tests, and structure to produce a comprehensive specification. Triggers on: code-to-spec, reverse spec, generate spec, 逆向规格, 生成规格文档, 生成设计文档, 生成设计方案, extract spec, document this project, what does this project do./debug-itDisciplined bug diagnosis, performance regression forensics, and root-cause fixing: build a tight red-capable feedback loop -> minimise -> rank 3-5 falsifiable hypotheses -> instrument -> attack failed premises -> fix root causes -> lock down with regression test and proof. Triggers on: /debug-it, debug this, diagnose bug, root cause, perf regression, 排查 bug, 根因定位, 诊断问题, 性能退化排查./design-itUse when turning a requirement, spec, or feature brief into a single self-contained HTML design document in a fixed house style — one styled HTML page with a table-of-contents, architecture/sequence SVG diagrams, code/SQL/YAML blocks, callout boxes, an aligned-decisions (已对齐结论) panel, test cases, and a code index. Reuse for any new 需求/设计文档 that should look identical every time./graphGraph engineering for parallel task execution: convert a task, PRD, SPEC, or issue set into a dependency graph (DAG), layer it into supersteps, then implement each independent node concurrently with subagents — each node runs /goal → /review-it → /ship-it in an isolated git worktree, with a fan-in barrier between waves. Triggers on: graph, graph engineering, build a graph, task graph, dependency graph, DAG, parallel implement, 并发实现, 并行实现, 任务图, 把任务变成图, fan-out fan-in, superstep, dynamic workflow./humanize-it对指定文档进行去 AI 味的改写。自动选择最合适的人性化策略(humanizer-zh / humanize-chinese / technical-writing), 迭代改写直到效果达标或迭代 42 次为止。适用于中文文本的去 AI 化处理,包括通用文章、技术文档、学术论文等。 Use when user says: "humanize this", "去AI味", "降AIGC", "人性化改写", "改成人话", "去除AI痕迹", "humanize document", "make text human-like", "去机器味", "降低AI率", "过AIGC检测"
Other plugins' skills for the same job