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 (not main)
- Complete all phases through
/document
- Run
/pr to 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 targets main
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
main doesn't exist
- The
gh pr create command 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 --base argument for gh pr create and 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.
PR skill assumes
mainas default branch instead of detecting itSummary
The
/prskill hardcodesmainas 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
dev(notmain)/document/prto create the pull requestdev), but when constructing the PR and compare URLs, it targetsmainExpected Behavior
The PR skill should detect the upstream repo's default branch (via
gh api repos/{owner}/{repo} --jq '.default_branch'orgit remote show origin) and use that as the PR base branch.Actual Behavior
main:.../compare/main...fork:branchmaindoesn't existgh pr createcommand also uses--base main, which failsRoot Cause
The PR skill (
.claude/skills/pr/SKILL.md) and/or the workflow's PR creation logic assumes the base branch ismainrather 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
Use the result as the
--baseargument forgh pr createand in compare URLs.Context
Encountered while running the bugfix workflow against
anomalyco/opencode, which usesdevas 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 nonexistentmainbranch.