-
Notifications
You must be signed in to change notification settings - Fork 26
Bugfix workflow: PR skill assumes main as default branch #85
Description
PR skill assumes main as default branch instead of detecting it
Summary
The /pr skill hardcodes main as the target branch for pull requests instead of detecting the upstream repository's actual default branch. This causes PR creation to fail when the upstream uses a different default branch (e.g., dev).
Steps to Reproduce
- Run the bugfix workflow against a repo whose default branch is
dev(notmain) - Complete all phases through
/document - Run
/prto create the pull request - The skill creates the feature branch off the correct local branch (
dev), but when constructing the PR and compare URLs, it targetsmain
Expected Behavior
The PR skill should detect the upstream repo's default branch (via gh api repos/{owner}/{repo} --jq '.default_branch' or git remote show origin) and use that as the PR base branch.
Actual Behavior
- The PR compare URL targets
main:.../compare/main...fork:branch - GitHub shows "there isn't anything to compare" because
maindoesn't exist - The
gh pr createcommand also uses--base main, which fails
Root Cause
The PR skill (.claude/skills/pr/SKILL.md) and/or the workflow's PR creation logic assumes the base branch is main rather than querying the actual default branch of the target repository.
Suggested Fix
Before constructing the PR:
-
Query the upstream default branch:
gh api repos/{owner}/{repo} --jq '.default_branch'or
git remote show origin | grep 'HEAD branch' | awk '{print $NF}'
-
Use the result as the
--baseargument forgh pr createand in compare URLs.
Context
Encountered while running the bugfix workflow against anomalyco/opencode, which uses dev as its default branch. The branch was pushed successfully but PR creation failed, and the provided GitHub compare URL showed no changes because it referenced a nonexistent main branch.