analyze-pr
分析GitHub/GitLab的Pull Request,拉取代码获取diff,读取PR网页描述,生成综合分析文档。当用户提供PR链接并要求分析、审查或总结PR时使用。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
分析GitHub/GitLab的Pull Request,拉取代码获取diff,读取PR网页描述,生成综合分析文档。当用户提供PR链接并要求分析、审查或总结PR时使用。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Capture a multi-step workflow into a timestamped pipeline memory after trial-and-error sessions. The core output is: (1) the final working commands saved as executable scripts (not bare shell commands), and (2) a structured markdown document separating the clean reproducible pipeline from the detours and pitfalls. Timestamped snapshots live in pipeline_memory/; mature pipelines can be promoted to PIPELINE.md and auto-loaded. Fully environment-agnostic — works for any project, any toolset, any domain. Use when the user finishes a multi-step task, says "保存工作流记忆", "save pipeline memory", "记录一下当前进展", or "/save-pipeline-memory". Takes an optional folder path.
Run Claude Code commands (including /insights, /doctor, custom prompts) via system crontab in non-interactive mode. Use when: (1) setting up daily/weekly automated Claude Code tasks, (2) scheduling reports or analysis via cron, (3) running Claude Code with third-party API backends (DeepSeek, Qwen, etc.) in headless environments, (4) "set up a daily report", "automate this in cron", "schedule insights". Covers: cron PATH setup, third-party API env vars for non-interactive mode, nvm/node auto-discovery, and wechat-reminder integration for notification delivery.
Use when the user wants to *learn* or *understand* a technical concept (an algorithm, a math derivation, an ML architecture, a systems internal) rather than just get a one-shot answer — triggers include "explain X", "teach me X", "help me understand X", or being stuck on a concept while reading a paper or code. Probe the user's level with a few questions FIRST, then teach interactively through a runnable Jupyter notebook with LaTeX derivations and small experiments.
Claudeception is a continuous learning system that extracts reusable knowledge from work sessions. Triggers: (1) /claudeception command to review session learnings, (2) "save this as a skill" or "extract a skill from this", (3) "what did we learn?", (4) After any task involving non-obvious debugging, workarounds, or trial-and-error discovery. Creates new Claude Code skills when valuable, reusable knowledge is identified.
Record a debugging session's findings into a timestamped markdown file under debug_experience/. Captures problem, root cause, solution, and key learnings in a structured, reusable format. Use when: you've just resolved a non-obvious bug, found an undocumented edge case, encountered an issue that took multiple attempts to fix, or when you say things like "保存调试经验", "save debug experience", "记录这次调试", "/save-debug-experience". Takes an optional folder path as argument.
MCP Notion工具使用指南,包含常见问题解决方案和最佳实践。使用当: (1) 访问Notion数据库view URL出现"URL type view not currently supported"错误, (2) 需要获取数据库schema和表结构信息, (3) 查询数据库中的条目内容, (4) 创建页面时MULTI_SELECT字段值不存在导致失败, (5) 需要更新数据库schema添加新选项, (6) 开发需要集成Notion数据的自动化工作流, (7) query_data_sources/query-database-view返回Business Plan要求错误, (8) 需要在无Business Plan的情况下枚举数据库所有条目。
| name | analyze-pr |
| description | 分析GitHub/GitLab的Pull Request,拉取代码获取diff,读取PR网页描述,生成综合分析文档。当用户提供PR链接并要求分析、审查或总结PR时使用。 |
| allowed-tools | Bash(git *), Bash(gh *), Bash(curl *), Read, Write, Grep, Glob, WebFetch |
| argument-hint | <PR URL, e.g. https://github.com/owner/repo/pull/123> |
给定一个 PR URL,在本地仓库中拉取代码变更并读取 PR 描述,生成综合分析文档。PR 对应的仓库就是当前本地仓库。
运行 /analyze-pr <PR_URL>
从 URL 中提取:
支持的格式:
https://github.com/{owner}/{repo}/pull/{number}
https://gitlab.com/{owner}/{repo}/-/merge_requests/{number}
优先使用 gh CLI(处理认证更方便):
# 检查 gh 是否可用
command -v gh >/dev/null 2>&1
# 使用 gh 获取 PR 信息(包括 baseRefName)
gh pr view {number} --repo {owner}/{repo} --json title,body,author,labels,baseRefName,headRefName,additions,deletions,changedFiles,commits,comments,reviews
# 获取 PR diff
gh pr diff {number} --repo {owner}/{repo}
如果 gh 不可用,使用 curl 访问 GitHub API:
curl -s https://api.github.com/repos/{owner}/{repo}/pulls/{number}
从返回数据中获取 base.ref(base 分支名)。
# GitHub
git fetch origin pull/{number}/head:pr-{number}
# GitLab
git fetch origin merge-requests/{number}/head:mr-{number}
不要 checkout PR 分支,只用它作为 ref 进行 diff,避免影响工作区。
使用第二步获取的 baseRefName / base.ref 作为 base 分支(不要硬编码 main):
BASE_BRANCH={baseRefName from step 2}
# 变更文件列表
git diff --name-only origin/$BASE_BRANCH...pr-{number}
# 变更统计
git diff --stat origin/$BASE_BRANCH...pr-{number}
# 完整 diff
git diff origin/$BASE_BRANCH...pr-{number}
# 提交历史
git log --oneline origin/$BASE_BRANCH..pr-{number}
对每个变更文件理解:
按类别分组变更:
创建 markdown 文档:
# PR 分析: {PR Title}
> PR 链接: {url}
> 作者: {author}
> 日期: {date}
> 分支: {base} ← {head}
## 概述
{一段话概述这个 PR 做了什么以及为什么}
## 变更统计
- 变更文件数: {count}
- 新增行数: {additions}
- 删除行数: {deletions}
## 详细变更
### {类别 1: 如 新功能}
#### {文件或组件名}
- **改了什么**: 变更描述
- **为什么改**: 变更原因
- **关键代码变更**: 重要代码修改的简述
### {类别 2: 如 Bug 修复}
...
## 提交历史
| Hash | Message | Author |
|------|---------|--------|
| {hash} | {message} | {author} |
## PR 讨论要点
{PR 评论和评审中的关键要点}
## 影响评估
- **破坏性变更**: {有/无, 详情}
- **受影响的依赖**: {列表}
- **需要关注的区域**: {列表}
## 审查备注
{额外的观察或建议}
将完整 diff 保存到本地文件:
git diff origin/$BASE_BRANCH...pr-{number} > pr-{number}.diff
这个 .diff 文件包含 PR 引入的所有代码变更。
将分析文档保存到当前工作目录:pr-analysis-{number}.md
清理临时分支 ref:
git branch -D pr-{number}
最终输出文件:
pr-{number}.diff — PR 的原始 diff 文件pr-analysis-{number}.md — 结构化分析文档gh CLI,它能自动处理认证