--- name: pr-workflow description: Git workflow for pushing code and opening pull requests on GitHub. ALWAYS use this before you git push, push to a remote, open or create a pull request, raise a PR, or "ship" code. Covers confirming the user actually asked to push, cutting a Conventional-Commits feature branch off main, writing a Conventional-Commit PR title, and using the repo's .github PR template as the body. Use whenever the user says push, ship, open/create a PR, raise a pull request, or commit-and-push. --- ## Workflow 1. **Confirm the user asked — in their latest message.** Pushing to a remote / opening a PR is outward-facing and hard to undo. Do it only when the user's *most recent* request actually says to push, ship, or open a PR. Approval from an earlier turn does **not** carry forward — "make the change" is not "push it." If you finished work and the user didn't ask to push, **stop and ask.** Never push proactively. 2. **Branch off the default branch.** Unless the user explicitly says to push straight to main (e.g. "commit straight to main", "push to main directly"), create a feature branch named with Conventional Commits: `/`, e.g. `feat/add-logout-button`. 3. **Commit with a Conventional Commit message**, then push the branch. **Always make a new commit.** Never force-push (`git push --force` / `--force-with-lease`) and never amend (`git commit --amend`) or otherwise rewrite existing commits — unless the user explicitly asks for it in their latest message. To update a PR or fix a previous commit, add another commit and push normally. 4. **Open the PR** with a Conventional-Commit title (`[(scope)][!]: `, e.g. `feat(auth): add OAuth login`). For the body: if a `.github` PR template exists, use it **verbatim** and add **no** extra sections, summaries, or "test plan" fields. If there's no template, keep the body to a one-line description — don't invent a template. `type` is one of: `feat fix docs style refactor perf test build ci chore revert`. ## Notes - **Default branch:** the base for the PR is the repo's default branch — read it from `origin/HEAD`, falling back to `main`. - **Branch names:** lowercase the description, replace spaces and punctuation with dashes, prefix the type — `"Add Login (OAuth)"` with type `feat` → `feat/add-login-oauth`. - **Finding the PR template:** check `.github/PULL_REQUEST_TEMPLATE.md` first, then the lowercase variant, then the repo root, then `docs/`. The `.github/PULL_REQUEST_TEMPLATE/` directory form holds multiple templates — if the repo uses it, pass the chosen file to `gh pr create --body-file`. - **Opening the PR:** `gh pr create --base --title ""` with `--body-file