--- name: github-create-pr description: > Creates a pull request using GitHub CLI by following every numbered step in order. Do not skip steps. Do not improvise — execute the workflow literally. Activate when the user says "create PR", "open PR", "push and PR", "submit for review", or work is ready for review. metadata: version: "1.0.0" tags: "category:workflow, tool:git, tool:github" --- # Create Pull Request Open a pull request for the current branch using `gh`. ## Steps 1. **Check for uncommitted changes** — Run `git status --short`. If output is non-empty, show the list and ask: "There are uncommitted changes. Commit and include them, or create the PR without them?" Do not proceed without an answer. 2. **Verify branch** — Run `git branch --show-current`. If on `main` or `master`, stop and warn: "You are on the default branch. Create a feature branch first." 3. **Check remote state** — Run `git status -sb` to detect if the branch is behind the remote. If behind, warn and ask whether to pull first. 4. **Check for existing PR** — Run: ```bash gh pr list --head $(git branch --show-current) ``` If a PR already exists, show its URL and ask: "A PR already exists for this branch. Open it instead?" 5. **Run verification** — Check AGENTS.md or the project's build/test configuration for pre-push steps. Run them. If any fail, stop and fix before pushing. 6. **Push the branch** — Run: ```bash git push -u origin $(git branch --show-current) ``` If push fails, report the error and suggest fixes (force push not allowed without explicit permission). 7. **Analyze changes** — Run: ```bash git log main..HEAD --oneline git diff main --stat ``` Use this to understand the scope and write an accurate PR description. Do not guess — base the description on actual changes. 8. **Create the PR** — Run: ```bash gh pr create --title "