piv-create-pr

Push the current feature branch and open a GitHub pull request with a structured body.

Updated Aug 28, 2026
One-click install
npx skills add https://github.com/az9713/claude-code-hooks-tutorial --skill piv-create-pr-az9713
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: piv-create-pr
Source: https://github.com/az9713/claude-code-hooks-tutorial/tree/main/skills/.claude/skills/piv-create-pr
Command: npx skills add https://github.com/az9713/claude-code-hooks-tutorial --skill piv-create-pr-az9713

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? After finishing a ticket on a feature branch, developers still need to detect the correct base branch, validate git state, push, and write a clear PR body by hand. This Skill automates that entire handoff step so the pull request is opened consistently and ready for review. ## Core Features & Use Cases - Base branch auto-detection: Resolves the target branch via --base argument, git symbolic-ref, or remote HEAD inspection instead of hardcoding main. - Git state validation: Stops early when on the base branch, when uncommitted changes exist, when there are no commits ahead, or when a PR already exists for the branch. - Structured PR body generation: Builds a body with summary, what changed, validation status, reviewer notes, and linked tickets, honoring .github/PULL_REQUEST_TEMPLATE.md and project conventions in .claude/references/conventions.md. - Use Case: After committing a feature on branch ACC-123-login-fix, run the Skill to push the branch, open a PR against the detected base, and receive the PR URL to hand to the piv-review-pr gate and a human reviewer. ## Quick Start Ask the agent to create a pull request for the current feature branch, optionally specifying a base branch with --base.

Frequently Asked Questions about piv-create-pr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I open a GitHub pull request from the command line?▼

Use the gh CLI: push your branch with git push -u origin HEAD, then run gh pr create with a base branch, title, and body. This Skill automates that sequence, including base-branch detection and body generation.

How to auto-detect the default base branch in git?▼

Run git symbolic-ref refs/remotes/origin/HEAD to read the remote's default branch, or fall back to git remote show origin and parse the HEAD branch line. The Skill tries these in order before defaulting to main.

Does this work with GitLab or only GitHub?▼

The Skill uses the GitHub gh CLI, but the same motion applies to GitLab as opening a merge request. The underlying git validation and push steps are platform-agnostic; only the PR creation command differs.

What happens if a pull request already exists for my branch?▼

The Skill checks with gh pr list --head for the current branch before creating anything. If a PR already exists, it stops and prints the existing PR URL instead of opening a duplicate.

Why does PR creation stop with uncommitted changes?▼

The Skill validates git status before pushing and halts if the working tree is dirty, since uncommitted changes would be excluded from the PR. Commit or stash your changes, then rerun the Skill.