agentleFS
bordenetbordenet/superpowers-plus/skills/engineering/pr-triage-gate/skill.md

pr-triage-gate

Skill8 starsChanged 6 months agoMITView on GitHub

Semantic redundancy gate -- before debugging CI or fixing any pull request, verify the PR's stated goals are not already on the target branch. Close obsolete PRs immediately rather than waste tokens on CI triage.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before debugging CI failures on any MR or PR — verifies the work isn't already on the target branch

    line 49
  2. Distinctive:

    When a PR appears stuck in CI and you're not sure if its changes are still needed

    line 50
  3. Distinctive:

    Before spending time cherry-picking or rebasing an MR that may be obsolete

    line 51
  4. Very specific:

    Every subsequent step compares HEAD against the target.

    line 59
  5. Very specific:

    If your remote is GitLab, use glab instead.

    line 79
  6. Distinctive:

    Do NOT open CI logs before completing Steps 1-3

    line 118
  7. Distinctive:

    Do NOT retry pipelines before completing Steps 1-3

    line 119
  8. Distinctive:

    Do NOT fix test failures before verifying the PR is still needed

    line 120
  9. Distinctive:

    Do NOT rebase or squash before verifying the PR is still needed

    line 121

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

PR Triage Gate

Purpose: Before touching CI logs or fixing test failures on any PR, answer: "Does the target branch already have this?"

Why this exists: A PR whose stated features are already on the target branch is a no-op; every minute spent debugging its CI is wasted. A two-command check at the start catches this before the debugging loop starts.

Announce at start: "I'm using the pr-triage-gate skill to verify this PR is still needed before debugging CI."

When to Use

  • Before debugging CI failures on any MR or PR — verifies the work isn't already on the target branch
  • When a PR appears stuck in CI and you're not sure if its changes are still needed
  • Before spending time cherry-picking or rebasing an MR that may be obsolete

NOT when: you created the branch yourself in the current session and know it contains fresh work.

MANDATORY -- Run before any CI debug work

Step 0: Check out the PR branch so HEAD is the PR tip (10 seconds)

Every subsequent step compares HEAD against the target. If HEAD is on an unrelated branch, Step 2 silently produces a false verdict. Pin HEAD first:

# GitHub (substitute the PR number):
gh pr checkout "$PR_NUMBER"
# GitLab (substitute the MR internal ID):
glab mr checkout "$MR_IID"

Step 1: Read the PR description (30 seconds)

Both branches emit the same JSON schema so downstream steps do not fork on remote type.

GitHub via gh:

gh pr view "$PR_NUMBER" --json title,baseRefName,body \
  --jq '{title,target:.baseRefName,description:.body}'

If your remote is GitLab, use glab instead. The project path must be URL-encoded even when it contains nested groups (group/subgroup/repo):

PROJECT="$(git remote get-url origin \
  | sed -E 's#^(git@[^:]+:|https?://[^/]+/)##; s#\.git$##' \
  | sed 's#/#%2F#g')"
glab api "projects/${PROJECT}/merge_requests/${MR_IID}" \
  --jq '{title,target:.target_branch,description}'

If the API call fails or returns an error, STOP and report -- do not guess at PR goals.

Extract the stated goals: what functions, flags, or behaviors does this PR claim to add or change?

Step 2: Check if the target branch already has each stated goal (60 seconds)

Fetch the target once, then run the single most relevant check per stated goal:

git fetch origin <target-branch>

# For each stated goal:
git show origin/<target-branch>:<file> | grep -n "<function-name>"        # does the function exist on target?
git show origin/<target-branch>:<file> | grep -n "<flag-or-default>"      # is the flag or default present?
git diff origin/<target-branch>..HEAD -- <file> | wc -l                   # how much does the file actually differ?

If git show fails (file does not exist on the target), that stated goal is genuinely new -- note it and continue.

Step 3: Verdict

FindingAction
All stated goals already on targetClose the PR immediately. gh pr close <number> (or glab mr close <iid>)
Some goals already on targetStrip redundant commits, keep only novel changes
No goals on targetProceed to CI debug -- move on to systematic-debugging and the review battery

FORBIDDEN

  • Do NOT open CI logs before completing Steps 1-3
  • Do NOT retry pipelines before completing Steps 1-3
  • Do NOT fix test failures before verifying the PR is still needed
  • Do NOT rebase or squash before verifying the PR is still needed

Failure modes

FailureSymptomFix
Skipped Step 1Debugging starts with CI logsClose current investigation, restart at Step 1
Vague stated goalsPR body is empty or hand-waveyRead the commit messages instead; if still vague, ask the author
False negative on Step 2grep misses a rename or refactorWiden the search to a fuzzy identifier; if still ambiguous, compare with git log --oneline origin/<target-branch> -- <file>
Target branch has driftedLocal target is stalegit fetch origin <target-branch> before each check

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.