跳到正文
cccskills
免费在 GitHub 公开

pr-create

Create or update a GitHub pull request for the current branch. Use when the user invokes `$pr-create`, asks to create/open a PR, or wants the current branch pushed and described as a draft PR.

中文简介正在准备中。当前显示原文说明。

集成工具GitHub
查看安装方法

包含的文件(2)

  • SKILL.md5.9 KB
  • agents/openai.yaml239 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

pr-create

Create a GitHub PR for the current branch. If a PR already exists, use $pr-update-desc to refresh its description instead.

Workflow

0. Load PR style

Use the pr-style skill for title format, body template, labels, assignment, and draft policy. Follow those rules for the PR title, body, and label handling. If the target repo has its own PR template (detected in Step 4), the repo template replaces the pr-style default body, while pr-style still governs title format (unless the template's frontmatter specifies one), labels, assignment, and draft policy.

1. Gather context

Run:

remote=$(git remote | head -1)
branch=$(git branch --show-current)
default_branch=$(git symbolic-ref refs/remotes/${remote}/HEAD 2>/dev/null | sed "s|refs/remotes/${remote}/||" || echo "main")
echo "remote=${remote} branch=${branch} default=${default_branch}"

If branch equals default_branch, stop and report:

Cannot create a PR from the default branch (`<default_branch>`).

2. Check for an existing PR

Run:

gh pr list --head "${branch}" --state open --json number,url,title --jq '.[0] | "\(.number)|\(.title)|\(.url)"'
  • If a PR exists, report PR #<number> already exists, use $pr-update-desc to update the description, then stop.
  • If no PR exists, continue.

3. Ensure the branch is pushed

Check whether the remote branch exists:

git ls-remote --heads "${remote}" "${branch}"

If no remote branch exists, push with an explicit refspec:

git push -u "${remote}" "${branch}:${branch}"

If the remote branch exists, push the current local branch to it:

git push "${remote}" "${branch}:${branch}"

4. Collect PR source material

Get branch commits:

git log --oneline "${default_branch}..HEAD"

Get the high-level diff:

git diff --stat "${default_branch}...HEAD"

These outputs are used when filling in the selected PR template (or the pr-style default body if no repo template is found).

4a. Detect the repo's PR template

Read-only lookup, run in parallel with the diff inspection. Check GitHub's template locations in order:

  • Single template: pull_request_template.md (or .txt) in the repo root, docs/, or .github/
  • Multiple templates: every *.md in .github/PULL_REQUEST_TEMPLATE/
  • Picker file: a root/.github/docs/ single template whose content is only links of the form ?quick_pull=1&template=<file> — it routes to the .github/PULL_REQUEST_TEMPLATE/ files; treat it as the multiple-templates case and never use the picker itself as the body format.

Read every candidate template found (full content, including any YAML frontmatter). Also read repo-local AGENTS.md (or CLAUDE.md / .cursorrules if present) and note any PR-template or PR-format guidance it carries. Do not select a template yet — selection happens at body generation (Step 6), because the commit log can flip the choice.

5. Detect labels

Map conventional commit prefixes in the branch log using the pr-style label table. Validate candidate labels against the repo:

gh label list --json name --jq '.[].name'

Apply only labels that exist. If no valid labels exist, omit label flags.

6. Create the draft PR

6a. Select the template

Apply in order (first match wins):

  1. Repo-local AGENTS.md explicitly mandates a template or required PR format → follow that; an explicit mandate (e.g. "always use release.md", required extra sections, sign-off blocks) overrides the rules below.
  2. Exactly one template found → use it.
  3. Version-only bump in the branch log (single commit, message matches a version-bump pattern like bump version / chore(release): v<semver> / version <semver>) and a release-named template exists (e.g. release.md) → use the release template.
  4. Otherwise prefer a feature/change-named template (e.g. feature.md, change.md, bug_fix.md matching the change type from commit prefixes) when one exists.
  5. Still ambiguous (several plausible non-release templates) → ask the user which template applies, one question with the candidate names, before drafting.
  6. No template found and AGENTS.md carries no PR-format guidance → record "no template found"; the pr-style default body applies, with any AGENTS.md PR conventions (required sections, trailers, sign-offs) layered on as extra requirements.

6b. Apply the template

  • If a template was selected: use its body structure instead of the pr-style default body. Fill every template section with real content derived from the Step 4 log/diff; a template section left as an unfilled placeholder or TODO is a blocker — report it rather than posting an unfilled template.
  • Frontmatter handling: if the template begins with YAML frontmatter (--- fenced), strip it from the PR body. Honor labels: by merging those labels into the Step 5 validated-label set (still drop any that fail gh label list validation). Honor title: as the title format/prefix, overriding the pr-style title format for this PR. Ignore other frontmatter keys (assignees:, draft:, etc.) — pr-style's --draft --assignee @me flags remain authoritative.
  • If no template: generate the body per pr-style, plus any AGENTS.md conventions per 6a rule 6.

Create a draft PR assigned to the current GitHub user:

gh pr create --draft --assignee @me --title "<title>" --body "$(cat <<'EOF'
<generated description>
EOF
)"

If valid labels were detected, include them with repeated --label "<label>" flags.

7. Report result

Output:

Created PR #<number> (draft)
<pr_url>
Labels: <applied labels or none>
Assigned: @me
Template: <name or default pr-style body>

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

2ndbrain

免费

Quick-save the last assistant response as a verbatim note in the 2ndBrain Obsidian vault (~/2ndBrain/quick-notes/<year>/). Use when the user asks to quick-save/save the last response to 2ndBrain, or invokes $2ndbrain or /skill:2ndbrain.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

Write commit messages under the agent-commits convention - a Conventional Commits fork with no chore catch-all, intent-only type tokens, facts in trailers, and legally-grounded AI provenance (Assisted-by, never Co-authored-by). Use when composing a commit in a repo whose commitlint.config.js extends agent-commits, when deciding between feat/fix/refactor/perf, or when recording AI participation.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

Coordinate multi-agent work through durable artifacts in git instead of chat. Use this whenever a task involves sending a message to another agent, agent mailboxes or handoffs, claiming work from a shared queue, notifying another agent or crew (OpenClaw, Grok Bot, Claude Code, Codex, Gas Town/Gas City workers) that work is ready, or whenever the user mentions the artifact bus, message bus, agent mail, beads mail, doorbells, or pings between agents — even if they don't say "bus" explicitly.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

aven

免费

Use aven to find tasks, update status, and leave durable handoff context.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

Plan, order and deliver a batch of backlog items (e.g. every High item) in a Conventional Docs repo, one decision, branch, worktree, draft PR, review and merge per item. Use when asked to work through the backlog, implement all items of a priority, or sequence several backlog items end to end.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

boris

免费

Codex workflow tips from Boris Cherny (creator of Codex) and the Codex team. Use when: setting up Codex, optimizing workflows, running parallel sessions, configuring AGENTS.md, using skills/commands, subagents, hooks, MCP integrations, or learning best practices. Covers: git worktrees, plan mode, verification, permissions, Slack MCP, BigQuery, prompting tips, plugins, custom agents, sandboxing, keybindings, status lines, output styles, customization, /simplify for code quality, /batch for parallel code migrations, /loop for scheduled tasks, code review agents, /btw for mid-task questions, /effort max reasoning, remote control sessions, voice mode, setup scripts, session naming, /color, PostCompact hook, auto mode, /schedule cloud jobs, iMessage plugin, auto-memory, and auto-dream, mobile app, session teleporting, Cowork Dispatch, Chrome extension, Desktop app, /branch forking, --bare SDK startup, --add-dir multi-repo, --agent custom agents, /voice input.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

查看 phatblat 的全部技能

报告此技能的问题