Open a Pull Request from Current Branch

VerifiedCaution

Automates opening a PR to main: commits pending changes, ensures an Nx version plan exists, pushes the branch, and creates the PR with a filled-in description and testing steps.

Sby Skills Guide Bot
DevOpsIntermediate
9/15/2026
Claude Code
#git#pull-request#github-cli#nx#conventional-commits

Recommended for

Automated summary

Automates opening a pull request from the current branch to `main`: branch creation when needed, Nx version plan, commit, push, and a filled-in PR body.

Strengths

  • Runs the whole flow without confirmation prompts, keeping interaction overhead low
  • Checks for an existing Nx version plan and generates one per affected package before pushing
  • Idempotent behaviour: detects an existing version plan or PR and stops instead of duplicating
  • Writes a why-focused description plus concrete testing steps derived from the diff

Limitations

  • Assumes repo-specific conventions: `DLS-<number>` branch prefix, `.nx/version-plans/` directory, and an available `release-plan` skill
  • Does not cover conflict resolution, rebasing, or reviewer assignment
  • Writes the PR body to a fixed temp path `/tmp/pr-body.md`, which can collide across concurrent runs
When to use it

Use it when you are on a feature branch and explicitly ask for a PR targeting `main` to be opened or created.

When not to use it

Avoid it on repositories that do not follow this project's Nx and `main` conventions, or when you want to review and tweak the commit message before it is made.

Security analysis

Caution
Quality score90/100

The skill automates a legitimate development workflow (commit, push, create PR) but involves powerful actions like staging all changes, pushing to remote, and creating a PR without confirmation. It does not perform destructive or exfiltration actions, so it is not risky, but the automatic commit and push warrant caution.

Findings
  • •Automatically stages all changes with `git add -A` and commits without confirmation, which could unintentionally commit sensitive or unrelated files.
  • •Pushes to the remote and creates a PR automatically, which can expose changes publicly without a final review.
  • •Uses GitHub CLI and git commands even though no allowed-tools are declared.
How this analysis is made

Examples

Open the PR
Open a PR from this branch to main.
Commit and ship
Commit my uncommitted changes, push, and create the pull request with a description and testing steps.
Starting from main
I'm on main with uncommitted changes — ticket DLS-1423 — create a branch and open the PR to main.

name: open-pr description: >- Open a PR from the current branch to main: commit if needed, ensure an Nx version plan exists, push, and create the PR with a filled-in description and testing steps. Run only when the user explicitly asks to open/create a PR. disable-model-invocation: true

open-pr

Open a PR from the current branch to main. Commit if needed, push, then create the PR with a filled-in description and testing steps.

Important: Do NOT ask for confirmation at any step. Run the entire flow automatically from start to finish. Only stop and ask the user if something fails or if the branch is main and you need a branch name.

Step 0: Ensure we are on a feature branch

Run git branch --show-current to check the current branch.

  • If already on a feature branch: skip to Step 1
  • If on main: Ask the user for a Jira ticket number, generate a descriptive branch name from uncommitted changes, then create and switch to DLS-<number>-<branch-name>:
    git checkout -b DLS-<number>-<branch-name>
    

Step 1: Ensure an Nx version plan exists

Run:

git diff main...HEAD --name-only -- .nx/version-plans/
  • If the output is non-empty, a version plan already exists — skip to Step 2.
  • Otherwise, create one. The rules — path→package mapping, always-patch, one file per affected package, filename convention — live in the release-plan skill; follow them. In short: look at the changed paths (git diff main...HEAD --name-only), and create one .nx/version-plans/version-plan-<timestamp>-<pkg>.md per affected package with single-package patch frontmatter, using a description line that matches the PR title / commit message style.

Step 2: Create a commit if needed

  • If git status shows nothing to commit, skip to Step 3.

  • If git status shows uncommitted changes (staged or unstaged):

    • Summarise the diff in one short sentence.
    • Generate a conventional commit message (e.g. feat(select): add custom trigger support).
    • Run immediately without asking for confirmation:
      git add -A
      git commit -m "Your generated message"
      

Step 3: Push the branch

Push the branch to the remote (or update it if already pushed):

git push -u origin HEAD

Step 4: Check for an existing PR

Run:

gh pr view --json url
  • If a PR already exists, print the existing PR URL and stop.
  • Otherwise, continue to Step 5.

Step 5: Prepare PR body

  1. Generate the PR body using the following structure:

    ## Description
    
    <!-- Focus on WHY the change is being made — the motivation, problem, or goal.
         Briefly mention what was done only to give context for the why.
         If the change is UI-related, remind to add screenshots. -->
    
    ## How to test
    
    <!-- Add concrete testing steps derived from the changed code.
         e.g. which screen to open, what to tap, what to expect.
         Must be specific enough for a reviewer to follow. -->
    
    ## Screenshots
    
    <!-- Before/after screenshots if UI change, otherwise N/A -->
    
  2. Fill in the template:

    • Description: Analyse the diff against main (git diff main...HEAD). Write a description focused on why the change is being made. Briefly mention what was done to give context.
    • How to test: Derive concrete, specific testing steps from the changed code (e.g. which screen to open, what to interact with, what to expect).
    • Screenshots: If the change is UI-related, add "Add before/after screenshots here"; otherwise write "N/A".
  3. Save the body to /tmp/pr-body.md.

Step 6: Create the PR with GitHub CLI

  1. Generate a PR title using a conventional commit message. Format: <prefix>(<scope>): <summary>. Pick the most appropriate prefix:

    • feat — new feature or user-facing addition
    • fix — bug fix
    • refactor — code restructuring without behaviour change
    • chore — maintenance, dependency updates, CI changes
    • docs — documentation only
    • test — adding or updating tests
    • style — formatting, whitespace, etc.

    Include an optional scope in parentheses when it helps clarify the area (e.g. feat(select): ..., fix(button): ...). The title should be a concise, human-readable summary.

  2. Run:

    gh pr create --title "<generated title>" --base main --body-file /tmp/pr-body.md
    

    If gh is not installed or not authenticated, tell the user to install the GitHub CLI and run gh auth login, then rerun the command.

  3. Output the PR link. After the PR is created, print a clickable link to the PR URL.

  4. Clean up by deleting /tmp/pr-body.md.

Summary

  1. Ensure we are on a feature branch (create one if on main).
  2. Ensure an Nx version plan exists in .nx/version-plans/ — create one if missing, based on affected packages and change type.
  3. If there are uncommitted changes, create a commit with a clear conventional message.
  4. Push the branch to the remote.
  5. Check if a PR already exists — if so, skip creation and print the URL.
  6. Build the PR body with Description (why), How to test (concrete steps), and Screenshots.
  7. Run gh pr create --base main --body-file /tmp/pr-body.md and output a clickable link to the created PR.
  8. Delete the temporary body file.

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/open-a-pull-request-from-current-branch-mu26hank/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/open-a-pull-request-from-current-branch-mu26hank' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/open-a-pull-request-from-current-branch-mu26hank/download' --output '.skill-downloads/open-a-pull-request-from-current-branch-mu26hank/SKILL.md.part' && mv '.skill-downloads/open-a-pull-request-from-current-branch-mu26hank/SKILL.md.part' '.skill-downloads/open-a-pull-request-from-current-branch-mu26hank/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/open-a-pull-request-from-current-branch-mu26hank/SKILL.md' && test -s '.skill-downloads/open-a-pull-request-from-current-branch-mu26hank/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/open-pr' && cp -R '.skill-downloads/open-a-pull-request-from-current-branch-mu26hank' '.claude/skills/open-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/open-a-pull-request-from-current-branch-mu26hank'

openskills read 'open-a-pull-request-from-current-branch-mu26hank'

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/open-a-pull-request-from-current-branch-mu26hank/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