git-create-pr
Installation
SKILL.md
Create Pull Request
Create a GitHub Pull Request following conventional commits, pre-filled with the repo's PR template, and opened in the browser for final review.
Every PR bullet must map to an actual commit or diff hunk: drop claims you can't back with evidence in git log or git diff.
Invariant: never mutate the user's files to satisfy a precondition. If a check in step 1 fails, report it and stop. Do not run git checkout, git restore, git reset, git stash, or git clean against the user's tracked files to "fix" a dirty tree, and do not switch branches to route around a main/master check, those are the user's decisions, not this skill's. The only git commands this skill runs against the working tree are read-only until step 7's git push.
Workflow
- Validate preconditions (run this before anything else, including branch analysis)
- Check working tree is clean:
git status --porcelain. Any output means it's dirty.- If dirty: stop immediately. Show the
git status --porcelainoutput and tell the user to commit or stash their changes first, e.g.Working tree has uncommitted changes: M README.md. Commit or stash before opening a PR.Do not proceed to step 2, and do not touch the listed files.
- If dirty: stop immediately. Show the
- Get current branch:
git branch --show-current.- If it's
mainormaster: stop immediately. Tell the user there's no feature branch to open a PR from, e.g.Currently on main — check out a feature branch first.Do not proceed.
- If it's
- Check commits exist:
git log origin/<base>..HEAD --oneline. If empty, stop and say there's nothing to open a PR for. - Extract ticket ID from branch name (e.g.,
ABC-123fromfeature/ABC-123_description)
- Check working tree is clean: