pr-shepherd
Analyze and fix failing GitHub PRs. Check .branchdeck/analysis.json to determine current state. If no analysis exists, analyze the PR. If analysis is approved, execute the fix plan.
- License 许可
- MIT
- 最近更新
- 2026-03-28
- Stars
- ★ 17
- Forks
- 0
01 前言 Front Matter
- name
- pr-shepherd
- description
- Analyze and fix failing GitHub PRs. Check .branchdeck/analysis.json to determine current state. If no analysis exists, analyze the PR. If analysis is approved, execute the fix plan.
03 SKILL.md 正文
PR Shepherd Workflow
You are shepherding a GitHub PR to get it ready to merge.
Get PR context
Read .branchdeck/pr-context.json for the PR you're working on:
repo: the GitHub repo (e.g., "owner/repo")number: the PR numberbranch: the PR branch namebase_branch: the target branch (e.g., "main")
Use these values in all gh commands below.
Determine your phase
Check if .branchdeck/analysis.json exists in the current worktree.
If it does NOT exist → Analyze
- Read PR status:
gh pr checks <number> --repo <repo> - Read review comments:
gh pr view <number> --repo <repo> --comments - Read inline review comments:
gh api repos/<owner>/<repo>/pulls/<number>/comments - Search codebase for relevant patterns
- Check recent git history:
git log --oneline -20 - Classify confidence:
- HIGH: lint/format, unused imports, single-file assertion, known pattern
- MEDIUM: test logic, small refactor, dependency version bump
- LOW: architecture, multi-file rewrite, security, unknown pattern
- Write
.branchdeck/analysis.jsonwith your findings:{ "pr": { "repo": "<repo>", "number": <number>, "branch": "<branch>" }, "confidence": "HIGH|MEDIUM|LOW", "failures": [ { "check_name": "<CI check name>", "error_summary": "<one-line summary>", "root_cause": "<what actually went wrong>", "fix_approach": "<how to fix it>" } ], "reviews": [ { "reviewer": "<username>", "comment": "<review comment>", "proposed_response": "<how you'd address it>" } ], "plan_steps": [ { "description": "<what to do>", "file": "<file path>", "change_type": "modify|create|delete" } ], "affected_files": ["<file1>", "<file2>"], "reasoning": "<brief explanation of your analysis>", "approved": false, "approved_plan": null, "resolved": false } - End your session. A human will review your analysis.
If it exists with approved: true → Fix
- Read
approved_planfrom.branchdeck/analysis.json(the human may have edited the plan) - Execute each plan step in order
- Follow the project's code standards (see CLAUDE.md)
- Run the project's check suite (see CLAUDE.md for commands)
- Stage, commit, push:
git add <affected files> git commit -m "fix: <concise summary>" git push - Verify CI:
gh pr checks <number> --repo <repo> --watch - If CI still fails, analyze the new failure and fix it (up to 3 attempts)
- When done, update analysis.json: set
resolved: true
If it exists with approved: false → Wait
Do nothing. End your session. The human hasn't reviewed yet.
Troubleshooting
If gh commands fail with 403/404, verify authentication: gh auth status
04 同仓库更多 Skills
wds-8-product-evolution
Brownfield improvements — the full WDS pipeline in miniature for existing products
wds-7-design-system
Create, import, browse, and maintain design system components and tokens
wds-6-asset-generation
Generate visual and text assets from specifications through AI-powered creative production
wds-5-agentic-development
AI-assisted development, testing, and reverse engineering through structured agent collaboration
wds-4-ux-design
Transform ideas into detailed visual specifications through scenario-driven design
wds-3-scenarios
Create UX scenario outlines from Trigger Map through structured micro-steps