跳到正文
Skillpedia
通用编程8.0k · #12702

review-walkthrough

它能做什么

该技能生成一个浏览器页面,解释你当前分支上的改动,并按易于理解的步骤分组。适用于希望带着上下文和说明来审查改动的开发者。

适用场景

  • ✓在批准或合并一个大型分支之前,你希望先理解它的时候。
  • ✓你需要为刚接触代码的队友提供改动的引导式讲解的时候。
  • ✓你希望把审查发现显示在它所指代码旁边的时候。

技能链接

https://github.com/trailofbits/skills/blob/main/plugins/review-walkthrough/skills/review-walkthrough/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/trailofbits/skills/blob/main/plugins/review-walkthrough/skills/review-walkthrough/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“你能为我的分支做一个交互式的讲解吗?我可以一步步审查。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体捕获你的分支与其基础分支之间的差异,按合理的顺序对改动分组,并写出一个包含解释和发现的 HTML 文件。你在浏览器中打开该文件即可。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Review Walkthrough

Generate a self-contained HTML walkthrough of the current branch, with the final diff split into logical steps, explanations, and critical review findings. Choose the grouping and reading order for comprehension; commit order need not dictate either. Invoke as /review-walkthrough:review-walkthrough in Claude Code or $review-walkthrough in Codex.

Capture the branch diff

Respect a user-specified base. Otherwise, use the current open PR's base when PR metadata is available. Without a PR, discover the repository's default branch from git symbolic-ref --quiet --short refs/remotes/origin/HEAD or the configured remote's equivalent. Do not assume it is main. If the selected base is missing or ambiguous, ask for it rather than silently choosing another branch.

Resolve the base and HEAD to commit IDs with git rev-parse --verify --end-of-options "${ref}^{commit}", then compute their merge base with git merge-base. Capture the complete patch using git diff --no-ext-diff --no-textconv --no-color --src-prefix=a/ --dst-prefix=b/ "$merge_base" "$head_sha" --. Initialize variables and run the commands that consume them in the same shell invocation; shell variables do not persist between tool calls. Save the patch to a temporary file outside the checkout and retain its actual path. Stop on a Git error or an empty patch and explain the result.

This scope includes committed changes through the captured HEAD. Mention any uncommitted work that is excluded. Do not change branches, reset the checkout, or alter source files to prepare the review. Keep generated data and HTML outside the checkout unless the user requests a particular output location; generated review artifacts never belong in the captured patch.

For a GitHub PR, collect owner, repo, pr_number, and head_sha from its metadata. Include them only when the PR head matches the captured HEAD and the chosen base matches the PR base. Otherwise use null and explain why comment export is unavailable. A failed authentication or network request is not evidence that no PR exists; report the failure and ask for the base if it cannot be determined. GitHub access is optional when the user supplies the base or confirms there is no PR.

Shape the review

Read the changed files and the surrounding source, tests, configuration, and dependency metadata needed to judge them. Keep the review read-only; do not run the project's tests or install its dependencies merely to build the walkthrough.

Group related files into steps covering one concept each. Put definitions before their consumers, wiring after the components it connects, and tests after or beside their subjects. Copy each complete per-file diff from the captured patch verbatim into exactly one step. Reordering files between steps is allowed; splitting, rewriting, omitting, or inventing their patches is not. Preserve rename, binary, and mode-change entries even when they have no text hunks. Binary summaries identify changed files; their payloads are outside this review.

Write one explanation per step, usually 50–150 words, covering the change's purpose, design choices, trade-offs, and connections to other steps. Refer to actual identifiers. Write one review list per step covering bugs, security, validation, API design, or performance issues supported by the code. Report findings with severity rather than suppressing minor issues. Use an empty list for a step with no findings.

Explanations and review bodies are HTML fragments. Use <p>, <strong>, <em>, <code>, <pre>, and <ul>/<li> for structure. Write literal < and > in prose or snippets as &lt; and &gt;. Backticks and Markdown fences are literal text here. Supported inline tags also include <sup>, <sub>, <kbd>, <del>, and <a href="https://…">. The page sanitizes fragments and converts them to Markdown when preparing a PR comment. Only safe link targets survive; arbitrary attributes, scripts, and images do not. Tables export as text rows with cell separators; captions and row order are preserved. Prefer prose, lists, and code blocks when their structure is sufficient.

Anchor findings to a file in the same step and a line in that file's displayed diff. Use side: "RIGHT" for additions or new-file context and side: "LEFT" for deletions or old-file context. For a range, line and end_line use that same side within one hunk. A finding spanning multiple steps belongs with the file it addresses, o

常见问题

它只在我要求时运行吗?

是的。该技能只应在你直接调用时使用。

如果基础分支不明确怎么办?

智能体会询问你应使用哪个基础分支,而不会猜测其他分支。

页面会修改我的代码吗?

不会。它读取分支,并另外生成一个页面。

详情

作者的原始描述

Generates an interactive HTML walkthrough for reviewing code changes. Use only when explicitly called.

repo: trailofbits/skills

热度

GitHub 星标
8.0k
排名
#12702
许可证
CC-BY-SA-4.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能