Examiner et résoudre les commentaires PR

VérifiéPrudence

Vérifie les commentaires de revue non résolus sur une PR, évalue chacun, applique les correctifs et résout les fils de discussion via l'API GitHub.

Spar Skills Guide Bot
DeveloppementIntermédiaire
22/07/2026
Claude CodeCursorCodex
#pull-request#code-review#github-cli#graphql#workflow

Recommandé pour

Synthèse automatique

Récupère les fils de discussion non résolus d'une pull request GitHub, évalue chaque commentaire, applique les correctifs nécessaires puis résout les threads via l'API GraphQL de GitHub.

Points forts

  • Utilise l'API GraphQL avec pagination plutôt que l'endpoint REST, dont la sortie peut être tronquée
  • Détecte automatiquement la PR depuis la branche courante et bascule de compte gh si le propriétaire du dépôt diffère de l'utilisateur actif
  • Relit le code au niveau de chaque ligne commentée et gère les threads obsolètes avant de décider
  • Trie les retours en trois catégories et demande l'avis de l'utilisateur quand la décision est réellement ambiguë

Limites

  • Suppose que gh est installé et authentifié avec des droits d'écriture sur le dépôt
  • Ne fonctionne que sur GitHub (pas de GitLab ni Bitbucket)
  • Résoudre un thread modifie l'état de la PR sur GitHub, et la skill ne décrit pas de vérification que les correctifs compilent ou passent les tests
Quand l'utiliser

À utiliser quand une PR GitHub accumule des commentaires de revue et qu'il faut les traiter puis clore les threads un par un.

Quand l'éviter

À ne pas utiliser pour rédiger une première revue de code, ni sur une plateforme autre que GitHub.

Analyse de sécurité

Prudence
Score qualité78/100

The skill uses powerful but legitimate tooling — the GitHub CLI, GraphQL mutations, git commit/push — to fix review comments on the user's own PR. There is no destructive filesystem action, no obfuscated payload, and no network exfiltration of secrets or tokens. The main risks are operational rather than malicious: it pushes commits and resolves/posts comments on a live PR without an explicit confirmation step, and its `gh auth switch` is only reverted on the success path, so a failure can leave the user's CLI pointed at another account. That warrants a caution rating rather than safe.

Points d'attention
  • •Runs `git push` to the remote without asking the user for confirmation (Step 6)
  • •Mutates global GitHub CLI auth state via `gh auth switch --user <OWNER>` and restores it only on the happy path — if any step fails mid-way the user is left on a different account
  • •Automatically resolves reviewer threads and posts reply comments on a real PR, which can silently dismiss a reviewer's concerns
  • •Assumes `gh` is authenticated with sufficient scope; no permission/safety check stated before mutating a live PR
Comment cette analyse est faite

Exemples

Address comments on a PR number
Address the review comments on PR #412 and resolve the threads you fix.
Auto-detect the PR for the current branch
Check the open comments on my PR and fix whatever still needs fixing.
Resolve threads from a URL
Resolve the review threads on https://github.com/acme/api/pull/88

name: review-pr-comments description: > Check a PR for unresolved review comments, assess each one, apply fixes where needed, and resolve addressed threads via the GitHub API. Use this skill whenever the user mentions PR comments, review threads, unresolved feedback, or addressing reviewer suggestions — even if they just say "fix the comments", "close out the review threads", or "address the feedback".

Review & Resolve PR Comments

Fetch every unresolved review thread on a PR, decide for each whether a code fix is needed, apply the fix (or confirm it's already done), then resolve the thread via gh GraphQL. Ask the user whenever a decision is genuinely ambiguous.

When to Use This Skill

  • User says "address the PR comments" or "fix the review comments"
  • User says "resolve comments on PR #N" or pastes a PR URL
  • User says "check the open comments on my PR"

Steps

Execute in order. Stop and report if any step fails.

Step 1: Identify the PR

If the user provided a PR number or URL, extract the number.

Otherwise, try to detect the PR automatically from the current branch/worktree:

gh pr view --json number,url,headRefName 2>/dev/null

If that returns a PR, use it and inform the user which PR was detected (number

  • title) before continuing.

If no PR is found automatically, ask:

Which PR number (or URL) should I review?

Derive OWNER, REPO, PR_NUMBER from the URL or from the current repo's git remote get-url origin. Handle both HTTPS (https://github.com/OWNER/REPO.git) and SSH (git@github.com:OWNER/REPO.git) remote formats.

Step 2: Switch gh to the repo owner account (if needed)

Extract the currently active GitHub username:

gh api user --jq '.login'

If that username does not match OWNER (derived in Step 1), switch:

gh auth switch --user <OWNER>

Note the original username so you can restore it at the end. Do NOT rely on gh auth status to determine the active user — its output format is harder to parse reliably. Use gh api user --jq '.login' instead.

Step 3: Fetch ALL unresolved review threads

Use the GitHub GraphQL API to get every thread — paginate if needed. The REST endpoint can truncate output; always use GraphQL:

gh api graphql -f query='
{
  repository(owner:"OWNER", name:"REPO") {
    pullRequest(number:PR_NUMBER) {
      reviewThreads(first:100) {
        nodes {
          id
          isResolved
          isOutdated
          comments(first:20) {
            nodes {
              databaseId
              path
              line
              body
            }
          }
        }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[]
         | select(.isResolved == false)
         | {
             threadId: .id,
             outdated: .isOutdated,
             commentId: .comments.nodes[0].databaseId,
             path: .comments.nodes[0].path,
             line: .comments.nodes[0].line,
             body: .comments.nodes[0].body
           }'

Record the full list. If there are zero unresolved threads, report that and stop.

Step 4: Read the current file for each thread

For every unresolved thread, read the relevant file at the commented line to understand the current state of the code:

  • If the thread is outdated (isOutdated: true), the code has already changed. Read the file to confirm the concern is addressed.
  • If the thread is not outdated (isOutdated: false), the commented line still exists. Read it and decide:
    • Is the issue already fixed (e.g. a test was added in a new file, or the change was applied elsewhere)?
    • Does it still need a fix?
    • Is the suggestion wrong / inapplicable (stale logic, wrong assumption)?

Step 5: Triage each thread

Categorise every thread into one of three buckets:

| Bucket | Meaning | Action | | ------------------ | ------------------------------------------------------------- | --------------------------------------- | | already-fixed | The code concern is addressed; comment is just not resolved | Resolve the thread, no code change | | needs-fix | The issue is real and present in the current code | Apply the fix, then resolve | | not-applicable | The suggestion is wrong, stale, or intentionally not followed | Post a reply explaining why, then resolve |

When in doubt, pause and ask the user before placing a thread in any bucket. Never silently skip a thread.

Step 6: Apply fixes

For threads in the needs-fix bucket:

  1. Make the minimal correct change to the file.
  2. Build and run tests using the project's standard commands (e.g. pnpm build and pnpm vitest run for pnpm projects; npm test or yarn test for others — check package.json scripts if unsure) to confirm nothing breaks.
  3. If tests fail, fix them or pause and ask the user.
  4. Commit the fix:
git add <files>
git commit -m "fix: <short description of what was fixed>

Addresses PR review comment: <comment body summary>"
git push

Collect the thread IDs of all fixed threads.

Step 7: Resolve threads

For threads in not-applicable, first post a reply comment explaining why the suggestion wasn't followed, so the reviewer isn't left wondering:

gh api repos/OWNER/REPO/pulls/PR_NUMBER/comments \
  --method POST \
  -f in_reply_to=COMMENT_DATABASE_ID \
  -f body="<brief explanation: e.g. 'This is intentional — X because Y'>"

Then, for every thread in already-fixed, needs-fix (now fixed), and not-applicable, resolve via GraphQL:

gh api graphql -f query="
  mutation {
    resolveReviewThread(input: {threadId: \"THREAD_ID\"}) {
      thread { isResolved }
    }
  }
" --jq '.data.resolveReviewThread.thread.isResolved'

Verify the result is true before moving to the next thread.

Step 8: Restore original gh account

If the active account was switched in Step 2, restore it:

gh auth switch --user <ORIGINAL_ACCOUNT>

Step 9: Report

Summarise what was done:

  • How many threads were found
  • How many were already-fixed (just resolved)
  • How many needed and received a fix
  • How many were not-applicable (resolved with explanation)
  • Any that were skipped pending user input (list them explicitly)

Important Notes

  • Never resolve a thread without first confirming the underlying concern is addressed — either in the current code or with a new commit.
  • Outdated ≠ resolved. An outdated thread may still represent a real issue in refactored code.
  • Ask the user for anything that involves a design choice, trade-off, or intentional deviation from the reviewer's suggestion.
  • This skill resolves threads under the repo owner's account. Always restore the original gh account at the end.

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-resolve-pr-comments-mrwakdha/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-resolve-pr-comments-mrwakdha' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/review-resolve-pr-comments-mrwakdha/download' --output '.skill-downloads/review-resolve-pr-comments-mrwakdha/SKILL.md.part' && mv '.skill-downloads/review-resolve-pr-comments-mrwakdha/SKILL.md.part' '.skill-downloads/review-resolve-pr-comments-mrwakdha/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/review-resolve-pr-comments-mrwakdha/SKILL.md' && test -s '.skill-downloads/review-resolve-pr-comments-mrwakdha/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/review-pr-comments' && cp -R '.skill-downloads/review-resolve-pr-comments-mrwakdha' '.claude/skills/review-pr-comments'

Cursor
test -f '.skill-downloads/review-resolve-pr-comments-mrwakdha/SKILL.md' && test -s '.skill-downloads/review-resolve-pr-comments-mrwakdha/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/review-pr-comments' && cp -R '.skill-downloads/review-resolve-pr-comments-mrwakdha' '.cursor/skills/review-pr-comments'

Codex
test -f '.skill-downloads/review-resolve-pr-comments-mrwakdha/SKILL.md' && test -s '.skill-downloads/review-resolve-pr-comments-mrwakdha/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/review-pr-comments' && cp -R '.skill-downloads/review-resolve-pr-comments-mrwakdha' '.agents/skills/review-pr-comments'

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/review-resolve-pr-comments-mrwakdha'

openskills read 'review-resolve-pr-comments-mrwakdha'

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/review-resolve-pr-comments-mrwakdha/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