pr
Skill9 starsChanged 15 days agoMITView on GitHub
Raises a PR for the current branch, using the repo's PR template if it has one. Opens in the state pr.state sets, draft by default; ready-state in the arguments matches pr.state at ready. Rewrites the title and body if the branch already has a PR.
- Commits and pushes
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Read ${CLAUDE_SKILL_DIR}/../common.md and follow its sections ## Ask the user and ## Settings.
- Very specific: line 25
When the brief's context names a repo directory, run git as git -C <dir> ..., the settings command with <dir> as <root> and every other …
- Very specific: line 37
Before drafting, look for a PR template: a file named pull_request_template.md (any case) in .github/ or the repo root.
- Very specific: line 67
Keep a candidate only once gh issue view (with -R owner/repo for another repo) shows it is open.
- Very specific: line 71
Graft line: Every body, with a template or without, ends with _Graft: AI has reviewed and adversarially reviewed these changes._ verbatim, …
- Distinctive: line 88
Register: Write like a commit message.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Raise a PR
Compose a short PR from the repo template, push, and create it.
Read ${CLAUDE_SKILL_DIR}/../common.md and follow its sections ## Ask the user and ## Settings. Its ## Screenshots and ## My Graft ignore probe apply as ## Screenshots below says.
Arguments: $ARGUMENTS
Start
Get settings, with the cwd as <root>.
node ${CLAUDE_SKILL_DIR}/../settings.ts <root>When the brief's context names a repo directory, run git as git -C <dir> ..., the settings command with <dir> as <root> and every other command as cd <dir> && ..., and read files, the PR template included, by absolute path under <dir>.
The arguments are guidance and may set the state anywhere, such as ready-state, draft or mark it ready. A word that belongs to the guidance stays in it (for example, note the docs are still a draft); ask (routine) when it is unclear, recommending it stays in the guidance.
Preconditions
- Working tree clean, every change committed. If not, stop and say what is uncommitted.
- Branch is not the default branch (
defaultBranchRef.namefromgh repo view --json defaultBranchRef,nameWithOwner, whosenameWithOwneris the base repo). Base is the existing PR's base (gh pr view --json baseRefName --jq .baseRefName) if the branch has one, otherwise the default branch. gh pr viewreports no PR for the branch. If one exists, do not create another: rewrite its title and body and apply them withgh pr edit.
Body
Before drafting, look for a PR template: a file named pull_request_template.md (any case) in .github/ or the repo root.
With a template, follow it exactly: same sections, same order, same headings. Replace each HTML comment with content, then delete the comment. Where the template marks a section optional, keep it only if you fill it. Never add a section the template does not have, and never rename one: no ## Summary, no ## Changes. If the template and this skill disagree, the template wins.
Without a template, the body is:
## What
<2–3 sentences>
## Why
<1–2 sentences>
## How
<1–2 sentences, optionally a high-level mermaid diagram>
Resolves #<issue number>
_Graft: AI has reviewed and adversarially reviewed these changes._## Notes goes between How and the Resolves line, only if earned. No other headings: no summary, testing, dependencies or security section.
Resolves line. One line per issue the PR resolves, before the Graft line: Resolves #123 for a base-repo issue, Resolves owner/repo#123 for one in another repo. Compare issues as owner/repo#N, reading #N as the base repo.
- Gather candidates from the arguments, the session, the branch's commit trailers (
Fixes #N,Closes #N,Resolves #N), the branch name, and the Resolves issues saved on the branch (common.md's## GitHub issue reference handling). - Drop a candidate the branch saves as Related, unless the arguments name it.
- Keep a candidate only once
gh issue view(with-R owner/repofor another repo) shows it is open.
With none left, leave the line out rather than asking or guessing.
Graft line. Every body, with a template or without, ends with _Graft: AI has reviewed and adversarially reviewed these changes._ verbatim, as its own paragraph, without the backticks; only screenshot references may follow it. The brevity budget and the ban on mentioning Claude, AI or attribution do not apply to it.
Caller guidance. A calling skill's guidance can replace the Graft line, start the body with an alert, and require listed items, with a template or without. Listed items go as a bulleted list under Notes, or the template's closest section; the brevity budget, the bullet rule and the section table do not apply to them.
One section, one question.
| Section | Answers | Never contains |
| What | What is observably different for a member or caller | Function, file or component names; how it is built |
| Why | The problem that made the change worth doing | Mechanism |
| How | A non-obvious decision the diff cannot explain: a trade-off, a workaround, a rejected obvious approach | A walkthrough of the diff; a restatement of What |
| Notes | Things seen and deliberately left alone; follow-ups | Anything already in the sections above |
Litmus for mechanism: a sentence with "by …ing", "so that it can", "because the X uses", or the name of an internal component, function or file belongs in How, and probably does not belong at all.
Brevity budget. Ceilings, not targets: the whole body reads in under a minute, about 6 sentences and 900 characters of prose across every section. Splitting a section into two paragraphs buys no room. A single paragraph over 4 sentences or 600 characters is a wall of text. Prefer deleting a sentence to shortening it.
Register. Write like a commit message. Short declarative sentences, present tense, active voice. Cut "this change", "in order to", "it is worth noting", hedges and adverbs.
Wordy: This change introduces a confirmation step so that members are able to cancel before their results are reset.
Terse: Retake asks for confirmation before resetting results.Prose, not bullets. Bullets only for 3 or more genuinely parallel items, and never in What. Test plan is the exception: it uses the template's checklist.
Backticks around symbols, file paths, function names, config keys, commands and flags.
The title and body never mention Claude, AI assistance or attribution. No Co-Authored-By or "Generated with" anywhere.
Title
One line, under 70 characters. Says what changed for the user, not what files moved.
Match the repo's style. Read the last 10 commit subjects on the base (git log -10 --format=%s origin/<base>). If most start with a conventional-commit prefix (fix(scope): …, feat(scope): …, chore: …), use one, with a type that fits the branch as a whole and a scope the repo already uses. Otherwise write a plain imperative title with no prefix: "Add retake confirmation", not "Added retake confirmation".
Screenshots
Run this step only for a direct /graft:pr: not when a brief marks its Context as orchestrate's, and not when the caller sets pr.mode to manual. When pr.mode is auto, run common.md's after-shot step before Create, as a caller with no before state, attach the images it approves as if the arguments asked for screenshots, and follow its Clean-up once Create has run. On a branch that already has a PR, run it only when the arguments ask for screenshots.
Create
git push -u origin <branch>
gh pr create --draft --base <base> --title "<title>" --body "<body>"A new PR opens in the state from the arguments, else in pr.state; drop --draft for ready-state or ready. For an existing PR, only an explicit state changes it, after gh pr edit: ready-state runs gh pr ready and draft runs gh pr ready --undo. With no state, an existing PR keeps its state. Report the PR URL.
Screenshots. When the arguments ask for screenshots, attach each image file with --attach <path> on gh pr create, or gh pr edit for an existing PR (gh 2.99.0+, github.com and GHE Cloud). Reference each one as  with the same path string, at the very end of the body below the Graft line; gh uploads the file and rewrites the reference to its URL. An upload cannot be undone.
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.

