# Piv Create PR

Push the current feature branch and open a pull request, ready for review.

- Repository: https://github.com/coleam00/skills (726 stars)
- Category: Git and review
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add coleam00/skills --skill piv-create-pr -g -a claude-code -y`
Codex: `npx skills add coleam00/skills --skill piv-create-pr -g -a codex -y`
Cursor: `npx skills add coleam00/skills --skill piv-create-pr -g -a cursor -y`
Gemini CLI: `npx skills add coleam00/skills --skill piv-create-pr -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add coleam00/skills`

## Description

Push the current feature branch and open a pull request, ready for review. Use after a ticket's implementation is committed on its own branch, it detects the base branch, pushes, opens the PR with a clear body (summary · what changed · validation status), and returns the URL to hand to a reviewer.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Create PR: Open the Pull Request, Hand Off for Review

This is the **ship** step of the PIV loop: the implementation is committed on a feature branch; now open the PR
so it can be reviewed (by the `piv-review-pr` agentic gate, then a human).

## Phase 0, Detect the base branch

Don't hardcode `main`. Resolve it:
1. If `$ARGUMENTS` contains `--base <branch>`, use that.
2. Else: `git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'`
3. Fallback: `git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}'`
4. Last resort: `main`. Store as `{base}`.

## Phase 1, Validate git state

```bash
git branch --show-current
git status --short
git log origin/{base}..HEAD --oneline
```

| State | Action |
|-------|--------|
| On `{base}` | STOP: "Create a feature branch first (the ticket should be on its own branch)." |
| Uncommitted changes | STOP: "Commit (or stash) before opening the PR." |
| No commits ahead of `{base}` | STOP: "Nothing to PR." |
| Existing PR for this branch (`gh pr list --head $(git branch --show-current) --json url`) | STOP and print the URL. |
| Clean, commits ahead, no PR | PROCEED |

## Phase 2, Gather context for the body

The rest: https://github.com/coleam00/skills/blob/HEAD/.claude/skills/piv-create-pr/SKILL.md
