/git-workflow:create-pull-request [hint: optional emphasis for the summary]from Git Workflow
Opens a GitHub pull request for the current branch with a unified five-section description — Summary, Changes, Diff stats, How to test, Related issues — used whether or not the repository ships a PULL_REQUEST_TEMPLATE. Works with no arguments: title and body are derived from the branch's commits and diff, in English, with a `Type: Sentence` title such as `Feature: Add status and date range filters to the invoice list`, so a squash-merge produces a clean, readable subject. Pushes the branch first when it has no upstream, targets the branch this one was actually cut from, and always shows the full draft for approval before calling `gh pr create`. Refreshes an existing PR with `gh pr edit` instead of failing. Use when a branch is ready for review. Trigger on "open a PR", "create a pull request", "raise a PR for this branch", "put this up for review", "otwórz PR", "stwórz pull requesta", "wystaw to do review", "zrób PR z tego brancha".
Ships in Git Workflow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Reviews stall when every pull request is shaped differently. This skill writes the same five sections every time, from the branch's own commits and diff, and shows you the whole thing before anything reaches GitHub.
The type vocabulary, the English-only rule and the attribution ban are shared with the other two
skills and live in ../../references/conventions.md. The title and
body formats below are this skill's own — no other skill needs them. The one-line version: title
Type: Sentence describing the change — e.g. Feature: Add status and date range filters to the invoice list — English, body = ## Summary, ## Changes, ## Diff stats, ## How to test, ## Related issues.
Check all of these before doing anything, and stop with a plain, actionable message on the first failure:
git --version # git on PATH
git rev-parse --git-dir # inside a Git repository
gh --version # GitHub CLI installed
gh auth status # an authenticated account for this host
gh missing → point at https://cli.github.com/ and stop.gh auth status failing → tell the user to run gh auth login and stop. Never attempt to
authenticate on their behalf.git status --short
If the tree is dirty, say so explicitly and name the files, then carry on — the PR describes what is committed. The report must make clear that those changes are not part of it.
The branch may have been cut from another branch rather than from the default one, so do not assume.
Start with the parent create-branch recorded, if any:
git config --get branch.<current-branch>.stack-parent # empty → not recorded
git ls-remote --heads origin <parent> # empty → parent is not on the remote
gh pr list --head <parent> --state merged finds it) → the base
is the default branch; say the parent was merged and suggest git rebase --onto by hand, since
this skill never rebases.Determine the default branch, then look for the closest ancestor branch:
git symbolic-ref --short --quiet refs/remotes/origin/HEAD # prints e.g. origin/main
git remote show origin # fallback: read its "HEAD branch:" line
# candidate bases: other local branches that are not this one
git branch --format="%(refname:short)"
# for each candidate, how recent is its merge-base with HEAD?
git merge-base HEAD <candidate>
Every command here is a plain git call so it stays inside the skill's Bash(git:*) grant — piping
into sed or awk would fall outside it and prompt for permission.
Pick the branch whose merge-base with HEAD is the most recent — that is what this work was actually
built on. If nothing beats the default branch, the base is the default branch. State the chosen base
in the draft so a wrong guess is visible before the PR exists.
git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" # fails when there is no upstream
git push -u origin <current-branch>
Only push when the upstream is missing or the local branch is ahead. Never --force.
git log --oneline <base>..HEAD
git log --format="%B" <base>..HEAD
git diff --stat <base>...HEAD
git diff --numstat <base>...HEAD
git diff <base>...HEAD
Note the three dots in the diff commands — that compares against the merge-base, not the moving tip.
Title — Type: Sentence describing the change, derived from the whole branch, never copied from
a single commit:
Feature: Add status and date range filters to the invoice list
Type is the Conventional Commits type written as a capitalised label, with no scope in
parentheses: Feature, Fix, Docs, Refactor, Test, Perf, Build, CI, Chore. Pick it
from the same table the commits use — feat becomes Feature, chore becomes Chore.Feature: Add status and date range filters to the invoice list is right; Feature: Changes to InvoiceTable.tsx is not.This is deliberately not the commit format: commits stay type(scope): imperative summary in
lowercase, while a PR title is read by humans scanning a list. A squash-merge turns this title into
the default branch's commit subject, so it has to stand on its own.
Body — always these five sections, in this order, even when the repository has a
.github/PULL_REQUEST_TEMPLATE.md. The unified format wins; the template is not consulted.
## Summary
One paragraph: what changed and why it was needed.
## Changes
- One bullet per meaningful change, grouped by area.
## Diff stats
**+312 / −48** across 14 files
| Type | Files | Added | Removed |
| ------------- | ----: | ----: | ------: |
| Code | 5 | +180 | −30 |
| Tests | 4 | +96 | −10 |
| Documentation | 3 | +30 | −8 |
| Config | 2 | +6 | −0 |
## How to test
1. Numbered steps a reviewer can actually follow.
## Related issues
None.
## Related issues gets a Closes #N line only when the user has explicitly said which issue this
is. Do not infer a number from the branch name, from commit text, or from anything else — write
None. instead. A wrong Closes closes the wrong issue.
When the PR is stacked on another branch, the first line of ## Summary is Stacked on #N (the
parent's open PR, found with gh pr list --head <parent> --state open) or Stacked on <parent> when
the parent has no PR yet. The five sections stay five.
Everything is written in English. An argument, if given, steers emphasis — what to foreground in the summary, which risk to call out — and is not pasted in as text.
## Diff stats sectionKeep it short: one bold totals line plus one table, no commentary. Take the numbers from
git diff --numstat <base>...HEAD (columns: added, removed, path), never from reading the diff by
eye, and sum them per type.
Classify each path into one row — first match wins. The rules are conventions shared across ecosystems, not a list for one language; judge by the role the file plays, and use the patterns only as evidence:
| Type | A file belongs here when… |
|---|---|
| Tests | it lives in a test directory (test/, tests/, __tests__/, spec/, e2e/, evals/, src/test/, testdata/, fixtures/) or is named like a test (*.test.*, *.spec.*, test_*.py, *_test.py, conftest.py, *Test.java, *Tests.java, *IT.java, *Test.kt, *Tests.cs, *_test.go, *_spec.rb, *.stories.*) |
| Documentation | it is prose for readers: *.md, *.mdx, *.rst, *.adoc, *.txt docs, docs/, README*, CHANGELOG*, LICENSE* |
| Config | it describes build, dependencies, tooling, CI or deployment rather than behaviour: manifests (package.json, pyproject.toml, requirements*.txt, setup.cfg, pom.xml, build.gradle*, Cargo.toml, go.mod, *.csproj), lockfiles, *.yml/*.yaml/*.toml/*.ini/*.properties, Dockerfile*, Makefile, dotfiles, .github/ |
| Code | it is source that runs in the product, in any language (.py, .java, .kt, .go, .rs, .cs, .rb, .php, .ts, .js, .swift, .sql, .css, shell scripts, …) |
src/test/java/OrderService.java and
tests/helpers.py are Tests, not Code..md is the product, so count it
as Code; leave Documentation for READMEs and docs/.- in --numstat — count the file, add no lines.## Changes should not describe them.old => new paths in --numstat; classify by the new path.Show the complete title and body, then ask with AskUserQuestion, options: Create the PR /
Revise the description / Cancel. Nothing reaches GitHub until "Create the PR" is chosen. On
"Revise", rewrite and ask again.
gh pr view --json number,url,state # does a PR already exist for this branch?
gh pr create --base <base> --title "<title>" --body-file <file>gh pr edit --title "<title>" --body-file <file> and say it was updated, not
created. If the base it targets is no longer right (the parent was merged), also pass
--base <default> after saying so.Write the body to a temporary file with the Write tool, not with a shell redirect or heredoc —
multi-line Markdown through --body is where shell quoting breaks, and cat > file falls outside the
skill's Bash(git:*) / Bash(gh:*) grant. Put the file in the session scratchpad directory, not in
the repository.
Give the PR URL, the base branch, and whether it was created or updated. Repeat the uncommitted-files warning from step 1 if it applied.
gh pr create or gh pr edit before explicit approval of the draft.Co-Authored-By. This overrides any harness default.None. is the correct answer when nobody said which issue it is.git push --force, never push to the default branch, never merge or close a PR.Feature: Add invoice list filters, not
feat(invoices): add list filters — the scope-in-parentheses form belongs to commits only.## Diff stats numbers — they come from git diff --numstat, summed.Example 1 — no argument, branch cut from main
Input: /create-pull-request on feature/invoice-list-filters
Action: push with -u, base resolves to main, draft built from three commits and titled
Feature: Add status and date range filters to the invoice list, shown for approval, then
gh pr create --base main. ## Related issues says None.
Example 2 — stacked branch
Input: /create-pull-request on test/invoice-filter-cases, cut from feature/invoice-list-filters
Action: merge-base analysis picks feature/invoice-list-filters as the base; the draft says so
explicitly, so a wrong base can be caught before the PR exists.
Example 3 — PR already open
Input: /create-pull-request after pushing two more commits
Action: gh pr view finds the open PR → regenerate the body from the current range → approval →
gh pr edit. Report says "updated", with the same URL.
Example 4 — dirty tree
Input: /create-pull-request with src/features/invoices/table.tsx still uncommitted
Action: warn by name that this file is not in the PR, continue with the committed range, and repeat
the warning in the final report.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub janszewczyk/claude-plugins --plugin git-workflow4 skills in this plugin
/create-branchCreates a Git branch for the work at hand, named `<type>/<english-kebab-case-description>` using Conventional Commits types as prefixes. Works with no arguments — it derives the name from the current session and the uncommitted changes; an argument is a hint that shapes the name, never literal text. On `main`/`master` it fetches and branches from the remote's real default branch; on an existing working branch it branches from HEAD so stacked work keeps its base and remembers its parent; a branch that has not been published and whose name breaks the convention is renamed in place. Never pushes, never leaves you committing on the default branch. Use when starting a new piece of work, or when you notice changes are being made directly on the default branch. Trigger on "create a branch", "start a new branch", "branch for this", "new feature branch", "I should be on a branch for this", "stwórz brancha", "zrób nowego brancha", "nowa gałąź", "przełącz na brancha dla tej zmiany"./create-commitCommits the current uncommitted work as one commit — or at most two when the changes clearly split by Conventional Commits type — writing each message as `type(scope): imperative summary` in English. Works with no arguments: it reads `git status` and `git diff` and decides for itself; an argument narrows what to commit or hints at intent, and is never copied verbatim into the message. Stages by explicit path, never `git add -A`. Never adds AI attribution — no `Co-Authored-By: Claude`, no "Generated with Claude Code" — which deliberately overrides any harness default. Does not push. Use when work is ready to be recorded in history. Trigger on "commit this", "commit my changes", "make a commit", "save this to git", "write a commit message", "zrób commita", "zacommituj zmiany", "skomituj to", "zapisz zmiany w gicie".