AgentSkillsCN

gh-create-pr

利用仓库所需的流程与模板合规性,创建或更新 GitHub 拉取请求。当被要求创建、打开或更新 PR 时,助手会自动读取 `.github/pull_request_template.md` 文件,完整填写每个模板板块,严格保留 Markdown 结构,并将缺失的数据标记为“N/A”或“无”,而非直接跳过相关部分。

SKILL.md
--- frontmatter
name: gh-create-pr
description: Create or update GitHub pull requests using the repository-required workflow and template compliance. Use when asked to create/open/update a PR so the assistant reads `.github/pull_request_template.md`, fills every template section, preserves markdown structure exactly, and marks missing data as N/A or None instead of skipping sections.

GitHub PR Creation

Workflow

  1. Read .github/pull_request_template.md before drafting the PR body.
  2. Collect PR context from the current branch (base/head, scope, linked issues, testing status, breaking changes, release note content).
  3. Draft the PR body using the template structure exactly:
    • Keep section order and headings.
    • Keep checkbox and code block formatting.
    • Fill every section; if not applicable, write N/A or None.
  4. Present the full Markdown PR body in chat for review before creating the PR.
  5. Ask for explicit confirmation to create the PR with that body.
  6. After confirmation, create the PR with gh pr create --body-file using a unique temp file path.
  7. Report the created PR URL and summarize title/base/head and any required follow-up.

Constraints

  • Never skip template sections.
  • Never rewrite the template format.
  • Keep content concise and specific to the current change set.
  • PR title and body must be written in English.
  • Never create the PR before showing the full final body to the user.
  • Never rely on command permission prompts as PR body preview.

Command Pattern

bash
# read template
cat .github/pull_request_template.md

# show this full Markdown body in chat first
pr_body_file="$(mktemp /tmp/gh-pr-body-XXXXXX).md"
cat > "$pr_body_file" <<'EOF'
...filled template body...
EOF

# run only after explicit user confirmation
gh pr create --base <base> --head <head> --title "<title>" --body-file "$pr_body_file"
rm -f "$pr_body_file"