Créer une pull request

VérifiéPrudence

Crée une pull request pour la branche courante, incluant le formatage, les commits, le rebase et le passage de la porte de pré-PR.

Spar Skills Guide Bot
DeveloppementIntermédiaire
28/07/2026
Claude Code
#pull-requests#git-workflow#swift#code-review#ci

Recommandé pour

Synthèse automatique

Automatise la création d'une pull request à partir de la branche courante : formatage, commit, rebase sur origin/main, passage du portail CI local, puis ouverture de la PR.

Points forts

  • Enchaîne les étapes dans le bon ordre : le rebase sur origin/main précède le portail CI, ce qui garantit que la vérification reflète le vrai résultat de fusion
  • Détecte les arguments `reviewed`/`skip-review` et l'absence de fichiers Swift pour éviter une revue de code redondante
  • Adapte l'ampleur du portail local : `make ci` complet si du code change, sinon lint + markdown + docs seulement
  • Contrôle l'absence de secrets, de fichiers `.env` et d'artefacts de build avant de committer
  • Le rebase sur origin/main plutôt que sur la branche locale main est sûr en worktree

Limites

  • Suppose une pile d'outils précise (Makefile avec `make ci`, `lint`, `lint-markdown`, `build-docs`) et des commandes maison comme `/format`
  • Fortement orienté Swift/Xcode : les règles de détection de diff et de revue ne s'appliquent qu'à ce type de dépôt
  • S'arrête au premier échec et peut nécessiter un `git push --force-with-lease` après rebase d'une branche déjà poussée
Quand l'utiliser

À utiliser quand une branche de fonctionnalité est prête et que vous voulez une PR propre, rebasée et validée par le portail CI local en une seule commande.

Quand l'éviter

À éviter sur un dépôt qui n'utilise pas les cibles Makefile et la convention de commit gitmoji attendues, ou lorsqu'aucune revue de code locale n'est souhaitée.

Analyse de sécurité

Prudence
Score qualité94/100

The skill instructs standard, legitimate development workflow commands for formatting, committing, rebasing, testing, and pushing a pull request. No destructive or exfiltrating actions are present; it even includes a step to verify no secrets or build artifacts are committed. However, the use of rebase and force-with-lease push, along with running build/test commands, warrants a caution rating due to the potential for history rewriting and remote branch overwrite if not handled carefully.

Points d'attention
  • •Uses git rebase and force-with-lease push, which rewrite branch history and can overwrite remote refs if misused.
  • •Runs local CI commands (make ci, swiftlint) and network git operations (fetch, push).
Comment cette analyse est faite

Exemples

Standalone PR
/pr
PR after an upstream review
/pr reviewed
Natural-language trigger
Create a pull request for the current branch — rebase on origin/main, run the CI gate first, and skip the code review if it already ran.

name: pr description: Create a pull request

Create a pull request

I'll create a pull request for the current branch by following these steps. If any steps fail, stop.

Mode — check the arguments passed to this skill (shown at the end). If they include reviewed (or skip-review), an upstream step already ran the code-reviewer and fixed its findings (e.g. /deliver's code-review phase), so skip steps 5–7 to avoid reviewing identical code twice. Otherwise (standalone /pr), run the internal review as normal.

Also skip steps 5–7 when the branch changes no Swift — code review is for Swift, so a docs-only / config-only PR needs none:

git diff --name-only origin/main...HEAD | grep -qE '\.swift$' || echo "no-swift → skip review"
  1. Run /format to format code

  2. Commit all outstanding work. Run git status. If the working tree has any uncommitted or unstaged changes (the feature work, plus the formatting from step 1), stage and commit them — the PR reflects committed history only, so anything left uncommitted will be missing from the PR. First verify no secrets, .env, or build artifacts are included (per CLAUDE.md — .env must stay gitignored; check git status before git add). Use a descriptive gitmoji message (or several logical commits if the work spans concerns); formatting-only changes can use "🎨 apply code formatting". If the tree is already clean (e.g. work was committed during /deliver), this is a no-op.

  3. Rebase onto the latest origin/main. Fetch the remote and rebase the feature branch directly onto origin/main — do this before make ci so the gate (and the eventual PR) reflects the real merge result, not stale code:

    git fetch origin
    git rebase origin/main
    
    • Rebase onto origin/main, not local main — this is worktree-safe. A /deliver runs inside a git worktree, and git checkout main there fails (fatal: 'main' is already used by worktree …) whenever the main checkout is on main; rebasing onto origin/main avoids checking main out at all and uses the true remote base directly.
    • If git rebase reports conflicts, stop, resolve them, then continue. Never skip or force past a conflict you don't understand.
    • The rebase rewrites the branch tip, so a branch that was already pushed will need git push --force-with-lease at the push step below.
    • Already branched off an up-to-date origin/main with nothing to replay → this is a fast no-op.
  4. Run the pre-PR gate — MANDATORY; it must pass before going further. Run it directly (do not delegate). If it fails, stop and fix — commit the fixes — then re-run; never open a PR on a red gate. Scale the gate to the diff:

    • Default — full make ci. The gate CLAUDE.md requires before any PR: lint, markdown lint, unit tests, integration tests, the release build, and the docs build. Use this whenever any code or build-affecting file changed.

    • Docs/config-only fast gate. When the diff touches no build- or test-affecting files — i.e. no *.swift and none of Makefile, Package.swift, Package.resolved, *.xctestplan, or .github/workflows/** — the test/release-build legs of make ci have nothing to exercise. Run only the meaningful checks instead: make lint && make lint-markdown && make build-docs (drop build-docs if no *.docc/** changed). Detect this with:

      git diff --name-only origin/main...HEAD \
        | grep -qE '\.swift$|^Makefile$|^Package\.(swift|resolved)$|\.xctestplan$|^\.github/workflows/' \
        && echo "code/build touched → full make ci" \
        || echo "docs/config-only → fast gate"
      

      The PR's own CI still runs the full matrix regardless, so this only trims the local gate; it never lowers what actually guards main. When in doubt, run full make ci.

    • Re-lint new Swift files without the cache. make ci's lint leg is swiftlint --strict . (Makefile), and SwiftLint caches results (~/Library/Caches/SwiftLint). On newly-added .swift files this has been seen to report a false green locally — passing file_length / type_body_length that the PR's CI Lint job (a clean checkout, no cache) then fails on. So when the diff adds any new .swift file (git diff --name-only --diff-filter=A origin/main...HEAD | grep -q '\.swift$'), run a cache-bypassing lint before trusting the gate:

      swiftlint lint --strict --no-cache .
      

      Fix anything it flags (oversized files: split, or add a // swiftlint:disable directive matching the AccountService+Pagination.swift precedent) and re-run. This catches file-size violations locally instead of on a CI round-trip.

  5. (skip in reviewed mode or when no Swift changed) Spawn the code-reviewer agent to perform a code review of all changes (pass the git diff output as context)

  6. (skip in reviewed mode or when no Swift changed) Summarize the code review findings:

    • List any critical or high-severity issues that should be addressed
    • List any medium-severity suggestions for improvement
    • Note any low-severity or stylistic recommendations
  7. (skip in reviewed mode or when no Swift changed) If there are critical/high-severity issues:

    • Recommend specific changes needed
    • Ask user for confirmation before proceeding (fix issues or continue anyway)
    • If user wants to fix issues, stop and let them address the feedback
  8. Ensure a clean working tree before pushing. Re-run git status; commit anything still outstanding (e.g. review fixes from steps 5–7, or make ci fixes) so the push includes everything. The tree must be clean before proceeding. Then run git diff origin/main...HEAD to understand all changes going into the PR.

  9. Analyze the commits and changes to generate an appropriate title and summary

  10. Push the current branch to remote (git push -u origin <branch> if not yet pushed; otherwise git push — use git push --force-with-lease if you rebased in step 3)

  11. Create a PR with the GitHub MCP — mcp__github__create_pull_request (owner/repo from the origin remote, base: main, head: <branch>, plus title/body). The branch must already be pushed (step 10). If the call fails with 401/403 (PAT expired or missing scope), fall back to gh pr create with the same title/body.

    Title — MUST start with a gitmoji prefix matching the change:

    | Emoji | Code | Use for | |-------|------|---------| | ✨ | :sparkles: | New features | | 🐛 | :bug: | Bug fixes | | 📝 | :memo: | Documentation updates | | ♻️ | :recycle: | Refactoring | | ✅ | :white_check_mark: | Adding/updating tests | | 🔧 | :wrench: | Configuration changes | | ⚡️ | :zap: | Performance improvements | | 🎨 | :art: | Code style/formatting |

    Example: ✨ Add createdBy property to TVSeries.

    Body — fill this skeleton, keeping only the sections that apply, and end with the attribution line exactly as shown:

    ## Summary
    
    [Brief description of what this PR does and why]
    
    ## Changes
    
    **New Model/Feature/Component:**
    - ✨ [Description]
    
    **Existing Files:**
    - 📝 [Description]
    
    **Tests:**
    - ✅ [Description of test coverage]
    
    **Documentation:**
    - 📚 [Description]
    
    ## Benefits
    
    - **[Benefit Category]**: [Description]
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    

$ARGUMENTS

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

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/create-a-pull-request-ms47vnyg'

openskills read 'create-a-pull-request-ms47vnyg'

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/create-a-pull-request-ms47vnyg/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