pr-from-branch
Skill1 starsChanged 4 months agoApache-2.0View on GitHub
Use when the user wants to draft a GitHub pull request title and body from the current branch, choose existing repo labels, and open the PR with gh after confirmation.
- Commits and pushes
In this repository13 other files it gives its agents.
- feature-development-workflowSkill
- gh-release-train-mergeSkill
- github-project-boardSkill
- implement-issueSkill
- nist-buildSkill
- nist-designSkill
- nist-planSkill
- nist-releaseSkill
- nist-respondSkill
- nist-testSkill
- plan-to-issueSkill
- prettifySkill
- release-candidate-reviewSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Verify first. If any check fails, stop and report what is missing.
- Very specific: line 20
If gh is missing, direct the user to https://cli.github.com/ and gh auth login.
- Distinctive: line 26
If the user provides a base branch argument, use it.
- Very specific: line 29
Verify origin/<base> exists before diffing.
- Distinctive: line 41
Stop and report if the checkout is detached, the current branch is the base branch, there are zero commits ahead of base, or the diff is …
- Distinctive: line 49
Use a conventional-commits prefix only if recent merged PR titles use one.
- Distinctive: line 82
Write from the diff, not just commit messages.
- Distinctive: line 86
Only use existing repo labels:
- Very specific: line 98
Do not run gh pr create until the user confirms.
- Very specific: line 102
Write the approved body to a temp file and run gh pr create with one --label flag per confirmed label.
- Distinctive: line 112
After success, print the PR URL.
≈ “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
PR From Branch
Draft a pull request from the current git branch, show the draft to the user, and only create the PR after confirmation.
Prerequisites
Verify first. If any check fails, stop and report what is missing.
git rev-parse --is-inside-work-tree
gh --version
gh auth statusIf gh is missing, direct the user to https://cli.github.com/ and gh auth login.
Gather Branch Context
Resolve the current branch and base branch.
- If the user provides a base branch argument, use it.
- Otherwise auto-detect the GitHub default branch, falling back to
main, thenmaster. - Fetch the base branch.
- Verify
origin/<base>exists before diffing.
Read:
git branch --show-current
git log --reverse --pretty=format:"%h %s%n%b%n---" "origin/<base>..HEAD"
git diff --stat "origin/<base>...HEAD"
git diff --name-only "origin/<base>...HEAD"
git diff "origin/<base>...HEAD"Stop and report if the checkout is detached, the current branch is the base branch, there are zero commits ahead of base, or the diff is huge. For huge diffs, rely on stat, commit messages, touched paths, and sampled key files.
Draft
Title rules:
- Imperative mood, sentence case, no trailing period.
- Aim for about 50 characters; keep under about 72.
- Use a conventional-commits prefix only if recent merged PR titles use one.
- Include ticket references from the branch name when that matches repo convention.
Check recent style:
gh pr list --state merged --limit 10 --json title --jq '.[].title'Body template:
## Summary
<1-3 sentences describing what changed and why>
## Changes
- <Meaningful changes, grouped by area when useful>
## Why
<Optional, only when the motivation is not obvious>
## Test plan
- <Specific commands, scenarios, and tests added>
## Notes
<Optional follow-ups, limits, or review notes>Write from the diff, not just commit messages. Be specific and do not invent rationale.
Labels
Only use existing repo labels:
gh label list --limit 200 --json name --jq '.[].name'Choose area labels by matching touched paths to existing labels. Always add size:patch when it exists; otherwise skip it and mention that in the draft.
Confirm Before Creating
Print the proposed title, body, and labels. Ask the user whether to open the PR as-is, edit it, or change base, draft status, or labels.
Do not run gh pr create until the user confirms.
Create
Write the approved body to a temp file and run gh pr create with one --label flag per confirmed label.
Offer --draft, --reviewer, --assignee @me, or --web when relevant. If the branch is not pushed, let gh push it or push first after user approval.
Handle edge cases explicitly:
- PR already exists: offer
gh pr view --weborgh pr edit. - Uncommitted changes: mention them and ask whether to commit or stash.
- Branch behind base: mention it and offer to rebase or merge.
After success, print the PR URL.
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.

