From ring-default
Opens a GitHub Pull Request with automatic base branch detection, scope allowlist enforcement, PR template filling, and post-create base verification. Use after pushing a branch.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ring-default:opening-pull-requestsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Open a GitHub Pull Request against the correct base branch, with a title that will pass scope validation and a body that fills the repo's PR template. Verifies the base after creation and corrects it automatically if GitHub defaulted to the wrong target.
Open a GitHub Pull Request against the correct base branch, with a title that will pass scope validation and a body that fills the repo's PR template. Verifies the base after creation and corrects it automatically if GitHub defaulted to the wrong target.
gh pr create BEFORE COMPLETING STEPS 1–6Skipping detection steps is how PRs end up targeting main when the repo expects develop, or how PRs fail validation due to a missing or invalid scope. MUST complete every step in order.
NEVER assume the base. Run all three probes first, then apply the precedence rules below.
# Probe A — GitHub API default
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'
# Fallback if gh unavailable: git remote show origin | grep 'HEAD branch' | awk '{print $NF}'
# Probe B — PR template hint
# Read .github/pull_request_template.md — note any explicit branch name mentioned
# Probe C — develop branch existence
git ls-remote --heads origin develop
| Priority | Source | Rule |
|---|---|---|
| 1 — highest | PR template | If .github/pull_request_template.md explicitly names a target branch, use it. Overrides everything. |
| 2 | develop exists + user confirms | If Probe C finds develop AND it differs from Probe A, show both options and ask the user to confirm. Use the user's choice. |
| 3 — fallback | GitHub API default | Use the value from Probe A. |
| 4 | Neither detected | STOP — ask the user which branch to target. |
State the resolved $BASE and which source determined it before proceeding.
MUST detect the allowlist before proposing the PR title. A title with a wrong or missing scope will fail PR validation and block the merge.
Check in this order:
.github/workflows/pr-validation.yml (primary).github/workflows/pr-title.yml.github/workflows/commitlint.yml.github/workflows/semantic-pull-request.ymlcommitlint.config.{js,cjs,mjs,ts}, .commitlintrc*| Form | Example |
|---|---|
scopes: block (one per line) | Under amannn/action-semantic-pull-request |
scopes: a,b,c inline | Comma-separated on one line |
scope-enum rule | In commitlint config arrays |
Also extract any type restrictions — some repos limit allowed types beyond the default Conventional Commits set.
| Situation | Required Action |
|---|---|
| Policy found, scope is clear | Use only scopes from the allowlist |
| Policy found, scope is ambiguous | STOP and ask the user which allowed scope to use |
| No policy file found | Infer a candidate scope from recent merged PRs first: gh pr list --state merged --limit 15 --json title --jq '.[].title'. Present the inferred scope to the user for confirmation; if no clear pattern emerges, ask the user for a scope. |
NEVER omit the scope. NEVER invent a scope not in the allowlist.
State the policy source and chosen scope before proceeding.
git status --porcelain # check for uncommitted changes
git branch --show-current # confirm current branch name (empty in detached HEAD)
git fetch origin <current-branch> --quiet # refresh remote ref before checking push state
git ls-remote --heads origin <current-branch> # confirm branch exists on remote
git rev-list origin/<current-branch>..HEAD --count # confirm no local commits ahead
| Condition | Detection | Required Action |
|---|---|---|
| Uncommitted changes exist | git status --porcelain returns output | STOP — ask user to commit first with ring:committing-changes |
| Detached HEAD / no branch | git branch --show-current returns empty output | STOP — ask user to checkout or create a named branch first |
| Branch not on remote | git ls-remote returns no SHA for the branch | STOP — push first: git push -u origin <branch> |
| Local commits ahead of remote | git rev-list origin/<branch>..HEAD --count returns non-zero | STOP — push pending commits first: git push |
Fail closed. Check in this order: uncommitted changes → detached HEAD → branch on remote → no local commits ahead. Only continue when all four checks pass. Do NOT interpolate an empty branch name into git ls-remote or git rev-list.
cat .github/pull_request_template.md 2>/dev/null
If the template exists, use it as the body structure and fill in every section. If no template exists, use this default structure:
## Summary
<!-- What does this PR do and why? -->
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Breaking Changes
None.
## Testing
- [ ] Unit tests pass
- [ ] Manually tested
## Related Issues
<!-- Closes #issue -->
git log origin/$BASE..HEAD --oneline
git diff origin/$BASE...HEAD --stat
Use this output to fill the PR body accurately.
<type>(<scope>): <description>
Requirements:
Examples:
feat(auth): add OAuth2 refresh token supportfix(api): handle null response in user endpointchore(deps): update authentication dependenciesFill the PR template completely:
| Section | Instructions |
|---|---|
| Description/Summary | Summarize what the PR does and why |
| Type of Change | Check boxes matching the commit type |
| Breaking Changes | Describe if applicable; otherwise "None." |
| Testing | Check applicable boxes; add CI run link if available |
| Related Issues | Fill only if user mentioned an issue; leave blank otherwise |
Present the complete draft to the user:
PR Draft — waiting for your approval
─────────────────────────────────────
Base branch: develop (from: git ls-remote)
Scope policy: .github/workflows/pr-validation.yml → scopes: [api, auth, docs, ci]
Chosen scope: auth
Title:
feat(auth): add OAuth2 refresh token support
Body:
## Summary
Adds automatic token refresh when access token expires...
...
Command that will run:
gh pr create --title "feat(auth): add OAuth2 refresh token support" \
--body "..." \
--base develop
Approve and create? [Yes / Edit title / Edit body / Cancel]
MUST wait for explicit user approval before executing gh pr create.
gh pr create \
--title "<title>" \
--body "<body>" \
--base $BASE
Capture the PR number from the output.
MUST verify the PR was opened against the expected base before reporting success. GitHub sometimes defaults to a different base.
gh pr view <number> --json baseRefName --jq '.baseRefName'
| Result | Action |
|---|---|
Equals $BASE | Proceed — report success |
Does NOT equal $BASE | Immediately retarget: gh pr edit <number> --base $BASE |
After retargeting, verify again:
gh pr view <number> --json baseRefName --jq '.baseRefName'
Only report success after the base is confirmed correct.
gh pr view <number> --json url --jq '.url'
Return the PR URL to the user.
gh pr create before completing Steps 1–7 — bypassing detection causes PRs targeting the wrong base--base develop or --base main — always pass --base $BASE resolved in Step 1type(scope): description, never type: description| Rationalization | Why It's WRONG | Required Action |
|---|---|---|
| "The repo always uses develop, I can hardcode it" | Any repo could be different. Detection takes 2 seconds. | MUST detect with git ls-remote |
| "I'll skip the post-create verification" | GitHub defaults to wrong bases frequently. The PR ends up merging into the wrong branch. | MUST verify with gh pr view --json baseRefName |
| "Scope is optional, nobody will notice" | PR validation workflow will block it and waste everyone's time. | MUST include scope from allowlist |
| "I'll guess the scope, it looks right" | Guessing breaks validation. Ask the user if ambiguous. | MUST use only allowlist scopes |
| "No PR template? I'll skip the body" | A minimal body is always better than an empty one. | MUST use default structure if no template |
| "Already opened PR, base looks fine" | GitHub silently defaults to wrong base. Verify explicitly. | MUST run gh pr view --json baseRefName |
npx claudepluginhub p/lerianstudio-ring-default-defaultCreates a pull request using the repo's PR template. Use when the user wants to open or submit a PR without immediately merging it. SKIP for end-to-end ship flows; use `ship` instead.
Creates a pull request from the current branch with unpushed commits, auto-detecting the base branch and using PR templates when available.
Creates GitHub Pull Requests using GitHub CLI: detects existing PRs for branches, pushes changes, generates titles/bodies from commits. Handles monorepos/submodules. Use for /create-pr or PR/review requests.