Créer une pull request GitHub

VérifiéSûr

Guide complet pour créer une pull request GitHub : branche, implémentation, tests, formatage et soumission.

Spar Skills Guide Bot
DeveloppementIntermédiaire
22/07/2026
Claude Code
#pull-request#git-workflow#testing#code-coverage#ci-formatting

Recommandé pour

Synthèse automatique

Ce skill guide le flux complet de création d'une pull request GitHub, de la création de branche à la soumission de la PR, en incluant tests, formatage et description détaillée.

Points forts

  • Enchaîne les étapes dans un ordre clair : branche, implémentation, tests, formatage, commit, push et PR
  • Impose des conventions explicites (préfixes de branche, format de commit conventionnel, structure de corps de PR)
  • Intègre la vérification de couverture via coverage annotate et l'interprétation des marqueurs ,cover
  • Rappelle de consulter les workflows GitHub du projet pour les commandes de formatage exactes

Limites

  • Les commandes d'exemple sont spécifiques à un projet Python (uv, black, ruff, pytest) et doivent être adaptées
  • Le corps de PR fourni dans l'exemple est tronqué, ce qui peut laisser la structure incomplète
  • Suppose un dépôt GitHub avec le CLI gh authentifié et une branche main comme base
Quand l'utiliser

À utiliser lorsqu'il faut préparer et soumettre une contribution complète sur GitHub avec tests et description de PR soignée.

Quand l'éviter

À éviter pour de petites modifications directes sur une branche existante ou sur un dépôt non hébergé sur GitHub.

Analyse de sécurité

Sûr
Score qualité78/100

Every command is visible, standard developer tooling (git, gh, uv, black, ruff, pytest) used for its intended purpose. There is no curl|sh, no base64/obfuscated payload, no credential or token exfiltration, and no safety-disabling instruction. The only deletion is a narrowly scoped cleanup of generated `.coverage.*` artifacts, so overall risk is low.

Points d'attention
  • •Uses git/gh/uv/pytest shell commands for legitimate PR workflow; no untrusted input is executed
  • •Includes `rm -f .coverage.*`, which only removes generated coverage data files and is scoped/benign
  • •Network access via `git push` and `gh` is inherent to opening a PR and is transparent
  • •Hardcodes a `Co-Authored-By: Claude` trailer and bot footer in commits/PRs (minor attribution/automation concern, not a security risk)
Comment cette analyse est faite

Exemples

Create a feature PR
Create a PR that adds a learning-rate warmup option to the training config, with tests and a proper description.
Open a bug-fix pull request
Open a pull request fixing the crash when the dataset path is empty — branch from main, add a regression test, run formatting, and write the PR body.
Submit changes for review
Make a PR for my refactor of the data loader module, and check coverage on the files I changed before committing.

name: pr description: > Create a well-structured GitHub PR with proper branching, testing, formatting, and documentation. Use when the user says "create a PR", "make a PR", "open a pull request", or wants to submit changes for review. Handles the full workflow: branch creation, implementation, testing, formatting, committing, and PR creation with comprehensive descriptions.

Create a GitHub Pull Request

Overview

This skill guides the complete PR workflow from branch creation to PR submission. Follow all steps in order to ensure high-quality, well-documented contributions.

Step 1: Branch Setup

Pull latest main

git checkout main
git pull origin main

Create feature branch

Use a descriptive branch name following the pattern: {type}/{description}

Types:

  • feature/ - New functionality
  • fix/ - Bug fixes
  • refactor/ - Code restructuring
  • docs/ - Documentation updates
  • test/ - Test additions/improvements
git checkout -b feature/descriptive-name

Step 2: Understand the Problem

Before coding, clearly identify:

  1. Core problem: What issue are we solving?
  2. Scope: What files/modules will be affected?
  3. Approach: What's the implementation strategy?
  4. Edge cases: What scenarios need special handling?

If there's an associated GitHub issue, fetch it for context:

gh issue view <issue-number>

Step 3: Implement Changes

  • Make focused, incremental changes
  • Follow existing code patterns and style
  • Add docstrings and comments for complex logic
  • Consider backwards compatibility

Step 4: Write Tests

Location

Tests go in the tests/ directory, mirroring the source structure.

Requirements

  • Cover all new functionality
  • Test edge cases and error conditions
  • Test both success and failure paths
  • Aim for high coverage of changed code

Test file naming

  • test_{module_name}.py for module tests
  • Place in corresponding tests/ subdirectory

Step 5: Format Code

Check GitHub workflows for the project's formatting commands:

# Check .github/workflows/ for exact commands
# Typical formatting for this project:
uv run black sleap_nn tests
uv run ruff check sleap_nn/ --fix

Step 6: Run Tests with Coverage

Run the full test suite with coverage:

uv run pytest -q --maxfail=1 --cov --cov-branch && rm -f .coverage.* && uv run coverage annotate

Check coverage for changed files

The coverage annotate command creates {module_name.py},cover files next to each module.

To find which files changed:

git diff --name-only $(git merge-base origin/main HEAD)

Review the ,cover files for your changed modules to ensure adequate coverage.

Coverage markers in annotated files

| Marker | Meaning | |--------|---------| | > | Line was executed | | ! | Line was NOT executed (needs test coverage) | | - | Line is not executable (comments, blank lines) |

Step 7: Commit Changes

Commit structure

Make well-structured, atomic commits:

  • Each commit should be a logical unit of work
  • Write clear, descriptive commit messages
  • Use conventional commit format when appropriate

Commit message format

<type>: <short description>

<optional longer description>

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Types: feat, fix, refactor, test, docs, chore

Step 8: Push to GitHub

git push -u origin <branch-name>

Step 9: Create Pull Request

Create the PR

gh pr create --title "<descriptive title>" --body "$(cat <<'EOF'
## Summary
<1-3 bullet points describing the changes>

## Changes Made
- <detailed list of changes>

## Example Usage
```python
# For enhancements, show how to use the new functionality

API Changes

  • <list any API changes, new parameters, removed functionality>

Testing

  • <describe test coverage>
  • <note any manual testing done>

Design Decisions

  • <explain key architectural choices>
  • <note trade-offs considered>

Future Considerations

  • <potential improvements not in scope>
  • <known limitations>

Related Issues

Closes #<issue-number> (if applicable)


🤖 Generated with Claude Code EOF )"


### If updating an existing PR

Fetch current PR description:
```bash
gh pr view <pr-number> --json body -q '.body'

Update PR description:

gh pr edit <pr-number> --body "<new body>"

Fetch associated issue for context

If an issue is linked:

gh issue view <issue-number>

Use issue context to ensure PR description addresses all requirements.

PR Description Checklist

  • [ ] Summary clearly explains the "what" and "why"
  • [ ] All significant changes are documented
  • [ ] Example usage provided for new features
  • [ ] API changes explicitly listed
  • [ ] Breaking changes highlighted
  • [ ] Test coverage described
  • [ ] Design decisions explained with reasoning
  • [ ] Related issues linked

Quick Reference Commands

# Branch setup
git checkout main && git pull origin main
git checkout -b feature/my-feature

# Format and lint
uv run black sleap_nn tests
uv run ruff check sleap_nn/ --fix

# Test with coverage
uv run pytest -q --maxfail=1 --cov --cov-branch && rm -f .coverage.* && uv run coverage annotate

# Find changed files
git diff --name-only $(git merge-base origin/main HEAD)

# Commit
git add <files>
git commit -m "feat: description"

# Push and create PR
git push -u origin <branch>
gh pr create --title "Title" --body "Description"

# View/edit existing PR
gh pr view <number>
gh pr edit <number> --body "New description"

# View linked issue
gh issue view <number>

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-github-pull-request-mrwakdb5/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-github-pull-request-mrwakdb5' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/create-a-github-pull-request-mrwakdb5/download' --output '.skill-downloads/create-a-github-pull-request-mrwakdb5/SKILL.md.part' && mv '.skill-downloads/create-a-github-pull-request-mrwakdb5/SKILL.md.part' '.skill-downloads/create-a-github-pull-request-mrwakdb5/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.

Extrait original : Requirements
  • Cover all new functionality
  • Test edge cases and error conditions
  • Test both success and failure paths
  • Aim for high coverage of changed code

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-github-pull-request-mrwakdb5/SKILL.md' && test -s '.skill-downloads/create-a-github-pull-request-mrwakdb5/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/pr' && cp -R '.skill-downloads/create-a-github-pull-request-mrwakdb5' '.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-github-pull-request-mrwakdb5'

openskills read 'create-a-github-pull-request-mrwakdb5'

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-github-pull-request-mrwakdb5/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