Notre avis
Surveille l'état des vérifications CI d'une pull request, corrige automatiquement les échecs, puis fusionne avec squash une fois toutes les vérifications réussies.
Points forts
- Automatise entièrement le workflow de fusion avec squash
- Gère le basculement entre branches et le rétablissement de l'état initial
- Consolide intelligemment les messages de commit pour un historique propre
- Tente de corriger les échecs CI avant de réessayer
Limites
- Nécessite que l'outil CLI 'gh' soit installé et configuré
- Les corrections automatiques d'échecs CI peuvent ne pas être suffisantes sans intervention humaine
- Ne fonctionne que pour les PRs de la branche courante ou spécifiée
Lorsque vous souhaitez fusionner une PR de manière fiable après avoir vérifié que tous les tests CI passent, en évitant les fusions manuelles répétitives.
Quand vous avez besoin d'un merge commit complexe ou d'une revue de code manuelle avant fusion, ou si vous n'avez pas les permissions pour pousser sur la branche distante.
Analyse de sécurité
PrudenceThe skill uses git and gh CLI to push and merge changes, which are powerful operations but for legitimate PR management. No destructive or exfiltrating commands are instructed. Potential risk from automated code fixing lies in the AI's interpretation, not the skill itself.
Aucun point d'attention détecté
Exemples
/merge-pr/merge-pr 42name: merge-pr description: | Watch CI checks, auto-fix failures, and squash-merge the PR when all checks pass.
Merge PR When CI Passes
Wait for CI checks to pass, then merge the specified PR with squash.
Usage
/merge-pr <pr-number>
If no PR number is provided, use the current branch's PR.
Instructions
-
Determine target PR and branch:
- Record the current branch:
git branch --show-current - If
$ARGUMENTSis provided (PR number specified):- Get the PR's head branch:
gh pr view <pr-number> --json headRefName -q .headRefName - Compare with current branch
- If different branch:
- Stash all local changes (including untracked):
git stash push -u -m "merge-pr: stashing for PR #<pr-number>" - Switch to PR branch:
git checkout <pr-branch> - Set
SWITCHED_BRANCH=trueandORIGINAL_BRANCH=<current-branch>
- Stash all local changes (including untracked):
- Get the PR's head branch:
- If no
$ARGUMENTS, use the current branch's PR
- Record the current branch:
-
Check uncommitted changes: Run
git statusto check for uncommitted changes:- If there are uncommitted changes, inform the user and ask if they want to commit
- If yes, invoke the
commit-changesskill to create a proper commit
-
Check unpushed commits: Run
git log origin/<branch>..HEAD --onelineto check for unpushed commits:- If there are unpushed commits, inform the user and push them:
git push
- If there are unpushed commits, inform the user and push them:
-
Check for existing PR: Run
gh pr view --json number,url -q '.number' 2>/dev/nullto check if a PR exists for the current branch:- If no PR exists and no
$ARGUMENTSprovided, ask the user if they want to create a PR - If yes, invoke the
pr-pushskill to create the PR, then continue - If no, inform the user that a PR is required and stop
- If no PR exists and no
-
Get PR number: If
$ARGUMENTSis provided, use it as the PR number. Otherwise, get the PR for the current branch:gh pr view --json number -q .number -
Watch CI status: Monitor the CI checks for the PR:
gh pr checks <pr-number> --watch -
Handle CI failures: If any check fails:
- Get the failed check details:
gh pr checks <pr-number> - For each failed check, fetch the logs to understand the error:
gh run view <run-id> --log-failed - Analyze the error and attempt to fix it
- Push the fix and repeat from step 6
- Get the failed check details:
-
Prepare commit message: Before merging, consolidate commit messages:
- Get all commits in the PR:
gh pr view <pr-number> --json commits -q '.commits[].messageHeadline' - Create a consolidated commit message that:
- Uses the PR title as the main message
- Removes duplicate/redundant commit messages
- Keeps unique meaningful changes as bullet points in the body
- Get all commits in the PR:
-
Merge the PR: Once all checks pass, merge with squash:
gh pr merge <pr-number> --squash --delete-branch --body "<consolidated-message>" -
Restore original state or switch to main:
- If
SWITCHED_BRANCH=true(was working on a different branch):- Switch back to original branch:
git checkout <ORIGINAL_BRANCH> - Restore stashed changes:
git stash pop - Inform the user that original branch and changes have been restored
- Switch back to original branch:
- If
SWITCHED_BRANCH=false(was on the PR branch itself):- The PR branch has been deleted, switch to main and pull:
git checkout main && git pull
- The PR branch has been deleted, switch to main and pull:
- If
-
Report result: Show the merge commit and confirm success.
Commit Messages Examples
Example 1: Feature Commit
feat: add JWT token refresh mechanism
Changes:
- Implement automatic token refresh before expiration
- Add refresh token storage in secure cookie
- Include retry logic for failed refresh attempts
Example 2: Bug Fix Commit
fix: prevent null pointer on empty response
Changes:
Handle case where API returns empty body instead of
throwing unhandled exception in response parser.
Example 3: Refactor Commit
refactor: extract common mock to shared helper
Changes:
- Move mockGRPCStreamClient to mock_query.go
- Consolidate 4 duplicate mock implementations
- Reduce test file coupling
Expert Next.js App Router
Developpement
Un skill qui transforme Claude en expert Next.js App Router.
Générateur de README
Developpement
Crée des README.md professionnels et complets pour vos projets.
Rédacteur de Documentation API
Developpement
Génère de la documentation API complète au format OpenAPI/Swagger.