Ouvrir une PR vers PyPSA/pypsa-usa

VérifiéPrudence

Automatise l'ouverture d'une pull request vers PyPSA/pypsa-usa : choix de la branche de base, vérifications pre-commit et pytest, puis rédaction du corps.

Spar Skills Guide Bot
DeveloppementIntermédiaire
0018/10/2026
Claude Code
#pull-request#git-workflow#ci#pre-commit#pypsa-usa

Recommandé pour

Notre avis

Ouvre une pull request vers PyPSA/pypsa-usa en appliquant les conventions du dépôt : choix de la branche de base, du remote de push, exécution des vérifications et rédaction du corps de la PR.

Points forts

  • Automatise les règles du dépôt : base `develop` par défaut, détection des branches d'intégration via `git merge-base`, et choix upstream/fork selon les permissions de push
  • Impose une série de vérifications obligatoires (arbre propre, rebase sur la base, `pre-commit`, `pytest -m fast`) avant tout push
  • Adapte le niveau d'exigence à la taille du changement et ouvre la PR en brouillon quand les preuves Tier B ou d'équivalence manquent
  • Suit l'état de la CI avec `gh pr checks --watch` et corrige les échecs dans la session

Limites

  • Fortement lié à PyPSA/pypsa-usa : noms de branches, marqueurs pytest, modèle de PR et chemins de tests sont codés en dur
  • Suppose `gh` authentifié et les remotes `upstream`/`origin` correctement configurés
  • L'invocation est désactivée côté modèle : l'utilisateur doit taper `/pr` explicitement, l'assistant ne le déclenchera pas seul
Quand l'utiliser

À utiliser quand une branche de pypsa-usa est prête à être poussée et que vous voulez une PR conforme aux conventions du dépôt sans refaire les contrôles à la main.

Quand l'éviter

Ne pas utiliser pour un autre dépôt, ni pour une PR vers `master`, ni lorsque vous voulez un contrôle total sur chaque étape du push et de la rédaction.

Analyse de sécurité

Prudence
Score qualité93/100

The skill uses powerful network and version-control actions (git push, gh pr create, gh api) but for a clearly scoped, legitimate purpose: opening a PR to PyPSA/pypsa-usa following repo conventions. It does not instruct destructive, exfiltrating, or obfuscated actions. The standing permission to push and open PRs warrants caution, not a risky rating.

Points d'attention
  • •Grants standing permission to push a branch and open a pull request without further confirmation.
  • •Executes network-mutating commands (git push, gh pr create) to a specific repository.
  • •Runs repository tests (pytest, pre-commit) which may execute code from the working tree.

Exemples

Open the PR for the current branch
/pr
PR with an issue link
/pr — this branch closes issue #412, please add the Closes line to the PR body.
Large change needing extra testing
/pr — I changed files under workflow/rules/, tell me whether to also run the integration tests before opening.

name: pr description: Open a pull request to PyPSA/pypsa-usa following repo conventions disable-model-invocation: true

Open a PR to PyPSA/pypsa-usa

Invoking /pr is standing permission to push the branch and open the PR — no further confirmation for those two actions. Ask the user only where a step below says to ask.

1. Pick the base branch

The base is develop on PyPSA/pypsa-usa. Never master — if the user asks for master, stop and remind them changes land on develop and flow to master in releases.

Integration-branch exception: when the branch descends from an active integration branch (a long-lived upstream branch such as v1-epic), target that branch instead. Detect it:

git fetch upstream develop v1-epic
git merge-base HEAD upstream/develop
git merge-base HEAD upstream/v1-epic

If the merge-base with the integration branch is a descendant of the merge-base with develop, the branch was cut from the integration branch — base there.

2. Pick the push remote

gh api repos/PyPSA/pypsa-usa --jq .permissions.push

true → push the head branch to upstream (the PyPSA/pypsa-usa remote). Otherwise push to the user's fork (origin) and open a cross-repo PR.

3. Gauntlet — every gate green before pushing

  1. Working tree clean (git status); commit or stash anything loose with the user's direction.
  2. Branch merges cleanly with the base; rebase or merge the base in if behind. Leave history otherwise untouched — no squashing. Conventional-commit titles (fix(rps): ...) are welcome, not required.
  3. pre-commit run --files <changed files> passes.
  4. pytest -m fast passes — Tier A, the same selection CI's fast-tests job runs, so a local pass predicts a green check.
  5. Size the change. It is larger when it touches workflow/scripts/ or workflow/rules/ in a way that can alter produced network artifacts, or spans >~300 changed lines / >10 files. For a larger change, ask the user whether to also run Tier B (pytest -m integration, needs data/ and cutouts/) — encourage it, never require it.

4. Draft the body

Fill .github/pull_request_template.md, then add:

  • Testing — which tiers ran and their verbatim results (pass/fail counts).

  • Equivalence (larger changes only) — ask the user whether an equivalence-harness run (tests/equivalence/) exists for this branch. If yes: paste the report summary and list any deltas-ledger rows (DL-N in docs/superpowers/specs/2026-08-07-deltas-ledger.md) this PR adds or touches. If no: write "No equivalence run for this branch." — stated, never omitted.

  • Ask the user whether the PR closes an issue; if so, Closes #N at the top.

  • Attribution footer:

    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    

5. Open the PR

Open as draft when the change is larger and Tier B / equivalence evidence is missing; otherwise ready-for-review. Mark ready once the evidence lands.

git push <remote> HEAD:<head-branch>
gh pr create --repo PyPSA/pypsa-usa --base <base> [--draft] ...

6. Watch CI

Wait for the fast-tests check (gh pr checks <num> --repo PyPSA/pypsa-usa --watch), fixing failures in-session and pushing until it is green. e2e-tests runs longer — report its status, don't wait on it.

Done when: PR URL reported to the user, fast-tests green (or its failure explained), and any skipped evidence (Tier B, equivalence) called out explicitly in the PR body.

Skills similaires