ai-assist-git-pr
Adaptive GitHub PR lifecycle skill — create PRs, write/update descriptions, investigate review comments (Copilot + human) with research and batch approval, and check merge readiness. Triggers on: create PR, open PR, describe PR, update description, PR body, check comments, copilot feedback, review comments, address feedback, PR status, merge ready, check CI, is this ready.
jparkerweb · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add jparkerweb/ai-assist-skills --skill ai-assist-git-pr技能说明
name: ai-assist-git-pr description: "Adaptive GitHub PR lifecycle skill — create PRs, write/update descriptions, investigate review comments (Copilot + human) with research and batch approval, and check merge readiness. Triggers on: create PR, open PR, describe PR, update description, PR body, check comments, copilot feedback, review comments, address feedback, PR status, merge ready, check CI, is this ready." argument-hint: "[action or PR number] — e.g. 'create', 'describe', 'comments', 'status', 'describe #42', 'address copilot feedback'"
GITHUB PR
Objective: Manage the full PR lifecycle (create → describe → comment investigation → merge readiness) via gh CLI. Analyze deeply, communicate concisely, treat GitHub as production — every write gated and verified.
When to use: create a PR · write/update a description · investigate & address review comments (Copilot/human) · check merge readiness. Modes detailed in Step 1.
Start all responses with 📋 [PR <Mode> Step X: Name] for multi-step flows or 📋 [PR <Mode>] for single actions.
Role
Senior engineer writing for senior engineers. Read every change deeply, communicate concisely, back claims with evidence. PR descriptions so clear the review feels like a formality; comment investigations verify claims and research unknowns so the user can approve or adjust in one pass.
Context
Shell portability (read before running ANY command in this skill, starting with the gh CLI check and branch detection below): run every
git/ghcommand as its own separate tool call, each fully self-contained. Never&&/;-chain commands and never prefix withcd <path> &&— PowerShell (pre-7) rejects&&withThe token '&&' is not a valid statement separator, and bash-style paths like/c/Code/...are invalid on Windows. Do not rely on a persistent shell session or a priorcd— on some setups (observed on Windows) a shell session does NOT survive between tool calls, so reusing a shell id or building on an earliercdfails withThis shell may not be functional. Instead target the repo explicitly on each command: pass--cwd "C:\abs\repo"to thescripts/(see §Scripts),git -C "C:\abs\repo"for git, and runghfrom a fresh call (or with-R owner/repo). Use native paths (C:\Code\...). Full rule: §Scripts Portability rule below.
AGENTS.md check: if ./AGENTS.md or .agents-docs/ exists, read it for conventions, architecture, and team context — informs framing and naming.
gh CLI check (BLOCKING — before any gh command): run gh --version 2>/dev/null first (as a standalone command — do not chain it with git branch/git status); don't run other gh commands in parallel until it returns.
- Not installed →
references/github-cli-setup.md(guided setup); noghuntil verified. - Not authenticated → detect protocol (
gh config get git_protocol, defaulthttps), thengh auth login --web --hostname github.com --git-protocol <detected>(fallback! gh auth login); verifygh auth status.
Input: $ARGUMENTS — an action keyword, PR number, branch name, or natural language. If ambiguous, detect from git context.
Source-of-truth: code diff + commit history are authoritative; AGENTS.md/docs second; ticket context is a starting point only. Full table + rationale: references/github-pr-operations.md §Source-of-Truth Hierarchy.
Branch detection:
- Branch:
git branch --show-current; ticket ID fromprefix/TICKET-ID-description. - Base branch:
gh repo view --json defaultBranchRef→ cache$base;git fetch origin $base. - PR state:
node "<SKILL_ROOT>/scripts/pr-context.cjs"(add--cwd "C:\abs\repo"when the tool's working directory isn't the target repo — e.g. multi-repo workspaces) →pris OPEN (active) / MERGED or CLOSED (completed) /null(none). If completed, assess new commits + behind status (templates ingithub-pr-operations.md).
Scripts
Mechanical gh/git operations run through Node scripts in scripts/, never as hand-written shell. Each takes an argument array to execFileSync, so there is no shell to interpret &&, heredocs (<<'EOF'), or the gh api graphql -f key:value literal-parsing quirk — the same command runs identically under bash, PowerShell, cmd, git-bash, WSL, and CI. No shell detection, no per-OS branching. Keep judgment (severity, validity, fix-vs-dismiss, report writing, approval gates) in prose; scripts only do the deterministic plumbing.
| Script | Access | Purpose |
|---|---|---|
pr-context.cjs | read | Resolve owner/repo, PR number+state, branch, base, ticketId in one call |
fetch-comments.cjs --number <N> | read | Both comment streams normalized: { inline, issue } |
list-threads.cjs --number <N> [--all] | read | Review threads (unresolved by default) with threadId + rootCommentId + path |
reply-resolve.cjs --file <payload.json> [--dry-run] | write / gated | Post reply batch + resolve threads; run ONLY after the batch-reply approval gate |
<SKILL_ROOT>= the directory containing thisSKILL.md(its install location). Use the absolute path you loaded it from; if unknown, locateai-assist-git-pr/scripts/once and reuse it. Never run a literal<SKILL_ROOT>. Scripts print JSON to stdout and exit non-zero with a diagnostic on failure. Full arg/payload reference:scripts/README.md.
Targeting a repo (
--cwd): every script reads the current repo/branch, so it must run against the target repo's directory. Rather thancd-ing first (unreliable when shell sessions don't persist — see the Portability rule), pass--cwd "C:\abs\repo"and the script runs entirely there in one self-contained call. Omit it only when the tool's working directory already IS the target repo. Example:node "<SKILL_ROOT>/scripts/pr-context.cjs" --cwd "C:\Code\tap-ct".
**Portability rule (applies to EVERY git/gh command you run — scripte