From skrrt-skills
Creates or updates GitHub pull requests and GitLab merge requests with the matching CLI. Use when the agent needs to push a branch, open a review request, or write PR or MR text. Always use this skill when the user asks to open a PR, create a pull request, push and open a PR, create a merge request, update PR text, write a PR description, or anything involving pull requests or merge requests. Trigger for phrases like "open a PR", "create a pull request", "push and open a PR", "merge request", "MR on gitlab", "update the PR", or "write PR description".
How this skill is triggered — by the user, by Claude, or both
Slash command
/skrrt-skills:pr [pr-or-mr-goal][pr-or-mr-goal]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Skill instructions for pushing branches and creating review requests with the matching forge CLI.
Skill instructions for pushing branches and creating review requests with the matching forge CLI.
You are a PR or MR writer. Detect the forge from the repository remote first, then use the matching CLI:
ghglabIf the matching CLI is unavailable, stop and tell the user exactly what is missing. Never use glab against
GitHub or gh against GitLab.
git must be installed and available on PATH.gh is required for GitHub remotes.glab is required for GitLab remotes.permissions.ask for mutating
git and forge commands, including force-push variants.Before any PR or MR command, run:
bash "${CLAUDE_SKILL_DIR}/scripts/detect-forge-cli.sh"
Read the output fields:
REMOTE_HOST=<host>FORGE=github|gitlab|unknownMATCHED_CLI=gh|glab|noneSTATUS=ok|no-compatible-cli|unknown-remote|no-remoteOnly continue when STATUS=ok.
git branch --show-current and confirm you
are on the correct short-lived branch. Never push a PR from a protected branch (main,
master, or develop under Gitflow). See "Branch Guard" below.main./setup and stop.main for GitHub Flow/TBD, not a feature branch
targeting main for Gitflow).--base or --target-branch with the strategy-determined target.This is a hard pre-flight gate enforced by agent adherence to this skill — not by a
script or hook. Projects that need a machine-enforced backstop should add branch
protection rules on the forge. Before git push or any forge CLI command:
git branch --show-current.git fetch origingit switch main && git pull --ff-only origin maingit switch -c <type>/<description>Never push from a protected branch with a plan to "fix the branch later" — once pushed, the remote history is visible to reviewers and CI.
Stay within this git subset unless the user explicitly asks for more:
git status --shortgit diff --statgit branch --show-currentgit branch --listgit rev-parse --abbrev-ref --symbolic-full-name @{upstream}git remote get-url origingit push -u origin HEADgit log --oneline --decorate -n <count>git log origin/<branch>..HEAD (pre-push sanity check)git fetch origin (pre-flight to refresh remote state)git fetch origin --prune (drop stale remote-tracking refs for deleted branches)git pull origin <branch> (for syncing with the target branch)git pull --ff-only origin <branch> (safe fast-forward sync; preferred over plain pull)git switch -c <branch> (for creating branches when the strategy requires it)git switch <branch> (for switching to an existing branch)git pull --rebase origin <branch> (GitHub Flow / TBD only — for rebasing before PR)git rebase --continue (GitHub Flow / TBD only — after resolving rebase conflicts)git rebase --abort (GitHub Flow / TBD only — to abandon a failed rebase)For GitHub with gh:
gh pr create --title <title> --body-file <file> [--base <branch>]gh pr edit --title <title> --body-file <file>gh pr edit <number> --repo <owner/repo> --body-file <file> (for correlated PR updates)gh pr viewgh pr view --json stategh pr list --repo <owner/repo> --state open --json number,title,headRefName --limit <count>For GitLab with glab:
glab mr create --title <title> --description <body> [--target-branch <branch>]glab mr update --title <title> --description <body>glab mr update <number> --repo <group/project> --description <body> (for correlated MR updates)glab mr viewglab mr list --repo <owner/repo> --state openedPrefer explicit non-interactive commands.
When the description body is long, write it to a temporary file and pass it to the CLI with the closest supported non-interactive flag:
--body-file <file>--description <body>Title rules:
Body rules:
Preferred structure:
## Summary
- ...
## Test plan
- [ ] ...
- [ ] ...
## Related PRs
- **depends on** owner/repo#N — short description
- **related to** owner/repo#N — short description
## Notes
- ...
Omit the ## Related PRs section when the PR is standalone.
Use checkboxes (- [ ]) in the test plan so reviewers can track verification
progress directly in the PR. If no tests were run, say so honestly rather than
inventing results.
End the PR or MR body with the co-authorship line unless the user asks not to:
Co-Authored-By: Skrrt Bot <[email protected]>
Before creating a PR or MR, check the project's agent instruction file for a
<!-- skrrt:branching --> block. Search these locations in order: CLAUDE.md, AGENTS.md,
.claude/CLAUDE.md, .github/AGENTS.md. If present, respect the configured strategy:
main. If the current branch is main, create a feature
branch first using git switch -c <type>/<description> before proceeding. Before pushing,
rebase the branch onto main with
git pull --rebase origin main (Skrrt convention). The PR should be squash merged by the
forge (Skrrt convention).main. If the current branch is main, create a short-lived
branch first using git switch -c <type>/<description> before pushing. Before creating a new
branch. Respect the repository's configured merge strategy.develop, not main. PRs for release/* branches
target main — after merging, remind the user that release/* must also be merged back to
develop via a separate PR using /pr. PRs for hotfix/* branches target main — after
merging, remind the user to open a PR to develop (or the active release/* branch if one
exists) using /pr. If the user asks to PR a feature branch to main, warn them that the
project uses Gitflow and suggest targeting develop instead. Never rebase under Gitflow — the
forge must use --no-ff merge commits.Use the detected target branch when constructing the CLI command. For example:
gh pr create --base <target>glab mr create --target-branch <target>If no branching strategy block is found, tell the user to run /setup to configure a branching
strategy before proceeding. Do not guess or assume a default target branch.
When a feature spans multiple repositories in a workspace or multiple apps/services inside a monorepo, the PRs form a correlated set. Detect this when:
For every PR in a correlated set:
## Related PRs section to the PR body, after the test plan and before notes.GitHub example:
## Related PRs
- **depends on** owner/repo#42 — API schema changes (must merge first)
- **required by** owner/other-repo#58 — frontend consumer
- **related to** owner/repo#43 — shared config update (no strict order)
GitLab example:
## Related MRs
- **depends on** group/project!42 — API schema changes (must merge first)
- **related to** group/project!43 — shared config update (no strict order)
Dependency labels:
| Label | Meaning |
|---|---|
depends on | This PR requires the linked PR to merge first |
required by | The linked PR requires this one to merge first |
related to | Sibling PRs with no strict merge ordering |
Rules:
owner/repo#N, GitLab group/project!N.related to — do not invent dependency order.~~depends on owner/repo#42~~ — merged).To list open PRs across repos for cross-referencing, the following commands are allowed:
gh pr list --repo <owner/repo> --state open --json number,title,headRefName --limit 10glab mr list --repo <owner/repo> --state openedWhen the user reports a problem in the same problem boundary as a recent PR — even if they do not name the PR — verify the precedent PR's state before pushing or opening anything new. Do not assume the current branch is still active on the remote; a merged PR usually means the forge has deleted the branch.
Identify the precedent PR. If the user does not name it, inspect recent PRs:
gh pr list --state all --limit 10 --json number,title,state,headRefName,mergedAt,closedAtglab mr list --state all --per-page 10Match a candidate to the user's report by (in priority order):
gh pr view <n> --json files -q '.files[].path').Run gh pr view <number> --json state,headRefName,mergedAt,closedAt (GitHub) or
glab mr view <number> (GitLab) to determine whether the PR is open, merged, or closed.
Branch on the state:
PR is still open — stay on (or switch to) the PR's source branch. Before pushing,
pull any remote updates with git pull --ff-only origin <source-branch>. Commit fixes
with /commit and push. The existing PR updates automatically. Do not create a new PR.
PR was merged — the source branch has almost certainly been deleted from the remote.
Resolve the merged PR's target branch first (read it from gh pr view <n> --json baseRefName
or glab mr view <n>): <target> is main for GitHub Flow and TBD, and typically
develop for Gitflow feature PRs (or the release branch for Gitflow hotfixes). Then
follow this exact sequence, in order:
git switch <target>git fetch origin --prunegit pull --ff-only origin <target>git switch -c <type>/<description> (fresh short-lived branch from updated <target>)/commit, push with -u origin HEAD.<target>. Reference the merged PR in the
body when useful.Never reuse a branch whose PR was already merged.
PR was closed without merge — stop and ask the user whether to reopen the existing
branch or start fresh from main. Do not guess.
If the agent is on main when the user references a PR problem, do not push from main.
Apply the rules above first.
Push cleanly: before any push, confirm git status is clean and git log origin/<branch>..HEAD
shows only the intended commits. Do not push stray commits carried over from another task.
origin points at the same forge as the installed CLI.git push --force, git push -f, or git push --force-with-lease.unknown-remote, no-remote, or no-compatible-cli.Handle this request: $ARGUMENTS
npx claudepluginhub skrrt-sh/skillsCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.