Examen et fusion de pull requests

VérifiéPrudence

Examine les PR en tant que mainteneur : détecte le type de contributeur, adapte le ton, puis guide l'approbation, la fusion ou les changements.

Spar Skills Guide Bot
DeveloppementIntermédiaire
06/09/2026
Claude Code
#pull-request#code-review#github#maintainer-workflow#merge

Recommandé pour

Synthèse automatique

Cette commande guide une revue complète de pull request par un mainteneur, de la détection du contributeur jusqu'à l'approbation, la demande de modifications, la fusion ou la fermeture.

Points forts

  • Enchaînement structuré en 10 étapes avec compteur de progression affiché à chaque étape
  • Détection automatique du type de contributeur (bot, interne, externe) et adaptation du ton du message
  • Récupération du diff et du contexte via gh, puis catégorisation des fichiers modifiés
  • Fournit un lien de prévisualisation de déploiement et des consignes de revue concrètes avant l'analyse

Limites

  • Dépend de scripts bash présents dans .claude/commands/pr-review/ et d'une authentification gh opérationnelle
  • Suppose l'existence d'un déploiement de prévisualisation, absent pour les PR purement métadonnées
  • Workflow long et impératif : les 10 étapes sont déclarées obligatoires, peu de flexibilité pour une revue rapide
Quand l'utiliser

À utiliser lorsqu'en tant que mainteneur vous devez examiner une pull request et décider de l'approuver, demander des changements, la fusionner ou la fermer.

Quand l'éviter

À éviter pour une simple lecture de diff sans intention d'action, ou dans un dépôt sans gh CLI configuré ni scripts de revue associés.

Analyse de sécurité

Prudence
Score qualité82/100

The skill orchestrates a legitimate PR review workflow using bash and gh for viewing diffs, posting comments, and merging. It does not contain destructive or exfiltration instructions, but the execution of unverified local shell scripts and GitHub CLI actions warrants caution.

Points d'attention
  • •Instructs execution of bash scripts and gh CLI commands to fetch PR data, review diffs, and perform merge/close actions.
  • •Relies on repository-local shell scripts whose contents are not provided or audited in this skill file.
  • •Declares no allowed-tools, yet the workflow assumes the ability to run bash and gh commands.
Comment cette analyse est faite

Exemples

Review a specific PR
/pr-review 1284
Review and merge if clean
Review PR #902 as a maintainer, check the code quality and metadata, and merge it if everything looks good.
Review an external contribution
Can you review pull request 317? It's from an outside contributor, so request changes with a welcoming tone if the CI workflow edits look off.

description: Review and approve/merge pull requests as a maintainer (full workflow with approve, request changes, merge, close actions)

Pull Request Review Command

Use this when: You're reviewing someone's pull request as a maintainer and need to approve, request changes, merge, or close it.

Performs comprehensive review with code quality and metadata checks, then provides an interactive workflow for approval actions. Automatically detects contributor type (internal/external/bot) and adapts communication tone (warm/welcoming for external, professional for internal, technical/professional for bots).


Usage

/pr-review <PR_NUMBER>

Reviews any pull request and presents action choices for approval, changes, or closure.

Required: PR number

Works with: All PRs (internal, external, and bots)

Special handling: Automatically detects contributor type and adapts messaging (warm for external, professional for internal, technical for bots). Default "Approve and merge" for pulumi-bot metadata PRs.


Process

CRITICAL SUCCESS CRITERIA: Complete all 10 steps in sequence. Every step is mandatory and serves a critical purpose in the review workflow. DO NOT SKIP ANY STEP OR END THE WORKFLOW PREMATURELY!

Step Counter: Display progress before each step as: [Step X/10] followed by the step heading. This helps users track progress through the workflow.

References: Always follow the detailed instructions in the referenced documents for each step. The references contain the complete implementation details required.


Step 1: Verify PR and Detect Contributor Type

  1. Run the contributor detection script:

    bash .claude/commands/pr-review/scripts/contributor-detection.sh {{arg}}
    

    The script outputs:

    • AUTHOR - GitHub username
    • CONTRIBUTOR_TYPE - bot/internal/external
    • PR_METADATA - JSON with number, title, url
    • FILES_CHANGED - List of changed file paths
    • PR_DATA_JSON - Complete PR data for caching

    After running the script, store the following for later steps:

    • PR data (in PR_DATA variable for use in later steps)
    • Contributor type (bot/internal/external)
    • File paths (displayed for Step 4 reference)
  2. Critical! Display this output to the user immediately:

    ## Contributor Detection
    
    [icon] Reviewing PR #{{arg}} from @username ([type] contributor)
    

    Icons:

    • 🤖 for bot account
    • 📝 for internal contributors
    • 🌍 for external contributors

Continue to Step 2.

Step 2: Gather PR Diff

  1. View the full PR context: gh pr view {{arg}}
  2. Get the diff: gh pr diff {{arg}}
  3. Note the PR title, description, files changed, additions/deletions, and labels

Continue to Step 3.

Step 3: Present Test Deployment and Review Guidance

CRITICAL: This step must be completed and presented to the user IMMEDIATELY after Step 2 and BEFORE starting Step 4. Do not delay this output.

  1. Run the test deployment guidance script:

    bash .claude/commands/pr-review/scripts/test-deployment-guidance.sh {{arg}}
    

    The script outputs JSON with:

    • prNumber - The pull request number
    • deploymentUrl - The preview deployment URL or null
    • deploymentStatus - "ready" or "pending"
    • isAutomationPR - Whether the PR was opened by an automation bot
    • fileCategories - Categorized changed files
  2. Parse the JSON output and analyze the PR diff context to understand what changed.

  3. Critical! Present deployment review with context-aware guidance to the user immediately:

    • Show preview URL (or "No preview available" for metadata-only PRs)
    • Categorize changed files by type (Package YAML, Go tools, CI workflows, Build scripts, Infrastructure, Theme/layout, Community packages)
    • Generate concrete, actionable review guidance based on actual diff content

    This allows users to review the deployment while you perform the comprehensive analysis in Step 5.

Only after displaying output from this step, continue to Step 4.

Step 4: Check for Infrastructure Changes

Check if PR contains infrastructure or CI/CD changes:

  • Files in infrastructure/
  • Files in .github/workflows/
  • Changes to Makefile or scripts/ci/
  • Changes to origin-bucket-metadata.json

If infrastructure changes detected, flag for careful review and note potential production impact.

Only after displaying output from this step, continue to Step 5.

Step 5: Perform Comprehensive Review

Review all files against registry review criteria: Go code quality, YAML validity, CI workflow correctness, build system compatibility, infrastructure safety, BUILD-AND-DEPLOY.md currency, community package list integrity, and general spelling/grammar/links. See _common:review-criteria for full criteria.

Large diffs (>100 lines): Summarize findings by category rather than line-by-line.

Continue to Step 6.

Step 6: Summarize Review Findings

Present review results in terminal-friendly format:

## Review Summary

**Overall Assessment**: [Clean/Minor issues/Issues found/Critical issues]

### Findings

**[Category]**: [Brief summary]
- Line X: [Issue description]
- Line Y: [Issue description]

### Recommendations

[Specific recommendations based on findings]

Continue to Step 7.

Step 7: Present Action Menu

Use AskUserQuestion (max 4 options) to present the appropriate action menu based on contributor type (bot vs non-bot) and review findings.

See pr-review:references:action-menus for complete menu structures and logic.

Continue to Step 8 with selected action.

Step 8: Preview Planned Actions and Get Confirmation

CRITICAL: Always show what will happen before executing.

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

Display preview showing:

  • Exact comment text that will be posted (using templates from pr-review:references:message-templates)
  • Commands that will be executed
  • For "Make changes and approve": Show file-by-file changes

Confirmation options (use AskUserQuestion):

  1. Yes, proceed - Execute as previewed
  2. Edit comment - Modify comment text
  3. Change action - Return to Step 7
  4. Cancel - Exit without changes

Handle each response appropriately:

  • Edit comment → Show updated preview → Confirm again
  • Change action → Return to action menu (Step 7)
  • Cancel → Exit with "No action taken"

Continue to Step 9 with confirmed action.

Step 9: Execute Confirmed Action

Execute using confirmed/edited content from Step 8.

Commands by action:

  • Approve: gh pr review {{arg}} --approve --body "{{COMMENT}}"
  • Approve and merge: gh pr review {{arg}} --approve --body "{{COMMENT}}" then gh pr merge {{arg}} --auto --squash
  • Request changes: gh pr review {{arg}} --request-changes --body "{{COMMENT}}"
  • Close PR: gh pr comment {{arg}} --body "{{COMMENT}}" then gh pr close {{arg}}
  • Do nothing yet: Exit with message

Make changes and approve: See pr-review:references:action-preview-templates for complete workflow.

Continue to Step 10.

Step 10: Report Execution Results

See pr-review:references:execution-results for result message templates.

Display appropriate success message with:

  • Confirmation of action taken
  • PR URL for easy access
  • Additional context (bot info, risk tier, deployment warnings)
  • Verification commands where helpful

Workflow complete.


Critical Workflow Rules

  1. Complete all 10 steps in sequence - Never skip steps or end workflow prematurely
  2. Step 3 timing - Present test deployment guidance BEFORE starting comprehensive review (Step 5)
  3. Step 4 prerequisite - Must complete infrastructure check before Step 5
  4. Always preview before execution - Show exactly what will happen (Step 8) before executing (Step 9)
  5. Use confirmed content - Execute only with user-approved text from Step 8
  6. Track progress - Display [Step X/10] before each step heading
  7. Preserve branch safety - For "Make changes and approve": save current branch, return to it even on errors

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/review-and-merge-pull-requests-mtpag7d1/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/review-and-merge-pull-requests-mtpag7d1' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/review-and-merge-pull-requests-mtpag7d1/download' --output '.skill-downloads/review-and-merge-pull-requests-mtpag7d1/SKILL.md.part' && mv '.skill-downloads/review-and-merge-pull-requests-mtpag7d1/SKILL.md.part' '.skill-downloads/review-and-merge-pull-requests-mtpag7d1/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

Le fichier ne fournit pas un en-tête name/description exploitable pour cette procédure native. Le téléchargement reste disponible pour lecture ; utilisez le mode manuel ci-dessous.

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/review-and-merge-pull-requests-mtpag7d1/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