Create a Pull Request from a Feature Branch

VerifiedCaution

Prepares commits on a feature branch, generates a PR title and description from the diff, and opens a pull request against upstream.

Sby Skills Guide Bot
DevelopmentIntermediate
9/19/2026
Claude Code
#pull-request#git#github-cli#fork-workflow#rust

Recommended for

Automated summary

Automates preparing a pull request from a feature branch to the upstream repository, generating the title and description from the branch's commits.

Strengths

  • Checks fork-workflow prerequisites: not on main, and both upstream and origin remotes present
  • Runs cargo fmt and amends the last commit when only formatting changes remain
  • Uses the merge base against upstream/main so only the branch's own commits are included
  • Shows the generated title and body for review before pushing and creating the PR

Limitations

  • Assumes a Rust project with cargo fmt and a fork layout with upstream/origin remotes
  • Requires the gh CLI to be installed and authenticated
  • Base branch is hardcoded to main, and the amend step rewrites the last local commit
When to use it

Use it when your feature branch is ready and you want a formatted, well-described PR opened against the upstream repository.

When not to use it

Don't use it on the main branch, in repos without an upstream/origin fork setup, or on non-Rust projects where cargo fmt does not apply.

Security analysis

Caution
Quality score88/100

The skill uses powerful version-control and GitHub CLI operations for a legitimate PR workflow. It does not exfiltrate data or perform destructive system actions, but the automatic commit amendment and remote pushes warrant caution.

Findings
  • •Executes git and gh CLI commands that push branches and create pull requests, modifying remote repositories.
  • •Automatically amends the last commit after running cargo fmt, which rewrites local history.
  • •No allowed-tools are declared in the skill metadata despite instructing shell commands.
How this analysis is made

Examples

Auto-generated PR
/pr
PR with custom title
/pr Fix saturation search convergence
Natural-language request
Open a pull request from my current feature branch against upstream and write the description from the commits.

name: pr description: Prepare outstanding commits on a feature branch for a pull request to upstream

Prepare a pull request from the current feature branch. This skill collects all commits on the current branch that are ahead of upstream/main, generates a PR title and description summarizing the changes, and creates the PR against upstream.

Arguments

The skill accepts optional arguments:

  • No arguments: auto-generate title and description from commits
  • A short description: used as the PR title (e.g., /pr Add support for TLS client certs)

Example: /pr or /pr Fix saturation search convergence

Steps

  1. Verify prerequisites:

    • Must NOT be on main branch (should be on a feature branch)
    • The upstream remote must exist
    • The origin remote must exist
    BRANCH=$(git branch --show-current)
    if [ "$BRANCH" = "main" ]; then
      echo "Error: Must be on a feature branch, not main"
      exit 1
    fi
    git remote get-url upstream >/dev/null 2>&1 || { echo "Error: 'upstream' remote not found"; exit 1; }
    git remote get-url origin >/dev/null 2>&1 || { echo "Error: 'origin' remote not found"; exit 1; }
    
  2. Run cargo fmt and amend the last commit if formatting changes are needed:

    cargo fmt
    if [ -n "$(git status --porcelain)" ]; then
      git add -u
      git commit --amend --no-edit
    fi
    

    After this step, the working directory must be clean. If there are still uncommitted changes (non-formatting), stop and tell the user to commit or stash them first.

  3. Sync with upstream:

    git fetch upstream
    git fetch origin
    
  4. Identify commits for the PR:

    • Find the merge base between the current branch and upstream/main
    • List all commits from the merge base to HEAD
    • Show the full diff against upstream/main
    MERGE_BASE=$(git merge-base upstream/main HEAD)
    git log --oneline ${MERGE_BASE}..HEAD
    git diff ${MERGE_BASE}..HEAD --stat
    

    If there are no commits ahead of upstream/main, stop and tell the user there is nothing to submit.

  5. Generate PR title and description:

    • If the user provided a title argument, use that as the PR title
    • Otherwise, analyze the commits and diff to generate a concise PR title (under 70 characters)
    • Generate the PR body with:
      • A ## Summary section with 1-3 bullet points describing the changes
      • A ## Changes section listing the commits
      • A ## Test plan section with a checklist of testing suggestions

    Present the title and body to the user for review before creating the PR.

  6. Push the feature branch to origin:

    BRANCH=$(git branch --show-current)
    git push -u origin ${BRANCH}
    
  7. Create the PR against upstream:

    BRANCH=$(git branch --show-current)
    
    gh pr create \
      --repo "$(git remote get-url upstream | sed 's/.*github.com[:/]\(.*\)\.git/\1/' | sed 's/.*github.com[:/]\(.*\)/\1/')" \
      --head "$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/' | sed 's/.*github.com[:/]\(.*\)/\1/' | cut -d/ -f1):${BRANCH}" \
      --base main \
      --title "${PR_TITLE}" \
      --body "${PR_BODY}"
    
  8. Report the PR URL to the user.

Troubleshooting

  • No upstream remote: Add it with git remote add upstream <repo-url>
  • No origin remote: This is your fork. Add with git remote add origin <fork-url>
  • gh CLI not installed: brew install gh or see https://cli.github.com/
  • Not authenticated with gh: gh auth login
  • PR already exists: If a PR already exists for this branch, report the existing PR URL instead

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/create-a-pull-request-from-a-feature-branch-mu7w4fqq/download' --output '.skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq/SKILL.md.part' && mv '.skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq/SKILL.md.part' '.skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq/SKILL.md' && test -s '.skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/pr' && cp -R '.skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq' '.claude/skills/pr'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq'

openskills read 'create-a-pull-request-from-a-feature-branch-mu7w4fqq'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/create-a-pull-request-from-a-feature-branch-mu7w4fqq/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills