Skip to content

Bugfix workflow: PR skill assumes main as default branch #85

@jwm4

Description

@jwm4

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

  1. Run the bugfix workflow against a repo whose default branch is dev (not main)
  2. Complete all phases through /document
  3. Run /pr to create the pull request
  4. 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:

  1. Query the upstream default branch:

    gh api repos/{owner}/{repo} --jq '.default_branch'

    or

    git remote show origin | grep 'HEAD branch' | awk '{print $NF}'
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions