pr
Draft a PR description for the current branch following the canonical PR template; saves the draft to docs/pr/<slug>.md without opening a real PR.
- License 许可
- MIT
- 最近更新
- 2026-10-29
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- pr
- description
- Draft a PR description for the current branch following the canonical PR template; saves the draft to docs/pr/<slug>.md without opening a real PR.
03 SKILL.md 正文
pr
Draft a PR description from the current branch's commits. Writes to
docs/pr/<slug>.md. Drafts only — it never opens a real GitHub PR; that'spolymath-vcs:open-pr, which consumes this draft.
Mode: analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked [TBD] or [VERIFY], never filled in.
When to use
- The user says "draft a PR", "PR description for this branch".
- A workflow's release step needs the PR draft artifact.
Inputs
- The current branch's commits (read via
git log). - Optional: PRD path at
docs/prds/<slug>.md(anchors motivation). - Optional: target base branch (default: the remote's default branch —
git symbolic-ref --short refs/remotes/origin/HEAD, elsemain).
Project localization
Before the procedure, resolve the project snapshot —
${POLYMATH_DATA_DIR:-$HOME/.polymath/data}/polymath-core/project-context.json
(ignore it if its _meta.source belongs to another repo; absent → read
.polymath/project.yaml directly; neither → built-in defaults). Then apply
(contract: polymath-core:project-context):
prompts.pr_description_template: when set, use that file as the PR body template instead of the catalog default.
Procedure
- Run
git fetch origin <base>(when a remote exists), thengit log origin/<base>..HEAD --onelineto see the branch's own commits. - Run
git diff origin/<base>...HEAD --stat(three dots: against the merge base) for the file list. - Inspect the PRD (if
docs/prds/<slug>.mdexists) to ground the motivation section. - Pick the template, first match wins: the project context's
prompts.pr_description_template; the repo's own GitHub template (.github/pull_request_template.md,.github/PULL_REQUEST_TEMPLATE.md, rootPULL_REQUEST_TEMPLATE.md, ordocs/PULL_REQUEST_TEMPLATE.md); else the catalog defaultPR-description.md. A repo template's headings win over the catalog's — keep the PRDescription frontmatter for the workflow gate. - Fill the template:
- Summary: one paragraph in active voice. What does this PR do? Why now?
- Motivation: link the PRD, ADR, or issue.
- Changes: high-level grouped bullets — not a file-by-file restatement.
- Test plan: concrete steps a reviewer can run.
- Risk and rollback: state explicitly. Even "low risk; revert by reverting the PR" is fine if it's the truth.
- Reviewers: tag by area if you can infer from CODEOWNERS or diff paths.
- Checklist: leave unchecked for the author to confirm.
- Slug from the branch name (reuse the PRD's slug when the PR implements one): a workflow's
${workflow.slug}wins; otherwise lowercase it, replace each run of characters outsidea-z0-9with-, trim-at the ends, and cut to ≤ 60 characters at a-. An existing file at the target path is updated in place (show the diff), never duplicated. - Write
docs/pr/<slug>.mdwith the validated frontmatter (artifact: PRDescription).
The PR draft is a file, not an opened PR. Pair with
polymath-vcs:open-pr to open the actual PR via MCP.
Safety
- Never push to a remote.
- Never call
gh pr create— PR creation ispolymath-vcs:open-pr's job, after the user approves this draft. - Surface a unified diff if the target file already exists.
- Do not invent reviewers — only suggest from CODEOWNERS or the diff.
Output
- File:
docs/pr/<slug>.mdwith PRDescription frontmatter. - Summary listing the linked PRD/ADR and the suggested base branch.
Workflow validation
mustPass:
- id: pr-draft-valid
type: artifactSchemaStrict
path: docs/pr/${workflow.slug}.md
artifact: PRDescription
minBodyChars: 300
Quality bar
- Summary is one paragraph in active voice.
- Motivation links a concrete PRD / ADR / issue.
- Test plan has actionable steps a reviewer can execute.
- Risk + rollback are explicit, not "low risk, none."
Anti-patterns to avoid
- File-by-file restatement of the diff (the reviewer can read it).
- "Cleanup" PRs without explicit motivation.
- Marking own PR ready-for-review without test plan filled.
- Bundling refactor + feature in one PR description.
04 同仓库更多 Skills
runbook
Write or refresh an operational runbook for an alert/symptom; structured as TL;DR + Pre-checks + Steps + Verification + Rollback + Escalation.
rfc
Draft a lightweight design RFC to docs/rfcs/<slug>.md; Summary, Motivation, Detailed design, Drawbacks, Alternatives, Unresolved questions. A proposal to debate, not a recorded decision (adr).
editorial-pass
Review and tighten prose in a Markdown artifact for a target tone (terse, formal, friendly) without dropping information; preserve quotations and load-bearing constraints.
architecture-review-facilitation
Run an architecture review as a process — entry criteria, reviewer checklist, decision log, and follow-up actions — pairing the design artifact with a red-team pass.
architecture-doc
Write a C4-style architecture document; System Context + Containers (+ Components when interesting) with mermaid diagrams. Describes structure, not a decision (adr) or proposal (rfc).
adr
Write an Architecture Decision Record (Michael Nygard format) to docs/adrs/NNNN-<slug>.md; frontmatter validated by the ADR artifact schema. Records a made decision, not a proposal to debate (rfc).