Revue de Pull Request

VérifiéPrudence

Adjudique une pull request en tant que mainteneur. Lit le commentaire épinglé du CI, rafraîchit si obsolète, et permet d'approuver, demander des modifications, ou fusionner.

Spar Skills Guide Bot
DeveloppementAvancé
05/08/2026
Claude Code
#pr-review#code-review#maintainer-workflow#github-cli#ci-integration

Recommandé pour

Synthèse automatique

Ce skill ajoute une couche d'arbitrage mainteneur au-dessus du pipeline de revue CI : il lit le commentaire de revue épinglé, vérifie sa fraîcheur par rapport au SHA de tête, puis guide le mainteneur dans un flux interactif approuver / demander des modifications / modifier / fermer, avec fusion automatique optionnelle.

Points forts

  • Détecte le type de contributeur (bot/interne/externe) et ajuste le ton et les valeurs par défaut de fusion via l'axe de confiance d'étiquette
  • Contrôle de fraîcheur par SHA sentinelle qui rattrape les cas où le label mark-stale n'a pas été déclenché (agent Copilot, commits via GITHUB_TOKEN)
  • Déroulé explicite en 10 étapes avec sortie silencieuse sur les étapes de collecte, ce qui limite le bruit avant le rapport unifié
  • Gère tous les types de PR, y compris externes et bots, avec un indicateur AI-suspect forçable via --ai/--no-ai

Limites

  • Dépend fortement de scripts externes (.claude/commands/pr-review/scripts/, docs-review/scripts/) et du workflow claude-code-review.yml, non fournis dans le SKILL.md
  • Suppose un dépôt GitHub et gh CLI authentifié ; inutilisable sur GitLab, Bitbucket ou un fork sans le pipeline de revue CI
  • Le document est tronqué à l'étape 3, donc la table des états et la suite du processus ne sont pas entièrement vérifiables
Quand l'utiliser

À utiliser lorsqu'un mainteneur doit trancher sur une pull request déjà passée par le pipeline de revue CI et veut un paquet de décision unifié plutôt qu'une lecture manuelle des commentaires.

Quand l'éviter

À ne pas utiliser sur un dépôt sans le workflow claude-code-review.yml ni les scripts associés, ou lorsque la revue doit être entièrement manuelle sans couche d'arbitrage automatisée.

Analyse de sécurité

Prudence
Score qualité88/100

The skill uses bash and network tools for a legitimate maintainer workflow: reading PR metadata, fetching pinned CI review comments, and refreshing reviews. No destructive commands, secret exfiltration, or obfuscation are present. However, it relies on repo-local shell scripts and GitHub CLI actions, so it warrants caution rather than a fully safe rating.

Points d'attention
  • •Executes multiple shell scripts via bash (contributor-detection.sh, pinned-comment.sh, local update procedure) without showing their contents.
  • •Uses GitHub CLI and network operations to fetch PR data, diff, and comments, which is legitimate but powerful.
  • •No declared allowed-tools, yet the skill instructs running bash and gh commands.
Comment cette analyse est faite

Exemples

Review the PR for the current branch
/pr-review
Review a specific PR with AI-suspect forced off
/pr-review 20556 --no-ai
Adjudicate an external contributor's PR
/pr-review 4412 --ai

name: pr-review description: Adjudicate a pull request as a maintainer. Reads the CI-posted pinned review as the source of truth, refreshes it if stale, and provides an interactive workflow to approve / request changes / make changes / close — with optional auto-merge.

Pull Request Review Command

This is the maintainer adjudication layer on top of the CI review pipeline (claude-code-review.yml posts a pinned <!-- CLAUDE_REVIEW N/M --> comment with all findings; this skill reads it as the source of truth).

Usage

/pr-review [<PR_NUMBER>] [--ai|--no-ai]

  • PR number: Optional. If omitted, the workflow infers from the current branch via gh pr view --json number. Errors out if no PR is open for the branch.
  • --ai / --no-ai: force AI-suspect ON or OFF for this run.

Works with all PRs (internal, external, bots).


Process

Complete all 10 steps in sequence. Display [Step X/10] before each step heading.

Steps 1, 2, 3, 5 are silent — no user-facing output. Step 4 is interactive only when the PR has infra changes. Step 6 is the first comprehensive output.


Step 1: Detect contributor, trust axes, risk tier, and AI-suspect

If {{arg}} is empty, infer the PR from the current branch:

gh pr view --json number --jq '.number'

If that fails, abort with a clear error asking for an explicit PR number. Otherwise use the inferred number as PR_NUMBER for every {{arg}} reference below.

Run contributor detection:

bash .claude/commands/pr-review/scripts/contributor-detection.sh $PR_NUMBER [--ai|--no-ai]

The script outputs:

  • AUTHOR — GitHub username
  • CONTRIBUTOR_TYPE — bot/internal/external
  • ETIQUETTE_TRUST — low/standard/high (controls tone, welcome language, merge defaults)
  • CONTENT_SCRUTINY — standard/heightened
  • AI_SUSPECT — true/false
  • AI_SUSPECT_REASONS — comma-separated triggers
  • RISK_TIER — typo/minor/standard/major/infra
  • PR_METADATA — JSON with number, title, url
  • FILES_CHANGED — list of changed file paths
  • LABELS — comma-separated current labels (drives Step 2's pinned-review state machine)
  • PR_DATA_JSON — complete PR data

Store all of these. No user output yet. Step 6 surfaces them in the unified package.

See pr-review:references:trust-and-scrutiny.

Step 2: Fetch the pinned CI review and classify state

Fetch the diff and the pinned review:

gh pr diff "$PR_NUMBER"

bash .claude/commands/docs-review/scripts/pinned-comment.sh fetch --pr "$PR_NUMBER"

Determine the pinned-review state from labels and fetch output. Labels alone are not a sufficient freshness signal: pushes made by the Copilot coding agent or with GITHUB_TOKEN never fire the pull_request: synchronize event, so the mark-stale job never runs for them and a PR can sit at review:no-blockers while the pinned review describes content a later commit replaced (PR #20556). Before accepting CURRENT, run the SHA freshness check:

HEAD_SHA=$(gh pr view "$PR_NUMBER" --json headRefOid --jq .headRefOid)
# Preferred: the machine-readable sentinel compose-review.py stamps under the header.
REVIEWED_SHA=$(bash .claude/commands/docs-review/scripts/pinned-comment.sh fetch --pr "$PR_NUMBER" \
  | grep -oE '<!-- CLAUDE_REVIEW_HEAD [0-9a-f]+ -->' | tail -1 | grep -oE '[0-9a-f]{7,40}')
# Fallback for reviews composed before the sentinel existed:
[ -z "$REVIEWED_SHA" ] && REVIEWED_SHA=$(bash .claude/commands/docs-review/scripts/pinned-comment.sh last-reviewed-sha --pr "$PR_NUMBER")

If REVIEWED_SHA is non-empty and is not a prefix-match of HEAD_SHA, treat the state as STALE regardless of labels (and mention in your output that the label missed a push — likely a suppressed synchronize event). If no reviewed SHA is recoverable at all, fall back to comparing the header's Last updated timestamp against the head commit's committer date; when the head commit is newer, treat as STALE.

| State | Detection | What Step 3 does | |---|---|---| | CURRENT | review:outstanding-issues or review:no-blockers set; review:stale / review:in-progress / review:error absent; fetch returns body; SHA freshness check passes | Nothing — proceed to Step 4 | | STALE | review:stale set | Refresh in place by invoking docs-review:references:update locally (re-runs claim verification against new commits, then writes via pinned-comment.sh upsert) | | IN_PROGRESS | review:in-progress set | Wait briefly for the workflow to finish; re-check labels. If it stays >15 min, treat as ERROR. | | ERROR | review:error set (or review:in-progress stuck) | Investigate the Actions logs before proceeding | | ABSENT | Fetch returns no <!-- CLAUDE_REVIEW --> markers | Fall back: run a local review (see Step 3 §Absent path) |

Store the parsed pinned-comment findings (🚨 Outstanding, ⚠️ Low-confidence, 💡 Pre-existing, ✅ Resolved, 📜 Review history) for Step 6.

Step 3: Resolve pinned-review state

Branch on the state from Step 2.

CURRENT

Continue to Step 4.

STALE

Refresh the pinned comment in place by invoking docs-review:references:update locally with PR_NUMBER set. The update procedure re-reads the diff since the last reviewed SHA, classifies as Case 1/2/3, and writes the refreshed body via pinned-comment.sh upsert. When it completes, re-fetch the pinned comment and re-parse findings for Step 6.

ABSENT

No pinned comment exists. This typically means: the PR is a draft (CI doesn't review drafts), CI failed, or the review:trivial short-circuit fired. Ask the user how to proceed via AskUserQuestion:

  1. Run a local review now — perform a full local style + code review (apply /docs-review). Use the findings as the pinned-review findings for Step 6.
  2. Adjudicate without findings — proceed to Step 6 with no findings; rely on your own diff read and the contributor's PR description.
  3. Cancel — exit; consider transitioning the PR to ready-for-review to trigger CI, or mention @claude to invoke a fresh review.

Only the local-review path produces findings; otherwise Step 6 renders an empty findings block.

Step 4: Offer infrastructure deployment (only fires for infra changes)

If RISK_TIER=infra (PR contains dependency or infrastructure changes), follow pr-review:references:infrastructure-deployment to optionally trigger a pulumi-test.io deployment. This is the only step before Step 6 that produces user-facing output. For other risk tiers, skip silently.

Step 5: PR description accuracy check (silent)

CI doesn't check this; pr-review does. Compare the PR description against the actual diff. Inaccuracies — files mentioned that weren't changed, changes described that aren't in the diff, significant changes omitted, incorrect characterization — are trivial-fix candidates that can be applied via gh pr edit --body in Step 9 if the user picks Make-changes-and-approve and doesn't veto them.

For each inaccuracy, draft a corrected description that accurately reflects the diff. Store for Step 6 + Step 9.

Step 6: Present unified review package

This is the first big user-facing output. Render in this order, top to bottom:

  1. Confidence gauge — single line:

    Confidence: HIGH · 0 outstanding · 2 low-confidence · contributor: @user (internal) · risk: minor · CI: green · pinned: current
    

    Or, when AI-suspect:

    Confidence: MEDIUM · 🤖 AI-suspect (allowlist + trailer:claude) · scrutiny: heightened · 2 outstanding · 1 low-confidence · CI: green · pinned: refreshed
    

    Computation:

    | Gauge | When | |---|---| | HIGH | No 🚨 Outstanding findings, CI green, scrutiny standard, pinned current/refreshed | | MEDIUM | Any ⚠️ Low-confidence findings, OR scrutiny heightened (always caps at MEDIUM), OR CI yellow, OR pinned absent | | LOW | Any 🚨 Outstanding finding, OR CI red |

  2. Header — PR title, contributor with etiquette icon (🤖 / 📝 / 🌍), risk tier badge, pinned-review state, deployment URL (or "pending"). Run test-deployment-guidance.sh here to fetch the deployment URL and per-page links:

    bash .claude/commands/pr-review/scripts/test-deployment-guidance.sh {{arg}}
    
  3. Per-page review links — direct links + change-aware specific review items from test-deployment-guidance.sh output.

  4. Pinned review findings — render the parsed 🚨 Outstanding, ⚠️ Low-confidence, 💡 Pre-existing, and ✅ Resolved findings from Step 2 verbatim (they're already in the format from docs-review:references:output-format). If a refresh ran in Step 3, note "Pinned comment refreshed at HH:MM" above the findings block. If absent and the user picked local review in Step 3, render those findings here in the same format.

  5. PR description inaccuracies (only if Step 5 found any) — itemized so the user can see exactly what would change before Step 8 confirmation:

    PR description corrections (2):
      [1] Says "updates content/blog/foo.md" but foo.md was not changed
      [2] Omits significant change: content/docs/bar.md was renamed
    

    Each item gets a numeric index for veto in Step 8.

  6. Trivial-fix candidates (only if any) — applied via Make-changes-and-approve per pr-review:references:action-preview-templates. Suppressed when AI-suspect; see action-preview-templates §AI-suspect override.

  7. Overall assessment — single line: Clean / Minor issues / Issues found / Critical issues. Computed from the pinned 🚨 Outstanding count and any code-correctness findings. Pre-existing alone does not gate approval.

  8. Recommendations — short, action-oriented. Map directly to a Step 7 menu (e.g., "→ Approve" or "→ Make changes and approve").

Render the whole package in one message.

Step 7: Present action menu

Use AskUserQuestion. Adaptive-scenario selection (which menu fires for which finding shape) and per-scenario options live in pr-review:references:action-menus. The Step 7 menu chooses what to do; auto-merge is decided in Step 8 via the merge toggle, never as a Step 7 option.

Step 8: Preview action and confirm (with merge toggle)

See pr-review:references:action-preview-templates.

The preview shows:

  • Chosen action
  • Auto-merge toggle with computed default (per the toggle defaults in pr-review:references:action-preview-templates)
  • For Make-changes-and-approve: file-by-file changes (PR description corrections + trivial fixes + suggested fixes from CI's pinned findings)
  • The exact comment text that will be posted (using pr-review:references:message-templates)
  • The full list of gh commands that will run

The posted comment must obey the voice/length rules in pr-review:references:message-templates. Step 6's local package is for the maintainer's eyes; the public maintainer comment is its own thing.

Confirmation-menu adaptation (slot 2 changes per pending action; dispute-path opt-in is described below) lives in pr-review:references:action-preview-templates §Confirmation Question.

Dispute path (opt-in)

When the user picks "Dispute finding(s)", AskUserQuestion prompts for the finding number(s) and the dispute reasoning. pr-review composes a mention body in this shape:

[Maintainer dispute from @{{user}}]

Finding {{N}} (in {{file:line}}, {{summary}}): {{reasoning}}

Adjudicate per Case 2 dispute rules.

The body is fed to docs-review:references:update locally with MENTION_BODY populated. Update.md Case 2 takes over: classifies the dispute (domain-knowledge / verifiable / reframing), concedes or holds with citation, and re-renders the pinned comment via pinned-comment.sh upsert. Re-fetch the pinned comment afterwards so the Step 6 view reflects the resolution before the action proceeds.

Maintainer write-access is sufficient evidence for domain-knowledge disputes (per docs-review:references:update Case 2).

Step 9: Execute confirmed action

Execute per the commands and workflow in pr-review:references:action-preview-templates, using the merge-toggle state confirmed in Step 8. For Make-changes-and-approve failures: always return to original branch before reporting error.

Step 10: Report execution results

See pr-review:references:execution-results.

Workflow complete.


Error Recovery

If any command fails during execution:

❌ Failed to [action] PR #{{arg}}

Error: [error message]

Recovery options:
- /pr-review {{arg}} (re-run full workflow)
- Or use gh CLI directly: [relevant commands based on failure]

For Make-changes-and-approve failures: always return to original branch before reporting error.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/pull-request-review-msfn19l2/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/pull-request-review-msfn19l2' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/pull-request-review-msfn19l2/download' --output '.skill-downloads/pull-request-review-msfn19l2/SKILL.md.part' && mv '.skill-downloads/pull-request-review-msfn19l2/SKILL.md.part' '.skill-downloads/pull-request-review-msfn19l2/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/pull-request-review-msfn19l2/SKILL.md' && test -s '.skill-downloads/pull-request-review-msfn19l2/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/pr-review' && cp -R '.skill-downloads/pull-request-review-msfn19l2' '.claude/skills/pr-review'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/pull-request-review-msfn19l2'

openskills read 'pull-request-review-msfn19l2'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/pull-request-review-msfn19l2/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires