pr-explainer
它能做什么
这项技能生成一个本地网页,用平实的语言解释拉取请求。它涵盖改动了什么、为什么重要、如何运作以及如何测试,而不会直接倾倒完整的差异内容。
适用场景
- ✓当你希望审阅者快速理解一个复杂的拉取请求时。
- ✓当一个大型代码改动需要有指引的解释,而不是原始差异时。
- ✓当你希望在一个地方说明问题、改动和验证结果时。
技能链接
https://github.com/mastra-ai/mastra/blob/main/.claude/skills/pr-explainer/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为这个拉取请求做一份 HTML 审阅指南,让我的审阅者在十分钟内就能理解这次改动。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会读取分支、提交和改动的文件,然后按照从问题到系统背景、再到关键改动和测试结果的顺序组织解释。它会生成一个包含简短章节、示例和图示的 HTML 页面。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
PR Explainer
Create a local, self-contained HTML page that teaches a reviewer the PR story: what changed, why it matters, how it works, how it fits into the system, and how it was verified.
Required workflow
Understand the PR before writing HTML
- Collect PR title/number, branch, link if available, base branch, commit range, changed files, and verification already performed.
- Inspect the current state with
git status --short. - Inspect recent commits with
git log --oneline -n 10. - Inspect scope with
git diff <base>...HEAD --statandgit diff <base>...HEAD. - If one commit carries the main change, inspect it with
git show --stat <commit>andgit show <commit>.
Find the explanation path
- Do not explain files in raw diff order.
- Teach the change in this order when possible:
- problem,
- system context,
- before/after data or control flow,
- key code changes,
- proof from tests/builds/manual checks,
- reviewer takeaway.
- Classify changed files as core behavior, plumbing/integration, tests, release metadata, or incidental noise.
- Highlight only files that help explain the PR.
Write for approachability
- Use plain language, short sections, concrete before/after examples, small focused snippets, diagrams, tables, and callouts.
- Explain the problem before implementation details.
- Define acronyms or package-specific terms before using them.
- Avoid dumping the full diff or assuming the reviewer already knows internal context.
Create a local self-contained HTML file
- Put generated files in
.pr-review/. - Use one HTML file containing all CSS and content.
- Do not commit
.pr-review/by default. - Prefer repo ignore rules or
.git/info/excludeso generated review pages stay out of commits.
- Put generated files in
Recommended HTML structure
Use this structure unless the PR clearly needs a different teaching order:
Hero
- PR number/title, one-sentence summary, branch/link/status.
- Small metrics: files changed, tests added, packages affected.
Problem
- Previous behavior.
- Why it was wrong, confusing, missing, or risky.
System Context
- Where the change sits in the product or architecture.
- Upstream callers, downstream behavior, and why this is the right layer.
- Behavior intentionally not changed.
Before/After Flow
- Visual old path vs. new path when the PR changes flow, state, ownership, permissions, request handling, data transformation, or component relationships.
Code Walkthrough
- Step-by-step explanation path.
- Focused diffs for important files only.
- Explain what each snippet accomplishes and why it is necessary.
Tests / Verification
- Tests added or updated.
- Commands run for tests, build, typecheck, lint, or manual verification.
- Known unrelated warnings or failures, if any.
Reviewer Takeaway
- The shortest useful mental model of the PR.
- What the reviewer should focus on while reviewing the actual diff.
Diagrams
Add diagrams when they reduce cognitive load. Prefer simple HTML/CSS diagrams over external dependencies.
Good diagram types:
- Request flow: Client → Server → Handler → Service → Result
- Before/after path: broken path vs. fixed path
- Ownership map: package/module responsibility boundaries
- Data transformation: input → normalized form → output
- State machine: pending → running → complete/error
Each diagram must answer: “What does this help the reviewer understand faster?”
Focused diff snippets
Show snippets along the explanation path, not giant patches. Each important snippet should include:
- file path,
- relevant added/removed lines only,
- visual styling for additions/removals,
- a short explanation,
- connection back to the PR story.
Use this pattern:
<div class="diff">
<div class="diff-title">packages/example/src/file.ts</div>
<pre>
<span class="del">- old behavior</span>
<span class="add">+ new behavior</span>
</pre>
</div>
A reviewer should understand the PR without opening GitHub, but the page should not replace the final full diff review.
Verification requirements
End with proof. Include exact commands when available, for example:
pnpm --filter @scope/package test path/to/test.ts -- --run
pnpm turbo build --filter ./packages/package
If verification was not run, say so clearly and list the recommended commands
常见问题
它会列出每一个改动的文件吗?
不会。它只突出有助于解释改动的文件,并跳过无关的噪音。
页面保存在哪里?
它会作为本地页面保存在项目中的一个审阅文件夹里。
它需要什么前提条件?
需要拉取请求的分支和提交历史,以便查看改动内容。
详情
作者的原始描述
Use when creating an approachable, self-contained HTML review aid for a pull request; explaining what changed, why it matters, how it works, and how it fits into the broader system; turning PR diffs, commits, tests, and architecture context into a local `.pr-review/` HTML page for reviewers; or helping reviewers understand complex code changes without dumping the full diff.
repo: mastra-ai/mastra
热度
- GitHub 星标
- 29k
- 排名
- #9362
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
debugging-difficult-bugs
29k帮你的智能体通过记录真实程序在运行时的行为来调试疑难问题,而不是只凭测试去猜测。
mastra-frontend
29k帮你的智能体通过组合 Mastra playground 设计系统的现成组件来搭建应用界面,而不是从头编写样式。
pr-splitter
29k帮你的智能体把一个庞大而混乱的拉取请求拆分成更小、便于审阅的拉取请求,同时确保原有工作安全。
ralph-plan
29k帮你的智能体通过简短的来回问答,规划一条结构化、目标明确的任务指令,使工作有清晰的步骤和检查。