From 0d53c4f0f18a3674229b9828b3cc82e06bc3fb3e Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Thu, 8 Jan 2026 16:13:42 +0800 Subject: [PATCH] docs: optimize PR review workflow for efficiency Improve the PR review command workflow to reduce API calls and clarify the review process: - Fetch PR details in single call (combine list + view data) - Add quick rejection checks before API calls (conflicts, duplicates) - Simplify terminology (APPROVE/REJECT -> PASS/REJECT) - Streamline section headers for clarity - Remove gh pr view from allowed tools (redundant with list) This reduces unnecessary GitHub API calls and makes the review process more efficient. Co-Authored-By: Claude --- .claude/commands/review-pending-prs.md | 31 ++++++++++++++------------ 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.claude/commands/review-pending-prs.md b/.claude/commands/review-pending-prs.md index c691abba..76d0a527 100644 --- a/.claude/commands/review-pending-prs.md +++ b/.claude/commands/review-pending-prs.md @@ -1,6 +1,6 @@ --- description: Review pending PRs against CONTRIBUTING.md acceptance criteria. -allowed-tools: Bash(gh api:*), Bash(gh pr close:*), Bash(gh pr diff:*), Bash(gh pr edit:*), Bash(gh pr list:*), Bash(gh pr view:*) +allowed-tools: Bash(gh api:*), Bash(gh pr close:*), Bash(gh pr diff:*), Bash(gh pr edit:*), Bash(gh pr list:*) --- ## Usage @@ -11,20 +11,23 @@ allowed-tools: Bash(gh api:*), Bash(gh pr close:*), Bash(gh pr diff:*), Bash(gh ## Instructions -1. Fetch 10 open PRs (skip reviewed): `gh pr list --repo vinta/awesome-python --limit 10 --search "-label:\"claude reviewed\"" --json number,title,author,url` -2. For each PR: - - Fetch PR details: `gh pr view --repo vinta/awesome-python --json title,body,author,files,url,mergeable,mergeStateStatus` - - Fetch PR diff: `gh pr diff --repo vinta/awesome-python` - - For each project added, fetch repo stats: `gh api repos// --jq '{stars: .stargazers_count, created: .created_at, updated: .pushed_at, language: .language, archived: .archived}'` -3. Review against all criteria in [CONTRIBUTING.md](../../CONTRIBUTING.md) -4. Present summary table of 10 PRs with recommendations -5. Ask user: +1. Fetch 10 open PRs with details: `gh pr list --repo vinta/awesome-python --limit 10 --search "-label:\"claude reviewed\"" --json number,title,author,url,body,files,mergeable,mergeStateStatus` +2. Fetch all PR diffs in parallel: `gh pr diff --repo vinta/awesome-python` +3. Run quick rejection checks (no API calls needed): + - Has merge conflicts? (from `mergeable`/`mergeStateStatus`) + - Adds more than one project? (from diff) + - Duplicate entry? (from diff - URL already in README) + - Not a project submission? (from diff - e.g., random files, contributor list) +4. For PRs passing quick checks, fetch repo stats: `gh api repos// --jq '{stars: .stargazers_count, created: .created_at, updated: .pushed_at, language: .language, archived: .archived}'` +5. Review against all criteria in [CONTRIBUTING.md](../../CONTRIBUTING.md) +6. Present summary table with recommendations +7. Ask user: ``` Would you like me to: 1. Close the rejected PRs with comments? -2. Add "claude reviewed" label to the approved PRs? +2. Add "claude reviewed" label to the passed PRs? 3. Do all ``` @@ -44,10 +47,10 @@ Check these rules first - if any fail, recommend rejection: Provide a simple review: -1. **Rejection Check** - table with the above rules and PASS/FAIL -2. **Recommendation** - APPROVE or REJECT +1. **Rejection Check** - table with the above rules and PASS/REJECT +2. **Recommendation** - PASS or REJECT -## Closing PRs +## Close PRs If user asks to close/reject: @@ -55,7 +58,7 @@ If user asks to close/reject: gh pr close --repo vinta/awesome-python --comment "" ``` -## Mark as Reviewed +## Mark as Passed ```bash gh pr edit --repo vinta/awesome-python --add-label "claude reviewed"