|
67 | 67 | </step> |
68 | 68 |
|
69 | 69 | <step number="4"> |
| 70 | + <name>Fetch Existing PR Comments and Reviews</name> |
| 71 | + <instructions> |
| 72 | + IMPORTANT: Before reviewing any code, first get all existing comments and reviews to understand what feedback has already been provided: |
| 73 | + |
| 74 | + <use_mcp_tool> |
| 75 | + <server_name>github</server_name> |
| 76 | + <tool_name>get_pull_request_comments</tool_name> |
| 77 | + <arguments> |
| 78 | + { |
| 79 | + "owner": "[owner]", |
| 80 | + "repo": "[repo]", |
| 81 | + "pullNumber": [number] |
| 82 | + } |
| 83 | + </arguments> |
| 84 | + </use_mcp_tool> |
| 85 | + |
| 86 | + Also fetch existing reviews: |
| 87 | + <use_mcp_tool> |
| 88 | + <server_name>github</server_name> |
| 89 | + <tool_name>get_pull_request_reviews</tool_name> |
| 90 | + <arguments> |
| 91 | + { |
| 92 | + "owner": "[owner]", |
| 93 | + "repo": "[repo]", |
| 94 | + "pullNumber": [number] |
| 95 | + } |
| 96 | + </arguments> |
| 97 | + </use_mcp_tool> |
| 98 | + |
| 99 | + Create a mental or written list of: |
| 100 | + - All issues/suggestions that have been raised |
| 101 | + - The specific files and line numbers mentioned |
| 102 | + - Whether comments appear to be resolved or still pending |
| 103 | + |
| 104 | + This information will guide your review to avoid duplicate feedback. |
| 105 | + </instructions> |
| 106 | + </step> |
| 107 | + |
| 108 | + <step number="5"> |
70 | 109 | <name>Check Out Pull Request Locally</name> |
71 | 110 | <instructions> |
72 | | - Use the GitHub CLI (e.g. `gh pr checkout <PR_NUMBER>`) to check out the pull request locally after fetching |
73 | | - the diff. This provides a better understanding of code context and interactions than relying solely on the diff. |
| 111 | + Use the GitHub CLI to check out the pull request locally: |
74 | 112 |
|
75 | 113 | <execute_command> |
76 | 114 | <command>gh pr checkout [PR_NUMBER]</command> |
|
83 | 121 | </instructions> |
84 | 122 | </step> |
85 | 123 |
|
86 | | - <step number="5"> |
87 | | - <name>Fetch Existing PR Comments</name> |
| 124 | + <step number="6"> |
| 125 | + <name>Verify Existing Comments Against Current Code</name> |
88 | 126 | <instructions> |
89 | | - Get existing comments to understand the current discussion state: |
| 127 | + Now that you have the code checked out locally and know what comments exist: |
90 | 128 |
|
91 | | - <use_mcp_tool> |
92 | | - <server_name>github</server_name> |
93 | | - <tool_name>get_pull_request_comments</tool_name> |
94 | | - <arguments> |
95 | | - { |
96 | | - "owner": "[owner]", |
97 | | - "repo": "[repo]", |
98 | | - "pullNumber": [number] |
99 | | - } |
100 | | - </arguments> |
101 | | - </use_mcp_tool> |
| 129 | + 1. For each existing comment/review point: |
| 130 | + - Navigate to the specific file and line mentioned |
| 131 | + - Check if the issue has been addressed in the current code |
| 132 | + - Mark it as "resolved" or "still pending" in your notes |
| 133 | + |
| 134 | + 2. Use read_file or codebase_search to examine the specific areas mentioned in comments: |
| 135 | + - If a comment says "missing error handling on line 45", check if error handling now exists |
| 136 | + - If a review mentioned "this function needs tests", check if tests have been added |
| 137 | + - If feedback was about code structure, verify if refactoring has occurred |
102 | 138 |
|
103 | | - Examine existing PR comments to understand the current state of discussion. When reading the comments and reviews, you must verify which are resolved by reading the files they refer to, since they might already be resolved. This prevents you from making redundant suggestions. |
| 139 | + 3. Keep track of: |
| 140 | + - Comments that have been addressed (DO NOT repeat these) |
| 141 | + - Comments that are still valid (you may reinforce these if critical) |
| 142 | + - New issues not previously mentioned (these are your main focus) |
| 143 | + |
| 144 | + This verification step is CRITICAL to avoid redundant feedback and ensures your review adds value. |
104 | 145 | </instructions> |
105 | 146 | </step> |
106 | 147 |
|
107 | | - <step number="6"> |
| 148 | + <step number="7"> |
108 | 149 | <name>Perform Comprehensive Review</name> |
109 | 150 | <instructions> |
110 | 151 | Review the pull request thoroughly: |
|
129 | 170 | </instructions> |
130 | 171 | </step> |
131 | 172 |
|
132 | | - <step number="7"> |
| 173 | + <step number="8"> |
133 | 174 | <name>Prepare Review Comments</name> |
134 | 175 | <instructions> |
135 | 176 | Format your review comments following these guidelines: |
136 | 177 |
|
| 178 | + CRITICAL: Before adding any comment, verify it's not already addressed: |
| 179 | + - Cross-reference with your notes from Step 6 |
| 180 | + - Only comment on NEW issues or UNRESOLVED existing issues |
| 181 | + - Never repeat feedback that has been addressed in the current code |
| 182 | + |
137 | 183 | Your suggestions should: |
138 | 184 | - Use a **friendly, curious tone** — prefer asking: "Is this intentional?" or "Could we approach this differently to improve X?" |
139 | 185 | - Avoid assumptions or judgments; ask questions instead of declaring problems. |
|
148 | 194 | - Critical issues (must fix) |
149 | 195 | - Important suggestions (should consider) |
150 | 196 | - Minor improvements (nice to have) |
| 197 | + |
| 198 | + Include a note about which existing comments you verified as resolved (for user awareness). |
151 | 199 | </instructions> |
152 | 200 | </step> |
153 | 201 |
|
154 | | - <step number="8"> |
| 202 | + <step number="9"> |
155 | 203 | <name>Preview Review with User</name> |
156 | 204 | <instructions> |
157 | 205 | Always show the user a preview of your review suggestions and comments before taking any action. |
|
160 | 208 | <ask_followup_question> |
161 | 209 | <question>I've completed my review of PR #[number]. Here's what I found: |
162 | 210 |
|
163 | | - [Summary of findings organized by priority] |
| 211 | + [If applicable: Existing comments that have been resolved: |
| 212 | + - Comment about X on file Y - now addressed |
| 213 | + - Suggestion about Z - implemented] |
| 214 | + |
| 215 | + [Summary of NEW findings organized by priority] |
164 | 216 |
|
165 | 217 | Would you like me to: |
166 | 218 | 1. Create a comprehensive review with all comments |
|
175 | 227 | </instructions> |
176 | 228 | </step> |
177 | 229 |
|
178 | | - <step number="9"> |
| 230 | + <step number="10"> |
179 | 231 | <name>Submit Review</name> |
180 | 232 | <instructions> |
181 | 233 | Based on user preference, submit the review as a comprehensive review: |
|
0 commit comments