AgentSkillsCN

github-pull-requests

使用 MCP 工具管理 GitHub 拉取请求。当用户希望创建 PR、审查代码、合并分支、请求评审、更新 PR 详情,或查看 PR 状态时,可使用此技能。触发条件包括:“创建 PR”、“合并此分支”、“请求评审”、“更新 PR 描述”、“查看 PR 状态”,或任何拉取请求生命周期中的相关操作。

SKILL.md
--- frontmatter
name: github-pull-requests
description: >
  Manage GitHub pull requests using MCP tools. Use this skill when users want to
  create PRs, review code, merge branches, request reviews, update PR details,
  or check PR status. Triggers on requests like "create a PR", "merge this branch",
  "request a review", "update the PR description", "check PR status", or any
  pull request lifecycle task.

GitHub Pull Requests

Manage GitHub pull requests using the GitHub MCP server tools.

Available MCP Tools

ToolPurpose
mcp_github_create_pull_requestCreate new pull requests
mcp_github_merge_pull_requestMerge pull requests
mcp_github_update_pull_requestUpdate PR title, body, reviewers
mcp_github_update_pull_request_branchSync PR branch with base
mcp_github_pull_request_review_writeCreate/submit/delete reviews
mcp_github_request_copilot_reviewRequest GitHub Copilot code review
mcp_github_search_pull_requestsSearch PRs with GitHub search syntax
mcp_github_list_pull_requestsList PRs in a repository

Workflow

  1. Determine action: Create, merge, review, or query?
  2. Gather context: Get repo info, branch names, existing PRs
  3. Structure content: Use templates from references/templates.md
  4. Execute: Call the appropriate MCP tool
  5. Confirm: Report the PR URL and status to user

Creating Pull Requests

Required Parameters

yaml
owner: repository owner (org or user)
repo: repository name
title: clear, descriptive title
head: branch containing changes (source)
base: branch to merge into (target, usually 'main')

Optional Parameters

yaml
body: PR description (markdown)
draft: true/false (create as draft)
maintainer_can_modify: true/false

Title Guidelines

  • Use conventional commit style when appropriate: feat:, fix:, docs:
  • Be specific about the change
  • Keep under 72 characters
  • Examples:
    • feat: Add dark mode support
    • fix(auth): Resolve SSO login failure
    • docs: Update API reference for v2

Body Structure

Use the PR template from references/templates.md. Key sections:

  • Summary: What changed and why
  • Changes: Bullet list of modifications
  • Testing: How to verify the changes
  • Checklist: Pre-merge verification items

Merging Pull Requests

Required Parameters

yaml
owner: repository owner
repo: repository name
pullNumber: PR number (integer)

Optional Parameters

yaml
merge_method: "squash" | "merge" | "rebase"
commit_title: custom merge commit title
commit_message: custom merge commit message

Merge Methods

MethodUse Case
squashClean history, combine all commits into one
mergePreserve full commit history
rebaseLinear history without merge commits

Default: Use squash unless the user specifies otherwise.

Reviewing Pull Requests

Creating a Review

Use mcp_github_pull_request_review_write with method: "create":

yaml
owner: repository owner
repo: repository name
pullNumber: PR number
event: "APPROVE" | "REQUEST_CHANGES" | "COMMENT"
body: review comment text

Review Events

EventUse When
APPROVEChanges look good, ready to merge
REQUEST_CHANGESIssues must be addressed before merge
COMMENTFeedback without explicit approval/blocking

Request Copilot Review

For automated code review feedback:

yaml
owner: repository owner
repo: repository name
pullNumber: PR number

Updating Pull Requests

Use mcp_github_update_pull_request to modify:

yaml
owner: repository owner
repo: repository name
pullNumber: PR number (required)
# Optional - only include fields to change:
title: new title
body: new description
state: "open" | "closed"
base: new base branch
draft: true/false (mark as draft or ready)
reviewers: ["username1", "username2"]

Searching Pull Requests

Use mcp_github_search_pull_requests with GitHub search syntax:

Common Search Queries

GoalQuery
Open PRs in reporepo:owner/repo is:open
PRs by authorauthor:username
PRs needing reviewreview:required
Draft PRsdraft:true
PRs with labellabel:bug
Recently updatedupdated:>2024-01-01
PRs mentioning text"search term" in:title,body

Examples

Example 1: Create a PR

User: "Create a PR from my feature branch to main"

Action: Call mcp_github_create_pull_request:

json
{
  "owner": "jonathan-vella",
  "repo": "azure-agentic-infraops",
  "title": "feat: Add dark mode support",
  "head": "feature/dark-mode",
  "base": "main",
  "body": "## Summary\nAdds dark mode theme support.\n\n## Changes\n..."
}

Example 2: Merge with Squash

User: "Merge PR #70 using squash"

Action: Call mcp_github_merge_pull_request:

json
{
  "owner": "jonathan-vella",
  "repo": "azure-agentic-infraops",
  "pullNumber": 70,
  "merge_method": "squash",
  "commit_title": "feat: Add dark mode support (#70)"
}

Example 3: Request Changes

User: "Request changes on PR #42 - needs more tests"

Action: Call mcp_github_pull_request_review_write:

json
{
  "owner": "jonathan-vella",
  "repo": "azure-agentic-infraops",
  "pullNumber": 42,
  "method": "create",
  "event": "REQUEST_CHANGES",
  "body": "This PR needs additional test coverage before merging.\n\n..."
}

Example 4: Update PR to Ready

User: "Mark PR #55 as ready for review and add reviewers"

Action: Call mcp_github_update_pull_request:

json
{
  "owner": "jonathan-vella",
  "repo": "azure-agentic-infraops",
  "pullNumber": 55,
  "draft": false,
  "reviewers": ["teammate1", "teammate2"]
}

Branch Management

Create Branch First

Before creating a PR, ensure the branch exists using mcp_github_create_branch:

yaml
owner: repository owner
repo: repository name
branch: new branch name
from_branch: source branch (optional, defaults to default branch)

Update Branch with Base

To sync a PR branch with the latest changes from base:

yaml
owner: repository owner
repo: repository name
pullNumber: PR number

Tips

  • Always check if a PR already exists for the branch before creating
  • Use squash merge for cleaner history on feature branches
  • Request Copilot review for quick automated feedback before human review
  • Include issue references in PR body: Closes #123 or Fixes #456
  • For draft PRs, set draft: true to indicate work-in-progress
  • After merging, the source branch can be deleted via GitHub UI

Common Labels for PRs

LabelUse For
ready-for-reviewPR is ready for code review
work-in-progressStill being worked on
needs-testsMissing test coverage
breaking-changeContains breaking API changes
documentationDocumentation updates
dependenciesDependency updates