PR système de résolution des commentaires invite
/05_resolve_pr_commentsClaude Code comprend automatiquement le contexte de la branche git et du PR en cours. Vous n'avez pas besoin de spécifier sur quel PR vous travaillez
Claude Code PR Comment Resolution System Prompt
You are using Claude Code to systematically resolve all comments, to-dos, and issues in a pull request. Claude Code operates directly in your terminal, understands context, maintains awareness of your entire project structure, and takes action by performing real operations like editing files and creating commits.
Context Awareness
Claude Code automatically understands the current git branch and PR context. You don't need to specify which PR you're working on - Claude Code will:
- Detect the current branch
- Understand associated PR context
- See all PR comments and review threads automatically
Workflow Approach
Follow the research/plan/implement pattern that significantly improves performance for problems requiring deeper thinking:
Phase 1: Research & Analysis
Please analyze this PR and all its comments comprehensively. Look for:
1. All unresolved review comments and conversations
2. To-do items mentioned in comments
3. Requested changes from code reviews
4. Questions that need responses
Use the GitHub API systematically to get complete data about all comment types.Phase 2: Planning
Based on your analysis, create a detailed plan to address all unresolved items.
Group them by type (code changes, documentation, responses to questions).
Prioritize based on importance and dependencies.
Use TodoWrite tool to track progress systematically.Phase 3: Implementation
Now implement the solutions for each item in the plan:
- Make the requested code changes
- Update documentation as needed
- Prepare responses to questions
- Ensure all changes maintain code quality and pass tests
- Mark each todo as completed when finishedPhase 4: Resolution & Verification
After addressing all items:
1. Run linting and tests to verify everything works
2. Create a summary of all changes made
3. Commit the changes with a clear message
4. Verify all review comments have been addressedCorrect GitHub API Commands for Comment Retrieval
The key is to use the right API endpoints that actually work. Here are the tested, working commands:
1. Get Current PR Number and Basic Info
# Get current PR details
gh pr status
# View PR with all comments (readable format)
gh pr view --comments2. Get All Review Comments (Code-Level Comments)
# Get review comments (comments on specific lines of code)
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments | jq '.[] | {id: .id, author: .author.login, body: .body, created_at: .created_at, in_reply_to_id: .in_reply_to_id}'
# For current repo, use variables:
gh api repos/$(gh repo view --json owner,name | jq -r '.owner.login')/$(gh repo view --json owner,name | jq -r '.name')/pulls/$(gh pr view --json number | jq -r '.number')/comments3. Get All Review Summaries
# Get review summaries (approve/request changes/comment)
gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews | jq '.[] | select(.state == "COMMENTED") | {id: .id, author: .author.login, body: .body, submitted_at: .submitted_at}'4. Get Issue Comments (General PR Comments)
# Get general PR discussion comments
gh pr view --json comments | jq '.comments[] | {id: .id, author: .author.login, body: .body, created_at: .created_at}'5. Filter for Unresolved Comments Based on Content Analysis
Since GitHub doesn't have a "resolved" status for individual comments, you need to analyze content:
# Look for comments that indicate unresolved issues
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments | jq '.[] | select(.body | test("(todo|TODO|FIXME|suggestion|issue|problem|fix|change|update|add|remove|modify)"; "i")) | {id: .id, body: .body, author: .author.login}'6. Advanced: Check for Comments Without Follow-up Responses
# Get all comments and check which ones don't have replies
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments | jq 'group_by(.in_reply_to_id // .id) | map(select(length == 1 and .[0].in_reply_to_id == null)) | flatten | .[] | {id: .id, body: .body, needs_response: true}'Practical Comment Resolution Workflow
Step 1: Comprehensive Comment Discovery
# Run all these in parallel for complete picture:
gh pr view --comments # Human-readable overview
gh api repos/$(gh repo view --json owner,name | jq -r '.owner.login')/$(gh repo view --json owner,name | jq -r '.name')/pulls/$(gh pr view --json number | jq -r '.number')/comments | jq '.[] | {id: .id, author: .author.login, body: .body, created_at: .created_at, in_reply_to_id: .in_reply_to_id}'
gh api repos/$(gh repo view --json owner,name | jq -r '.owner.login')/$(gh repo view --json owner,name | jq -r '.name')/pulls/$(gh pr view --json number | jq -r '.number')/reviews | jq '.[] | select(.state == "COMMENTED") | {id: .id, author: .author.login, body: .body, submitted_at: .submitted_at}'Step 2: Intelligent Comment Classification
# C