---
description: "Create a GitHub PR from current branch with unpushed commits — discovers templates, analyzes changes, pushes"
---

# Create Pull Request

Create a GitHub Pull Request from the current branch.

## Usage

`/pr [base-branch] [--draft]`

- `base-branch`: target branch (default: `main`)
- `--draft`: create as draft PR

## Workflow

### Phase 1 — Validate

- Not on base branch [PASS]
- Clean working directory [PASS]
- Has commits ahead of base [PASS]
- No existing PR for this branch [PASS]

### Phase 2 — Discover

- Find PR template (`.github/PULL_REQUEST_TEMPLATE.md`, etc.)
- Analyze commits with `git log`
- Categorize changed files (source, tests, docs, config)
- Check for planning artifacts (PRDs, plans)

### Phase 3 — Push

```bash
git push -u origin HEAD
```

### Phase 4 — Create

```bash
gh pr create --title "<title>" --base <base> --body "<body>"
```

### Phase 5 — Verify

```bash
gh pr view --json number,url,state
```

## Related

- Skill: `skill://writing-plans` (PR creation section)
- Command: `/code-review <number>` (review the PR)
