github-pr-create
Skill19 starsChanged 34 days agoMITView on GitHub
Check whether a pull request already exists for the current branch. Create one if it does not, and keep its body up to date with the commits on the branch. The body is built one of two ways, depending on whether the repository defines a pull request template: - Template mode — a .github/PULL_REQUEST_TEMPLATE.md file exists. The PR body is built from that template (see Template Mode). - Commit mode — no template file exists. The PR body is built…
- Commits and pushes
2 other projects use a version of this.
Adopted by
Most recently taken up by
- mpagot/os-autoinst-distri-opensuse-skillstheir own version, first seen Oct 6, 2026
- mjun0812/skillstheir own version, first seen Aug 25, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- mpagot/os-autoinst-distri-opensuse-skills★ 4same name
- mjun0812/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- ai-teamSkill
- architecture-decision-recordsSkill
- git-commitSkill
- github-pr-review-reviewsSkill
- github-pr-reviewSkill
- grill-meSkill
- jira-create-ticketSkill
- sre-analyze-alertSkill
- sre-grafana-dashboardSkill
- sre-grafanaSkill
- sre-kubernetes-rightsizingSkill
- sre-kubernetesSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Check whether a pull request already exists for the current branch.
- Very specific: line 27
When .github/PULL_REQUEST_TEMPLATE.md exists, use it as the source of the PR body:
- Distinctive: line 30
Start from the exact contents of the template file.
- Distinctive: line 41
When updating an existing PR, refresh only the parts derived from commits (e.g.
- Distinctive: line 48
When no template file exists, the pull request body is built from all commits on the branch.
- Distinctive: line 96
Check for an existing pull request:
- Distinctive: line 102
If no pull request exists (the command above fails), ask the user whether one should be created.
- Distinctive: line 113
If a pull request already exists, refresh its body:
- Distinctive: line 132
Leave the title unchanged unless the first commit's subject changed.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub Pull Request Creation
Check whether a pull request already exists for the current branch. Create one if it does not, and keep its body up to date with the commits on the branch.
The body is built one of two ways, depending on whether the repository defines a pull request template:
- Template mode — a
.github/PULL_REQUEST_TEMPLATE.mdfile exists. The PR body is built from that template (see Template Mode). - Commit mode — no template file exists. The PR body is built from the branch's commit messages (see Commit Mode).
Template Mode
When .github/PULL_REQUEST_TEMPLATE.md exists, use it as the source of the PR
body:
- Start from the exact contents of the template file. Keep its headings, section order, comments, and checklist items intact.
- Fill in the template's sections using information derived from the branch's commits — e.g. write the summary/description from the commit subjects and bodies, and tick any checklist items that the commits clearly satisfy. Do not paste the raw commit log in place of the template; preserve the template's structure.
- For sections you cannot confidently fill from the commits, ask the user for the missing information and use their answer to complete the section. If the user does not provide it, leave the section as it is in the template (keep the placeholder text or empty checkboxes) so the author can complete it later.
- When updating an existing PR, refresh only the parts derived from commits (e.g. the description) so they reflect every commit on the branch. Preserve any content a human already filled into other sections; do not overwrite the whole body back to the blank template.
Commit Mode
When no template file exists, the pull request body is built from all commits on the branch. Each commit contributes its full message (subject line, blank line, body), and commits are separated from one another by blank lines, in chronological order (oldest first):
subject of commit 1
body of commit 1
subject of commit 2
body of commit 2The body must be built from the exact bytes of each commit message,
including the 72-character wrapping. Do not re-flow, unwrap, or re-format the
text. Always pipe it into --body-file - (inline --body "..." risks stripping
or normalizing the hard line breaks).
Steps
Determine the base branch:
base="$(gh pr view --json baseRefName --jq .baseRefName 2>/dev/null \ || git remote show origin | sed -n 's/.*HEAD branch: //p')"- Build the body into a temporary file, choosing the mode by whether a template
exists:
Template mode (
.github/PULL_REQUEST_TEMPLATE.mdexists): start from the template and fill its sections from the branch commits, as described in Template Mode. Use the commits for reference:git log --reverse --format='%B%n' "origin/$base..HEAD"Commit mode (no template): build the body from the raw commit messages.
%Bis a commit's raw message (subject + blank line + body), and the trailing%n%nseparates consecutive commits with a blank line:git log --reverse --format='%B%n' "origin/$base..HEAD"
Check for an existing pull request:
gh pr view --json urlIf no pull request exists (the command above fails), ask the user whether one should be created. Only continue if the user confirms. Create it as a draft, using the first commit's subject as the title and the body built in step 2 (pipe the body in via
--body-file -):title="$(git log --reverse --format='%s' "origin/$base..HEAD" | head -n1)" # <body-source> is the template-filled body or the commit log, per step 2. <body-source> | gh pr create --draft --title "$title" --body-file -If a pull request already exists, refresh its body:
In commit mode, regenerate the body so it includes every commit on the branch (this matters when the branch has more than one commit, or after adding commits to an existing pull request):
git log --reverse --format='%B%n' "origin/$base..HEAD" | gh pr edit --body-file -In template mode, refresh only the commit-derived sections of the existing body and preserve everything the author already filled in, then update it:
# <updated-body> keeps the template structure and human-authored content, # refreshing only the commit-derived sections. <updated-body> | gh pr edit --body-file -
Leave the title unchanged unless the first commit's subject changed. If a single commit has no body, its contribution is just the subject line.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

