|
| 1 | +--- |
| 2 | +description: Triage and address PR comments from code review bots intelligently |
| 3 | +argument-hint: [pr-number] |
| 4 | +--- |
| 5 | + |
| 6 | +# Address PR Comments |
| 7 | + |
| 8 | +<objective> |
| 9 | +Get a PR to "ready to merge" by intelligently triaging bot feedback. You have context |
| 10 | +bots lack - use judgment, not compliance. Declining feedback is as valid as accepting |
| 11 | +it. The goal is "ready to merge," not "zero comments." |
| 12 | + |
| 13 | +Read @rules/code-review-standards.mdc for triage principles: |
| 14 | + |
| 15 | +- Fix critical bugs, ensure security, validate core behavior |
| 16 | +- Skip theoretical edge cases, minor polish, over-engineering suggestions |
| 17 | +- Trust runtime validation over compile-time perfection |
| 18 | +- Constants for DRY, not to avoid "magic strings" |
| 19 | +- Target 90% coverage, not 100% |
| 20 | +- Optimize when metrics show problems, not preemptively </objective> |
| 21 | + |
| 22 | +<usage> |
| 23 | +/address-pr-comments - Auto-detect PR from current branch |
| 24 | +/address-pr-comments 123 - Address comments on PR #123 |
| 25 | +</usage> |
| 26 | + |
| 27 | +<pr-detection> |
| 28 | +Use provided PR number, or detect from current branch. Exit if no PR exists. |
| 29 | +</pr-detection> |
| 30 | + |
| 31 | +<comment-sources> |
| 32 | +Code review bots comment in different places. Fetch both: |
| 33 | +- PR comments (general feedback on the PR itself) |
| 34 | +- Review comments (inline on specific code lines) |
| 35 | +- Reviews (approval status with body text) |
| 36 | + |
| 37 | +Identify bot comments by author - automated usernames like cursor-bot, |
| 38 | +claude-code-review, greptile-bot. Human comments require different handling. |
| 39 | +</comment-sources> |
| 40 | + |
| 41 | +<autonomous-wait-loop> |
| 42 | +This command runs autonomously - no user prompts, just do the work. |
| 43 | + |
| 44 | +Review bots (Claude, Cursor Bot) register as GitHub checks. Use `gh pr checks --watch` |
| 45 | +to wait for them to complete, then fetch and triage comments. |
| 46 | + |
| 47 | +After fixes are pushed, wait for checks again - bots re-analyze new commits. Exit only |
| 48 | +when checks pass with no new actionable feedback. |
| 49 | + |
| 50 | +While waiting, give feedback on existing bot comments (reactions for good/bad |
| 51 | +suggestions) and narrate what you're seeing. Share interesting findings: |
| 52 | + |
| 53 | +- "Cursor Bot found a real bug - if the user's session expires mid-request, we'd hit a |
| 54 | + null pointer at auth.ts:47. Good catch, will fix." |
| 55 | +- "Greptile wants me to extract `timeout: 30000` into a constant. It's used once and the |
| 56 | + meaning is obvious. Declining with thumbs-down." |
| 57 | +- "Claude flagged SQL injection risk in the search query - we're interpolating user |
| 58 | + input directly. Legit security issue, addressing." |
| 59 | +- "Three comments about adding try-catch to already-safe operations. Bots are being |
| 60 | + paranoid today." |
| 61 | + |
| 62 | +Share what the bots found when it's interesting. Make the wait informative. |
| 63 | +</autonomous-wait-loop> |
| 64 | + |
| 65 | +<triage-process> |
| 66 | +For each bot comment, evaluate against code-review-standards.mdc: |
| 67 | + |
| 68 | +Address immediately: |
| 69 | + |
| 70 | +- Security vulnerabilities |
| 71 | +- Actual bugs that could cause runtime failures |
| 72 | +- Core functionality issues |
| 73 | +- Clear improvements to maintainability |
| 74 | + |
| 75 | +Decline with explanation: |
| 76 | + |
| 77 | +- Theoretical race conditions without demonstrated impact |
| 78 | +- Magic number/string extraction for single-use values |
| 79 | +- Accessibility improvements (not current priority) |
| 80 | +- Minor type safety refinements when runtime handles it |
| 81 | +- Edge case tests for unlikely scenarios |
| 82 | +- Performance micro-optimizations without profiling data |
| 83 | +- Documentation enhancements beyond core docs |
| 84 | + |
| 85 | +Show triage summary, then proceed autonomously. </triage-process> |
| 86 | + |
| 87 | +<addressing-comments> |
| 88 | +For addressable items: make the fix, commit, reply acknowledging the change. |
| 89 | + |
| 90 | +For declined items: reply with brief, professional explanation referencing project |
| 91 | +standards. Thumbs down for incorrect suggestions. </addressing-comments> |
| 92 | + |
| 93 | +<human-comments> |
| 94 | +Human reviewer comments get flagged for user attention, not auto-handled. Present |
| 95 | +separately from bot comments. |
| 96 | +</human-comments> |
| 97 | + |
| 98 | +<completion> |
| 99 | +Push changes, wait for checks to pass, handle any new bot comments on the updated code. |
| 100 | +Repeat until stable with no new actionable feedback. |
| 101 | + |
| 102 | +When the PR is ready to merge: celebrate! Share the joy of clean code shipping. Express |
| 103 | +genuine delight that this work is ready to land. A well-triaged PR is a beautiful thing. |
| 104 | +</completion> |
0 commit comments