/pr-triage)
Quick Start
# Triage the active PR for a target repository checkout or worktree:
kscripts pr-triage --dir /path/to/target-repository [--pr 123]
# Reply to a comment and resolve a review thread:
kscripts pr-triage resolve --dir /path/to/target-repository <thread_id> [<comment_id> "<reply_body>"]
# Post an optional top-level reply, optionally dismiss a stale CHANGES_REQUESTED review, and re-request review:
kscripts pr-triage re-request --dir /path/to/target-repository <reviewer_login> [--comment "<reply_body>"] [--dismiss <review_database_id> -m "<reason>"]
When to use this skill
- Use when asked to address review comments, pull request feedback, merge
conflicts, or failing CI/CD runs on a GitHub pull request in an interactive,
single-pass manner (
"look at comments on my PR","address reviews","fix the build/checks").
🧠 Critical Mindset: Reviewer Feedback is NOT Gospel
- Reviewers make mistakes: Do NOT assume any reviewer — whether an AI bot (Gemini Code Assist, Copilot) or a human engineer — is infallible.
- Treat Severity Badges as Unverified External Claims: Bot tags
(
![critical],![security-high]) are unverified external claims, NOT compiler diagnostics. - Mandatory Pre-Edit Empirical Verification Gate: Before editing code for
any comment claiming a syntax error, compilation failure, or type issue, run
dart analyzeon the unmodified existing codebase first. Ifdart analyzereturns 0 issues, classify the item as👎 Disagree (Hallucinated Syntax/Compile Error)and make NO code changes. - You are free to disagree: Always test claims empirically (
dart analyze,dart test). If a suggestion introduces regressions or the current code is already optimal, mark it👎 Disagreewith technical rationale.
How to use this skill (The Workflow)
- NEVER GUESS Target PR or Branch: If the target PR/branch is not provided
and the workspace is on
main/master, detachedHEAD, or matches multiple open PRs, STOP and ask the user viaask_questionor chat.
-
Run
kscripts pr-triage:kscripts pr-triage --dir <path-to-target-repository> [--pr <pr-number-or-url>]Save the exact, untruncated stdout as
raw_triage_output.mdin the conversation artifact directory (preserving theReviewer Dropped from Queuebanner and all review/thread IDs). -
Verify Workspace & Mergeable State:
- Confirm local branch matches
headRefName. IfSync Statusisbehind_remote, rungit pull; ifahead_of_remoteordiverged, sync before editing code. - If
MergeableisCONFLICTING(DIRTY), treat merge conflicts as a🔥 Urgentblocker inpr_triage_report.mdand resolve via a forward merge commit (git fetch origin <baseRefName> && git merge origin/<baseRefName>), nevergit rebase. When committing a monorepo merge withgit commit --no-verify(to avoid reformatting unrelated upstream files), explicitly rundart formaton only the PR's touched.dartfiles before committing or pushing.
- Confirm local branch matches
-
Analyze Open Comments:
- Inspect unresolved review threads, top-level reviews, and general PR comments. Ignore resolved threads and self-authored comments unless they provide context.
-
Analyze CI Status & Failures:
- Active/Pending CI Hard Block: If any CI status checks are currently
running or pending, call
ask_question:- Option 1:
(Recommended) Proceed with triaging open comments now - Option 2:
Wait for active CI status checks to complete firstMANDATORY HARD BLOCK: Halt execution after callingask_question. Do NOT proceed to Step 5 or createpr_triage_report.mduntil the user responds.
- Option 1:
ACTION_REQUIREDChecks: DistinguishACTION_REQUIREDchecks from test failures. Because pushing a commit resetsACTION_REQUIREDchecks, only trigger/approve them after all code commits are pushed (or when no code changes are needed).
- Active/Pending CI Hard Block: If any CI status checks are currently
running or pending, call
-
Generate a Triage Report (
pr_triage_report.md) & Log Review Escapes:- Create
pr_triage_report.md(RequestFeedback: false,UserFacing: trueinArtifactMetadata) following the artifact skeleton inreferences/graphql_and_templates.md. - Link to
raw_triage_output.mdat the top and group related comments/CI failures into cohesive action items containing:- Summary & Link: Descriptive link with number and
@reviewer_username. - Identifiers: Preserve
Thread ID(PRRT_...),Comment ID, orReview ID(PRR_...) + numericDatabase ID. - Agent Assessment: Agreement Level (
🔥 Urgent [Valid — Fix],👍 Solid [Valid — Fix],🤷 Meh, or👎 Disagree), Empirical Verification output, and Rationale. - Planned Action & 2-Bucket TDD Filter: Target file/line changes plus
either a Companion Test (
test/..._test.dartfor bug fixes, edge cases, or behavior changes) or Explicit Skip (None — <reason>) for copy/comment/rename or behavior-preserving refactors.
- Summary & Link: Descriptive link with number and
- Wire
[Valid — Fix]Findings to/sharpen-later(--cat=review-escape,FU4): Whenever a reviewer comment or thread is classified as[Valid — Fix](a real bug, missing edge case, API leak, or convention violation that escaped local pre-review) and/sharpen-lateris available, record it with--cat=review-escapeand--agent-note "<owner>/<repo>#<PR>: <why local pre-review missed it>".
- Create
-
Interactive Approval Gate (
ask_question):- Immediately after writing
pr_triage_report.md, callask_questionto gate implementation (seereferences/graphql_and_templates.md):- Option 1:
(Recommended) Implement the proposed fixes and test plan - Option 2:
Adjust the triage plan first - Option 3:
Do not edit files (keep triage report only)
- Option 1:
- DO NOT edit repository files until the user approves via
ask_question.
- Immediately after writing
-
Surgical Implementation & Verification (Red-Green TDD):
- Test First (Red) -> Implementation (Green): Write approved companion
tests in
test/first and verify failure on unpatched code, then apply the fix and rundart format(explicitly targeting touched.dartfiles when hooks or--no-verifyare used),dart analyze, anddart test. - Sync PR Title & Description: If public APIs or architecture changed,
update via
cat << 'EOF' | gh pr edit <pr> --title "..." --body-file -. - Live Read-Only Smoke Check: Auto-run side-effect-free CLI paths
(
--help,--dry-run,status/list/view) when<= 15sand~0risk; offer in Step 8 when> 15s.
- Test First (Red) -> Implementation (Green): Write approved companion
tests in
-
Verify Git State and Offer Unified Resolution Menu:
- Run
git status -s --untracked=noand present the unifiedask_questioncompletion menu fromreferences/graphql_and_templates.md(including"dismiss stale CHANGES_REQUESTED review"whenever an openCHANGES_REQUESTEDreview was fully addressed).
- Run
Replying, Resolving Threads, and Re-Requesting Review
See references/graphql_and_templates.md
for full kscripts pr-triage resolve / re-request syntax, GitHub
state-machine notes, and underlying GraphQL/REST schemas.
- Never Re-Request an Active
APPROVEDReviewer:--add-reviewerrevokes active approvals. Runkscripts pr-triage re-requestONLY when ALL 3 hold:- The human reviewer is not currently listed in
reviewRequests, AND - Their latest state in
latestReviewsis NOT"APPROVED"(COMMENTED,CHANGES_REQUESTED, orDISMISSED), AND - Commits were pushed or replies posted addressing their feedback.
- The human reviewer is not currently listed in
- Re-Request After
dismiss_stale_reviewsAuto-Dismisses an Approval: In repositories withdismiss_stale_reviewsenabled (such asflutter/flutter), pushing new commits automatically transitions a prior"APPROVED"review to"DISMISSED"and removes the reviewer fromreviewRequests. Always checkgh pr view <pr_number> -R <owner/repo> --json reviewDecision,latestReviews,reviewRequestsaftergit pushand re-request any reviewer whose approval was dismissed viakscripts pr-triage re-request --dir <repo-path> <reviewer_login>. - Stop When Already Queued: If
<login>is already inreviewRequestsand all feedback is addressed on the latest commit, STOP.
Constraints
- Hard CI Gate: Never generate
pr_triage_report.mdwhile CI is pending without first halting on Step 4'sask_question. - Pre-Edit Approval Gate: Never modify repository files before user approval
of
pr_triage_report.md. - Single-Gate VCS Execution: Selecting a commit/push option in Step 8's
ask_questionauthorizes committing and pushing without a second prompt. - Sync Code Before Comments: Never post "Fixed" replies or resolve threads while code fixes remain uncommitted or unpushed.
- Prohibitions: Never run
git commit --amendorgit push --force/--force-with-lease. Always usekscripts pr-triageover manual API calls.