用途
load-pr-context(完整名称 github:load-pr-context)用于加载指定分支上处于打开状态的拉取请求(PR)的完整上下文。它通过 GitHub MCP 工具访问结构化数据,帮助在会话开始时快速了解当前分支对应的 PR 情况。
主要能力
该技能能够:
- 根据 owner/repo 和分支名查找处于打开状态的 PR;
- 读取 PR 的描述、标签、评审人及元数据;
- 了解变更内容(通过 diff 或文件列表);
- 检查 CI 状态(通过工作流运行记录);
- 检查评审评论;
- 检查 PR 描述中提到的关联 issue;
- 输出简洁摘要,包括 PR 标题、编号、状态、描述要点、变更文件数量及重要文件、CI 状态(通过/失败)、评审状态(已批准、要求更改、待处理)以及任何阻塞问题或失败的检查。
使用方式
调用形式为:
/load-pr-context [owner/repo] [branch]
参数说明:
- owner/repo(必填):仓库,格式为 owner/repo;
- branch(必填):要查找 PR 的分支名称。
实现流程:
- 使用 mcp__github__list_pull_requests,参数 owner、repo、head: "OWNER:BRANCH"、state: "open" 查找 PR;
- 如果未找到 PR,则报告该分支没有打开的 PR 并停止;
- 如果找到 PR,则静默收集上下文(不逐步叙述):
- 使用 mcp__github__get_pull_request 读取描述、标签、评审人和元数据;
- 使用 mcp__github__get_pull_request_diff 或 mcp__github__list_pull_request_files 了解变更;
- 使用 mcp__github__list_workflow_runs 检查 CI 状态;
- 通过 mcp__github__list_review_comments_on_pull_request 检查评审评论;
- 检查 PR 描述中提到的关联 issue;
- 呈现简洁摘要。
示例交互:
用户:/load-pr-context thebushidocollective/han feat/pr-context
Claude:## PR #142: Add PR/MR context detection hooks
- Status: Open, 2 reviews pending
- Description: Adds SessionStart hooks to GitHub and GitLab plugins that detect open PRs/MRs on the current branch
- Changes: 8 files (+245, -12)
- CI: All checks passing
- Reviews: 1 approved, 1 pending from @reviewer
Ready to assist with this PR.
适用场景
该技能通常在功能分支上启动会话时自动调用,适合需要快速了解当前分支 PR 状态的开发工作流。
限制
- 仅查找处于打开状态的 PR;
- 需要提供 owner/repo 和分支名;
- 所有数据通过 MCP 工具获取,不使用 CLI 命令;
- 摘要保持简洁,以避免干扰会话启动。
其他信息(如收费、价格、平台支持等)暂未提供。