---
description: >-
  Batch review des PRs RTK par ordre de complexité croissante (XS → S → M → L). Pour chaque PR : vérifie l'état (conflits, CLA, reviews), lit le diff complet, analyse le code en contexte, présente un résumé avec lien + taille + recommandation. Attend validation explicite avant tout merge. Poste des commentaires boldguy-adapt sur les PRs bloquées (conflit, CLA, CHANGES_REQUESTED). Args: "triage" pour lancer un triage complet avant la review. "from:<num>" pour reprendre à partir d'un numéro de PR spécifique.
allowed-tools:
  - Bash
  - Read
  - Grep
  - Glob
  - Write
  - AskUserQuestion
title: pr-review
canonical_url: https://skilld.dev/gh/rtk-ai/rtk/pr-review
last_updated: 2026-10-09T12:15:55.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install rtk-ai/rtk/pr-review`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/pr-review`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/rtk-ai/rtk/pr-review) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/pr-review`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/pr-review --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/pr-review --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# /pr-review

Batch review des PRs RTK — du plus simple au plus complexe, une par une, avec validation utilisateur avant chaque merge.

---

## Quand utiliser

- Après un `/rtk-triage` pour agir sur les résultats
- Régulièrement pour dégraisser le backlog
- Avant une release pour vider la file quick wins

---

## Workflow

### Phase 0 — Préconditions

```bash
git rev-parse --is-inside-work-tree
gh auth status
date +%Y-%m-%d
```

Si l'argument `triage` est passé, exécuter `/rtk-triage` d'abord et utiliser sa liste de quick wins comme séquence. Sinon, construire la liste soi-même.

---

### Phase 1 — Construire la liste de PRs (si pas de triage)

```bash
gh pr list --state open --limit 200 \
  --json number,title,author,additions,deletions,changedFiles,mergeable,mergeStateStatus,isDraft,statusCheckRollup,reviewDecision,body \
  | jq 'sort_by(.additions + .deletions)'
```

**Classement par taille** :

| Taille | Critère | Traitement |
|--------|---------|------------|
| XS | < 30 lignes, 1 fichier | En premier |
| S | 30-100 lignes, 1-3 fichiers | Ensuite |
| M | 100-200 lignes, logique non triviale | Après |
| L | > 200 lignes | Dernier ou skip |
| XL | > 500 lignes | Skip (session dédiée) |

**Filtrer d'emblée** :
- Exclure les PRs draft
- Exclure les PRs de nous (les nôtres ont une review flow différente)
- Si `from:<num>` passé en argument : commencer à ce numéro

---

### Phase 2 — Pour chaque PR (une par une, dans l'ordre)

#### Étape A — Vérification état (AVANT de lire le diff)

```bash
# 1. Etat mergeable + CLA
gh pr view <num> --json mergeable,mergeStateStatus,statusCheckRollup,reviewDecision

# 2. Reviews existantes (CHANGES_REQUESTED ?)
gh api repos/rtk-ai/rtk/pulls/<num>/reviews \
  --jq '.[] | {author: .user.login, state: .state, body: .body}'

# 3. Commentaires inline (si CHANGES_REQUESTED)
gh api repos/rtk-ai/rtk/pulls/<num>/comments \
  --jq '.[] | {author: .user.login, body: .body, path: .path, line: .line}'
```

**Décision rapide selon état** :

| État | Action |
|------|--------|
| MERGEABLE + CLA ok + pas de CHANGES_REQUESTED | → lire le diff |
| CONFLICTING | → préparer commentaire rebase, skip diff |
| CLA non signé | → préparer commentaire CLA, skip diff |
| CHANGES_REQUESTED par un maintainer | → skip (ne pas override), noter |
| Draft | → skip silencieusement |

#### Étape B — Lire le diff complet

```bash
gh pr diff <num>
```

Si le diff touche une logique complexe (filter functions, regex, routing) → lire le fichier source en contexte avec `Read` pour comprendre l'impact réel.

#### Étape C — Présenter à l'utilisateur

Format de présentation **obligatoire** pour chaque PR :

```
**PR #<num>** — https://github.com/rtk-ai/rtk/pull/<num>

**Author**: <login> | **Size**: <XS/S/M/L> (+<add> -<del>, <N> fichiers) | **CLA**: <ok/non signé> | **Mergeable**: <clean/conflit>

**Ce que ça fait** — [description en 2-4 phrases : le problème résolu, les fichiers touchés, la logique modifiée, les tests ajoutés]

**Qualité du diff** : [analyse honnête : propre/à vérifier/problème détecté]

Merge #<num> ?
```

**Règles de présentation** :
- Toujours inclure le lien GitHub cliquable
- Toujours mentionner si des tests couvrent le changement
- Si une fonction complexe est touchée, expliquer l'impact
- Ne pas embellir — si le diff est moyen, le dire
- Langue : français pour l'analyse (comme ici)

#### Étape D — Attendre la validation

**NE JAMAIS MERGER SANS RÉPONSE EXPLICITE.** Les réponses attendues :

| Réponse | Action |
|---------|--------|
| "ok" / "go" / "merge" | Merger avec `gh pr merge --merge` |
| "skip" / "next" | Passer à la PR suivante sans merger |
| "comment" | Poster un commentaire (demander le texte si pas fourni) |
| "close" | Fermer la PR |
| Retour avec instructions | Appliquer puis redemander confirmation |

#### Étape E — Merger (si validé)

```bash
gh pr merge <num> --merge --squash
```

Confirmer immédiatement : `Merged #<num>. ✓`

Puis **vérifier que la PR suivante n'est pas passée en CONFLICTING** à cause du merge (surtout si les deux touchent `rules.rs`, `registry.rs`, `main.rs`, ou `CHANGELOG.md`).

---

### Phase 3 — PRs bloquées : commentaire boldguy-adapt

Pour les PRs avec conflit, CLA manquant, ou besoin de rebase, poster un commentaire en anglais, ton boldguy-adapt.

**Règles du commentaire** :
- **Anglais uniquement** (GitHub)
- Remercier la contribution en ouverture (sincèrement, pas de manière générique)
- Dire clairement ce qui bloque (1-2 points max)
- Donner les étapes exactes pour débloquer
- Pas d'em dash (`—`), pas de staccato, longueurs de phrases variées
- Ne pas sonner comme un bot

**Template conflit + CLA** :
```
Hey @<author>, thanks for the contribution! [mention spécifique de ce que la PR apporte]

Two things before we can merge:

1. The branch needs a rebase on `develop` — there's a conflict on [fichier]. A `git rebase origin/develop` should do it.

2. The CLA hasn't been signed yet. The CLAassistant bot left instructions in the PR — just follow the link, takes about a minute.

Once both are sorted, this will move quickly.
```

**Template conflit seul** :
```
Hey @<author>, good fix on [description spécifique]. One thing to address before merge: the branch has a conflict on [fichier] after recent changes to develop. A `git rebase origin/develop` should resolve it cleanly.
```

**Template CLA seul** :
```
Hey @<author>, thanks for [description spécifique]. The only thing blocking merge is the CLA signature — the CLAassistant bot left the link in the PR. Once that's done, we're good to go.
```

---

### Phase 4 — Récap de session

Après avoir traité toutes les PRs (ou à la demande) :

```
## Session recap — YYYY-MM-DD

| PR | Titre | Action | Raison |
|----|-------|--------|--------|
| #N | titre | Mergé ✓ | — |
| #N | titre | Skip | CHANGES_REQUESTED (KuSh) |
| #N | titre | Commenté | Conflit + CLA |
| #N | titre | Fermé | Doublon avec #M |

Mergées : N | Skippées : N | Commentées : N
```

---

## Règles

- **Une PR à la fois** — ne jamais présenter plusieurs PRs en attente de validation
- **Jamais merger sans "ok" explicite** — "ça a l'air bien" n'est pas un ok
- **Ne pas overrider un CHANGES_REQUESTED** d'un maintainer sans instructions explicites de l'utilisateur
- **Vérifier les conflits post-merge** sur la PR suivante si les deux touchent les mêmes fichiers
- **Langue** : analyse en français, commentaires GitHub en anglais
- **Ton boldguy** : factuel, direct, bienveillant, pas de marqueurs AI (em dash, staccato, punchline finale parfaite)

---

## Fichiers fréquemment en conflit (surveiller)

- `CHANGELOG.md` — toutes les PRs y touchent
- `src/discover/rules.rs` — ajouts fréquents de règles
- `src/discover/registry.rs` — tests de classify/rewrite
- `src/main.rs` — routing des commandes
- `src/hooks/rewrite_cmd.rs` — rewrites hooks
