Catalogue / branch-to-pr-copy
branch-to-pr-copy
Older skill: source not recordedSignedDrafts paste-ready pull request copy from a branch's changes. Produces a one-line type-prefixed title and a description with fixed section headings chosen by change type, delivered as separate fenced blocks in Simplified Chinese and English by default, or in one language on explicit request. Draws f…--- name: branch-to-pr-copy description: > Drafts paste-ready pull request copy from a branch's changes. Produces a one-line type-prefixed title and a description with fixed section headings chosen by change type, delivered as separate fenced blocks in Simplified Chinese and English by default, or in one language on explicit request. Draws facts from a supplied change summary, a raw diff, or read-only local git inspection. Use when the user asks to draft, write, or tidy a pull request title or description for current branch work. Not for opening or editing pull requests on a hosting site, writing commit messages, or producing release notes. ---
Pull request copy from a branch
Your deliverable is two pieces of text for two different pull-request form fields: a one-line title and a sectioned description. Because the fields are separate, the pieces ship in separate fenced blocks. Work through four decisions in order — facts, change type, languages, block layout — writing the title and description once the middle two are settled, then run a compliance gate before handing anything over. Repairing one weak section now is far cheaper than the user pasting a broken draft.
First, settle where the facts come from
Examine the conversation before touching the repository. Three tiers, in order of preference:
| What you hold | What to do | |---|---| | A change summary from the user or an earlier step | Run a freshness check before trusting it: the summary names the branch, its facts cover every section the change type will require, and nothing suggests the branch has moved on since it was written. Only then adopt it as your evidence base and skip repository reads entirely. | | A raw diff and nothing else | Condense it once into private working notes, then draft from the notes. Never re-walk the full diff. | | Nothing usable, or material that fails the check above | Fall back to the read-only repository reads below. |
The check exists because a summary written three commits ago describes a branch that no longer exists. Concrete failure signs: a quick status shows changed files the summary omits; a fix summary offers no test evidence for its Testing section; recent commit subjects contradict the summary's claims. A summary failing any of these is treated as stale or incomplete, not as complete.
Whichever tier you land on is the sole source of facts. Every factual sentence in the draft must trace back to it; a sentence with no origin is cut or rewritten, never padded with plausible filler.
Finding the baseline, then reading
Diff-based reads need a baseline branch — the branch this work descends from — to orient the comparison.
- If the user named one, use it.
- If not, spend one extra read-only lookup: list local and remote branch names, for example with
git branch -a, and take the repository's primary development branch (the one feature branches descend from, typically named main or master) as the baseline. - If two branches look equally primary, ask the user which to compare against instead of guessing.
Then the working reads:
| Read | What it gives you | |---|---| | git status | staged, unstaged, and untracked files | | git diff --stat compared with the baseline | file-level scope of the branch | | git log --oneline -5 | the author's stated intent in five commit subjects | | targeted hunks from git diff | the concrete facts your bullets will assert |
These reads, plus the single baseline lookup when needed, are the ceiling of repository interaction, and all of them are read-only. The baseline is scaffolding: its name and the fact you compared appear nowhere in the output. Every paste, click, and submission stays with the user.
Second, commit to one change type
| Type | The branch's dominant purpose | |---|---| | feat | a capability that did not exist before | | fix | repairing a defect | | perf | existing behavior made faster or leaner | | refactor | internal restructuring with no behavior change | | docs | documentation only | | chore | maintenance such as tooling, dependencies, configuration |
Real branches mix intents, yet the type stays singular because reviewers and filters read it as one thing. Pick the dominant intent, then file secondary drive-by work under a heading the chosen type actually owns: 改动说明 / Changes for every type except fix — a fix draft has no Changes heading, so its drive-by work goes under 修复方式 / Solution. Never mint hybrid types, and never add a heading missing from the map below.
Third, fix the languages
Default to two versions, Simplified Chinese and English, carrying identical facts in identical section order. If the user explicitly names one language, produce only that version and drop the language labels — labels exist solely for bilingual output.
The title
One line: the chosen type, a colon and a space, then a short specific phrase naming the concrete thing touched. Report the change, never your process — comparisons, baselines, and analysis steps stay out.
The description
Level-three headings with exact text, exact order, no synonyms — automation and reviewers key on these strings, so a paraphrased heading is a broken heading. Drop an optional heading only when it genuinely does not apply.
| Type | Sections in order, 中文 / English | |---|---| | feat | 概述 / Summary → 改动说明 / Changes → 使用方式 / Usage | | fix | 问题描述 / Problem → 复现步骤 / Steps to Reproduce (optional) → 修复方式 / Solution → 测试说明 / Testing | | perf, refactor | 概述 / Summary → 改动说明 / Changes → 效果 / Impact (optional) | | docs, chore | 概述 / Summary → 改动说明 / Changes |
Under each heading write short factual bullets, concrete highlights over generic praise. Every bullet traces to your evidence base, whichever tier produced it. Reproduce steps need special care: describe only what the evidence itself states — if the summary names a trigger but no concrete instance, write the trigger as given or ground the instance with one targeted hunk read; never invent a plausible-looking reproduction. An effect claim — faster, no longer fails, prevents — appears only when the evidence carries the test or benchmark demonstrating it; otherwise state only what changed.
Fourth, lay out the blocks
Title and description always travel in separate fenced blocks because they are pasted into different fields. Bilingual output is exactly four blocks in this sequence:
- Chinese title
- Chinese description
- English title
- English description
Each block gets a field caption on its own line — PR Title or PR Description — and, in bilingual output, a language label line, 中文 or English, immediately above the fence. One fence holds one language. Single-language output is two blocks, PR Title then PR Description, with captions and no labels.
The gate before delivery
Run every check; repair only the failing piece; rerun until clean.
| Check | Remedy if it fails | |---|---| | A supplied summary passed the freshness check before you skipped the reads | Run the reads now and re-ground the draft | | Exactly one of the six types was chosen | Re-read the type table, commit to the dominant intent | | Title reads type, colon, space, summary — one line, no process talk | Rewrite the line | | Headings match the map verbatim, in order, in the right language | Replace synonyms, restore order | | Each optional section was dropped only because it truly does not apply | Restore it or ground the omission | | Bilingual output is four single-language blocks in sequence, captioned and labeled directly above | Reorder, split, relabel | | Every factual bullet, number, and reproduce step traces to the evidence base | Cut, rewrite, or ground with a permitted read | | No effect claim lacks demonstrating evidence | Downgrade it to what changed | | The baseline's name and the comparison method appear nowhere | Strip them |
Worked example
Evidence base: a supplied summary of branch fix/cart-rounding. It reports that the checkout screen overcharged by one cent whenever a cart held fractional-quantity items — concretely, a cart with three lines of 0.3 kg at ¥10 per kg showed a total of ¥9.01 instead of ¥9.00 — because each line total was rounded before summing; the fix sums unrounded line amounts and rounds once after summing; a regression test builds that three-line cart and asserts the total is exactly ¥9.00. The summary names the branch, covers Problem, Steps to Reproduce, Solution, and Testing, and nothing suggests the branch moved on, so it passes the freshness check and no repository reads are needed.
PR Title
中文
fix: 修正购物车合计的一分钱多收
PR Description
中文
### 问题描述 - 购物车包含小数数量的商品时,结算页合计会多收一分钱。 ### 复现步骤 - 向购物车加入三行 0.3 kg、单价每 kg ¥10 的商品并打开结算页;合计显示 ¥9.01 而非 ¥9.00。 ### 修复方式 - 根因是每行小计在求和前被单独取整;现改为累加未取整的行金额,求和后统一取整一次。 ### 测试说明 - 新增回归测试:构造上述三行购物车,断言合计恰为 ¥9.00。
PR Title
English
fix: correct one-cent overcharge in cart totals
PR Description
English
### Problem - Checkout overcharged by one cent whenever a cart held fractional-quantity items. ### Steps to Reproduce - Add three lines of 0.3 kg at ¥10 per kg to a cart and open checkout; the total shows ¥9.01 instead of ¥9.00. ### Solution - The root cause was rounding each line total before summing; the fix now sums unrounded line amounts and rounds once after summing. ### Testing - Adds a regression test that builds the three-line cart and asserts the total is exactly ¥9.00.
Every figure here — three lines, 0.3 kg, ¥10, ¥9.01, ¥9.00 — appears verbatim in the evidence above. That is the standard to hold yourself to: before writing a number or a reproduce step, find it in your evidence base, and if it is absent either ground it with one targeted hunk read or leave it out. A match count or click sequence the evidence never states is never estimated into existence. Note also that the root-cause explanation sits under 修复方式 / Solution because fix owns no Changes heading, and the optional Steps to Reproduce stays in only because the evidence fully supplies it.
Boundaries
This skill must not create commits, push branches, or open, edit, or comment on pull requests on any hosting service — the user performs every paste and submission. It must not write commit messages or release notes. It must not invent facts, numbers, or reproduction steps, and must not state effects the evidence fails to demonstrate. It must not rename or reorder the fixed headings or blend two languages inside one fenced block.
Omissions and provenance
The upstream skill's DIFF_CONTEXT and RAW_DIFF variable names and its rule-routing table are not carried over; the reuse-first habit they encode is restated as the evidence tiers above. This skill is adapted in fresh wording and structure from QuentinHsu's MIT-licensed pr-content skill; the marketplace package's THIRD_PARTY_NOTICES.md carries the complete license text.
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 11.4 kB | 6e72be8eebaa |
| THIRD_PARTY_NOTICES.md | 1.3 kB | a476e62944f6 |
| examples.json | 1.9 kB | ef389416ceda |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 1.0.0 Current | Not recorded | 10 Oct 2026 |
Locking a skill to one version needs Pro.