ce-commit-push-pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Commit, Push, and PR
Git Commit、Push 与 PR 创建
Go from working changes to an open pull request, or rewrite an existing PR description.
Asking the user: When this skill says "ask the user", use the platform's blocking question tool: in Claude Code (call with first if its schema isn't loaded), in Codex, in Gemini, in Pi (requires the extension). Fall back to presenting the question in chat only when no blocking tool exists in the harness or the call errors (e.g., Codex edit modes) — not because a schema load is required. Never silently skip the question.
AskUserQuestionToolSearchselect:AskUserQuestionrequest_user_inputask_userask_userpi-ask-user从已完成的变更直接创建一个开放的PR,或重写现有PR的描述。
询问用户: 当本技能提示“询问用户”时,请使用平台的阻塞式提问工具:Claude Code中使用(若未加载其 schema,先调用并指定),Codex中使用,Gemini中使用,Pi中使用(需扩展)。仅当工具集中无阻塞式工具或调用出错时(如Codex编辑模式),才退回到在聊天中展示问题——不要因需要加载schema就跳过。绝对不能静默跳过问题。
AskUserQuestionToolSearchselect:AskUserQuestionrequest_user_inputask_userask_userpi-ask-userMode detection
模式检测
If the user is asking to update, refresh, or rewrite an existing PR description (with no mention of committing or pushing), this is a description-only update. The user may also provide a focus (e.g., "update the PR description and add the benchmarking results"). Note any focus for DU-3.
For description-only updates, follow the Description Update workflow below. Otherwise, follow the full workflow.
如果用户要求更新、刷新或重写现有PR描述(未提及提交或推送),则属于仅更新描述模式。用户可能还会指定重点(例如:“更新PR描述并添加基准测试结果”)。记录该重点以便在DU-3步骤中使用。
对于仅更新描述的场景,遵循下方的“描述更新工作流”;否则,遵循完整工作流。
Context
上下文信息
On platforms other than Claude Code, skip to the "Context fallback" section below and run the command there to gather context.
In Claude Code, the six labeled sections below contain pre-populated data. Use them directly -- do not re-run these commands.
Git status:
!
git statusWorking tree diff:
!
git diff HEADCurrent branch:
!
git branch --show-currentRecent commits:
!
git log --oneline -10Remote default branch:
!
git rev-parse --abbrev-ref origin/HEAD 2>/dev/null || echo 'DEFAULT_BRANCH_UNRESOLVED'Existing PR check:
!
gh pr view --json url,title,state 2>/dev/null || echo 'NO_OPEN_PR'在Claude Code以外的平台,直接跳至下方“上下文备选方案”部分,运行其中的命令来收集上下文信息。
在Claude Code中,下方六个标记好的部分已预填数据,请直接使用——无需重新运行这些命令。
Git状态:
!
git status工作区差异:
!
git diff HEAD当前分支:
!
git branch --show-current最近提交记录:
!
git log --oneline -10远程默认分支:
!
git rev-parse --abbrev-ref origin/HEAD 2>/dev/null || echo 'DEFAULT_BRANCH_UNRESOLVED'现有PR检查:
!
gh pr view --json url,title,state 2>/dev/null || echo 'NO_OPEN_PR'Context fallback
上下文备选方案
In Claude Code, skip this section — the data above is already available.
Run this single command to gather all context:
bash
printf '=== STATUS ===\n'; git status; printf '\n=== DIFF ===\n'; git diff HEAD; printf '\n=== BRANCH ===\n'; git branch --show-current; printf '\n=== LOG ===\n'; git log --oneline -10; printf '\n=== DEFAULT_BRANCH ===\n'; git rev-parse --abbrev-ref origin/HEAD 2>/dev/null || echo 'DEFAULT_BRANCH_UNRESOLVED'; printf '\n=== PR_CHECK ===\n'; gh pr view --json url,title,state 2>/dev/null || echo 'NO_OPEN_PR'在Claude Code中请跳过此部分——上述数据已可用。
运行以下单个命令来收集所有上下文信息:
bash
printf '=== STATUS ===\n'; git status; printf '\n=== DIFF ===\n'; git diff HEAD; printf '\n=== BRANCH ===\n'; git branch --show-current; printf '\n=== LOG ===\n'; git log --oneline -10; printf '\n=== DEFAULT_BRANCH ===\n'; git rev-parse --abbrev-ref origin/HEAD 2>/dev/null || echo 'DEFAULT_BRANCH_UNRESOLVED'; printf '\n=== PR_CHECK ===\n'; gh pr view --json url,title,state 2>/dev/null || echo 'NO_OPEN_PR'Description Update workflow
描述更新工作流
DU-1: Confirm intent
DU-1:确认意图
Ask the user: "Update the PR description for this branch?" If declined, stop.
询问用户:“是否更新此分支的PR描述?”若用户拒绝,则停止操作。
DU-2: Find the PR
DU-2:查找PR
Use the current branch and existing PR check from context. If the current branch is empty (detached HEAD), report no branch and stop. If the PR check returned , note the PR from the context block — this is the unambiguous reference to pass downstream — and proceed to DU-3. Otherwise, report no open PR and stop.
state: OPENurl使用上下文信息中的当前分支和现有PR检查结果。如果当前分支为空(分离HEAD状态),则报告无分支并停止操作。如果PR检查返回,记录上下文块中的PR ——这是传递给下游步骤的明确引用——然后进入DU-3步骤。否则,报告无开放PR并停止操作。
state: OPENurlDU-3: Write and apply the updated description
DU-3:编写并应用更新后的描述
Read the current PR description to drive the compare-and-confirm step later:
bash
gh pr view --json body --jq '.body'Generate the updated title and body — load the skill with the PR URL from DU-2 (e.g., ). The URL preserves repo/PR identity even when invoked from a worktree or subdirectory where the current repo is ambiguous. If the user provided a focus (e.g., "include the benchmarking results"), append it as free-text steering after the URL. The skill returns a block (body in an OS temp file) without applying or prompting.
ce-pr-descriptionhttps://github.com/owner/repo/pull/123{title, body_file}If returns a "not open" or other graceful-exit message instead of a pair, report that message and stop.
ce-pr-description{title, body_file}Evidence decision: preserves any existing or block from the current body by default. If the user's focus asks to refresh or remove evidence, pass that intent as steering text — the skill will honor it. If no evidence block exists and one would benefit the reader, invoke separately to capture, then re-invoke with updated steering that references the captured evidence.
ce-pr-description## Demo## Screenshotsce-demo-reelce-pr-descriptionCompare and confirm — briefly explain what the new description covers differently from the old one. This helps the user decide whether to apply; the description itself does not narrate these differences. Summarize from the body already in context (from the bash call that wrote ); do not the temp file, which would re-emit the body.
body_filecat- If the user provided a focus, confirm it was addressed.
- Ask the user to confirm before applying.
If confirmed, perform these two actions in order. They are separate steps with a hand-off boundary between them — do not stop after action 1.
-
has already returned its
ce-pr-description/=== TITLE ===block and stopped; it does not apply on its own.=== BODY_FILE === -
Apply the returned title and body file yourself. This is this skill's responsibility, not the delegated skill's. Substituteand
<TITLE>verbatim from the return block; if<BODY_FILE>contains<TITLE>,",`, or$, escape them or switch to single quotes:\bashgh pr edit --title "<TITLE>" --body "$(cat "<BODY_FILE>")"
Report the PR URL.
先读取当前PR描述,以便后续进行对比确认:
bash
gh pr view --json body --jq '.body'生成更新后的标题和正文——加载技能并传入DU-2步骤中获取的PR URL(例如:)。即使在工作树或子目录中调用(当前仓库可能不明确),URL也能保留仓库/PR的身份信息。如果用户指定了重点(例如:“包含基准测试结果”),在URL后附加该自由文本作为指导。该技能会返回一个块(正文存储在系统临时文件中),不会自动应用或提示。
ce-pr-descriptionhttps://github.com/owner/repo/pull/123{title, body_file}如果返回“未开放”或其他优雅退出消息而非对,则报告该消息并停止操作。
ce-pr-description{title, body_file}证据决策: 默认会保留当前正文中已有的或块。如果用户的重点要求刷新或移除证据,将该意图作为指导文本传递——技能会遵循该要求。如果没有证据块且添加证据块对读者有益,则单独调用技能来捕获证据,然后重新调用并传入包含捕获证据的更新指导文本。
ce-pr-description## Demo## Screenshotsce-demo-reelce-pr-description对比与确认——简要说明新描述与旧描述的不同之处。这有助于用户决定是否应用;描述本身无需说明这些差异。根据上下文已有的正文(来自写入的bash命令)进行总结;不要使用命令读取临时文件,以免重复输出正文。
body_filecat- 如果用户指定了重点,确认该重点已被覆盖。
- 在应用前询问用户确认。
若用户确认,请按顺序执行以下两个操作。这是两个独立步骤,中间有交接边界——完成操作1后不要停止。
-
已返回
ce-pr-description/=== TITLE ===块并停止;它不会自动应用。=== BODY_FILE === -
自行应用返回的标题和正文文件。这是本技能的职责,而非委托技能的职责。直接替换返回块中的和
<TITLE>;如果<BODY_FILE>包含<TITLE>,",`, 或$,请转义这些字符或改用单引号:\bashgh pr edit --title "<TITLE>" --body "$(cat "<BODY_FILE>")"
报告PR的URL。
Full workflow
完整工作流
Step 1: Gather context
步骤1:收集上下文信息
Use the context above. All data needed for this step and Step 3 is already available -- do not re-run those commands.
The remote default branch value returns something like . Strip the prefix. If it returned or a bare , try:
origin/mainorigin/DEFAULT_BRANCH_UNRESOLVEDHEADbash
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'If both fail, fall back to .
mainIf the current branch is empty (detached HEAD), explain that a branch is required. Ask whether to create a feature branch now.
- If yes, derive a branch name from the change content, create with , and use that for the rest of the workflow.
git checkout -b <branch-name> - If no, stop.
If the working tree is clean (no staged, modified, or untracked files), determine the next action:
- Run to check upstream.
git rev-parse --abbrev-ref --symbolic-full-name @{u} - If upstream exists, run for unpushed commits.
git log <upstream>..HEAD --oneline
Decision tree:
- On default branch, unpushed commits or no upstream -- ask whether to create a feature branch (pushing default directly is not supported). If yes, create and continue from Step 5. If no, stop.
- On default branch, all pushed, no open PR -- report no feature branch work. Stop.
- Feature branch, no upstream -- skip Step 4, continue from Step 5.
- Feature branch, unpushed commits -- skip Step 4, continue from Step 5.
- Feature branch, all pushed, no open PR -- skip Steps 4-5, continue from Step 6.
- Feature branch, all pushed, open PR -- report up to date. Stop.
使用上述上下文信息。本步骤和步骤3所需的所有数据已可用——无需重新运行这些命令。
远程默认分支的返回值类似。去除前缀。如果返回或仅,尝试运行:
origin/mainorigin/DEFAULT_BRANCH_UNRESOLVEDHEADbash
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'如果两者都失败,默认使用。
main如果当前分支为空(分离HEAD状态),说明需要分支。询问用户是否立即创建功能分支。
- 如果是,根据变更内容生成分支名称,使用创建分支,并在后续工作流中使用该分支。
git checkout -b <branch-name> - 如果否,停止操作。
如果工作区干净(无暂存、修改或未跟踪文件),确定下一步操作:
- 运行检查上游分支。
git rev-parse --abbrev-ref --symbolic-full-name @{u} - 如果上游分支存在,运行查看未推送的提交。
git log <upstream>..HEAD --oneline
决策树:
- 在默认分支上,存在未推送提交或无上游分支——询问用户是否创建功能分支(不支持直接推送到默认分支)。如果是,创建分支并从步骤5继续。如果否,停止操作。
- 在默认分支上,所有提交已推送,无开放PR——报告无功能分支工作内容。停止操作。
- 功能分支,无上游分支——跳过步骤4,从步骤5继续。
- 功能分支,存在未推送提交——跳过步骤4,从步骤5继续。
- 功能分支,所有提交已推送,无开放PR——跳过步骤4-5,从步骤6继续。
- 功能分支,所有提交已推送,存在开放PR——报告已同步最新内容。停止操作。
Step 2: Determine conventions
步骤2:确定规范
Priority order for commit messages and PR titles:
- Repo conventions in context -- follow project instructions if they specify conventions. Do not re-read; they load at session start.
- Recent commit history -- match the pattern in the last 10 commits.
- Default -- (conventional commits).
type(scope): description
When using conventional commits, choose the type that most precisely describes the change. Where and both seem to fit, default to : a change that remedies broken or missing behavior is even when implemented by adding code. Reserve for capabilities the user could not previously accomplish. Other types (, , , , , , , ) remain primary when they fit better. The user may override for a specific change.
fix:feat:fix:fix:feat:chore:refactor:docs:perf:test:ci:build:style:提交消息和PR标题的优先级顺序:
- 上下文仓库的规范——如果项目说明中指定了规范,请遵循。无需重新读取;规范会在会话开始时加载。
- 最近提交历史——匹配最近10次提交的格式。
- 默认规范——(约定式提交)。
type(scope): description
使用约定式提交时,选择最能准确描述变更的类型。当和都适用时,默认使用:修复损坏或缺失行为的变更即使是通过添加代码实现,也属于。仅用于用户之前无法实现的功能。其他类型(、、、、、、、)在更合适时优先使用。用户可针对特定变更覆盖默认类型。
fix:feat:fix:fix:feat:chore:refactor:docs:perf:test:ci:build:style:Step 3: Check for existing PR
步骤3:检查现有PR
Use the current branch and existing PR check from context. If the branch is empty, report detached HEAD and stop.
If the PR check returned , note the URL -- this is the existing-PR flow. Continue to Step 4 and 5 (commit any pending work and push), then go to Step 7 to ask whether to rewrite the description. Only run Step 6 (which generates a new description via ) if the user confirms the rewrite; Step 7's existing-PR sub-path consumes the that Step 6 produces. Otherwise (no open PR), continue through Steps 6, 7, and 8 in order.
state: OPENce-pr-description{title, body_file}使用上下文信息中的当前分支和现有PR检查结果。如果分支为空,报告分离HEAD状态并停止操作。
如果PR检查返回,记录URL——这属于现有PR流程。继续执行步骤4和5(提交所有未完成工作并推送),然后进入步骤7询问是否重写描述。仅当用户确认重写时才运行步骤6(通过生成新描述);步骤7的现有PR子流程会使用步骤6生成的。否则(无开放PR),依次执行步骤6、7、8。
state: OPENce-pr-description{title, body_file}Step 4: Branch, stage, and commit
步骤4:分支、暂存与提交
- If on the default branch, create a feature branch first with .
git checkout -b <branch-name> - Scan changed files for naturally distinct concerns. If files clearly group into separate logical changes, create separate commits (2-3 max). Group at the file level only (no ). When ambiguous, one commit is fine.
git add -p - Stage and commit each group in a single call. Avoid or
git add -A. Follow conventions from Step 2:git add .bashgit add file1 file2 file3 && git commit -m "$(cat <<'EOF' commit message here EOF )"
- 如果当前在默认分支上,先使用创建功能分支。
git checkout -b <branch-name> - 扫描变更文件,找出自然区分的关注点。如果文件可清晰分组为不同的逻辑变更,创建多个提交(最多2-3个)。仅按文件分组(不使用)。若难以区分,创建单个提交即可。
git add -p - 单次调用完成每组文件的暂存与提交。避免使用或
git add -A。遵循步骤2确定的规范:git add .bashgit add file1 file2 file3 && git commit -m "$(cat <<'EOF' 提交消息内容 EOF )"
Step 5: Push
步骤5:推送
bash
git push -u origin HEADbash
git push -u origin HEADStep 6: Generate the PR title and body
步骤6:生成PR标题和正文
The working-tree diff from Step 1 only shows uncommitted changes at invocation time. The PR description must cover all commits in the PR.
Detect the base branch and remote. Resolve both the base branch and the remote (fork-based PRs may use a remote other than ). Stop at the first that succeeds:
origin- PR metadata (if existing PR found in Step 3):
Extractbash
gh pr view --json baseRefName,url. MatchbaseRefNamefrom the PR URL againstowner/repofetch URLs to find the base remote. Fall back togit remote -v.origin - Remote default branch from context -- if resolved, strip prefix. Use
origin/.origin - GitHub metadata:
Usebash
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'.origin - Common names -- check ,
main,master,developin order:trunkUsebashgit rev-parse --verify origin/<candidate>.origin
If none resolve, ask the user to specify the target branch.
Gather the full branch diff (before evidence decision). The working-tree diff from Step 1 only reflects uncommitted changes at invocation time — on the common "feature branch, all pushed, open PR" path, Step 1 skips the commit/push steps and the working-tree diff is empty. The evidence decision below needs the real branch diff to judge whether behavior is observable, so compute it explicitly against the base resolved above. Only fetch when the local ref isn't available — if already resolves locally, run the diff from local state so offline / restricted-network / expired-auth environments don't hard-fail:
<base-remote>/<base-branch>bash
git rev-parse --verify <base-remote>/<base-branch> >/dev/null 2>&1 \
|| git fetch --no-tags <base-remote> <base-branch>
git diff <base-remote>/<base-branch>...HEADUse this branch diff (not the working-tree diff) for the evidence decision. If the branch diff is empty (e.g., HEAD is already merged into the base or the branch has no unique commits), skip the evidence prompt and continue to delegation.
Evidence decision (before delegation). Before running the full decision, two short-circuits:
-
User explicitly asked for evidence. If the user's invocation requested it ("ship with a demo", "include a screenshot"), proceed directly to capture. If capture turns out to be not possible (no runnable surface, missing credentials, docs-only diff) or clearly not useful, note that briefly and proceed without evidence — do not force capture for its own sake.
-
Agent judgment on authored changes. If you authored the commits in this session and know the change is clearly non-observable (internal plumbing, backend refactor without user-facing effect, type-level changes, etc.), skip the prompt without asking. The categorical skip list below is not exhaustive — trust judgment about the change you just wrote.
Otherwise, run the full decision: if the branch diff changes observable behavior (UI, CLI output, API behavior with runnable code, generated artifacts, workflow output) and evidence is not otherwise blocked (unavailable credentials, paid services, deploy-only infrastructure, hardware), ask: "This PR has observable behavior. Capture evidence for the PR description?"
- Capture now -- load the skill with a target description inferred from the branch diff. ce-demo-reel returns
ce-demo-reel,Tier,Description, andURL. Exactly one ofPathorURLcontains a real value; the other isPath. If capture returns a public URL, pass it as steering to"none"(e.g., "include the captured demo: <URL> as ace-pr-descriptionsection") or splice into the returned body before apply. If capture returns a local## Demoinstead (user chose local save), pass steering that notes evidence was captured but is local-only (e.g., "evidence was captured locally — note in the PR that a demo was recorded but is not embedded because the user chose local save"). If capture returnsPathor bothTier: skippedandURLarePath, proceed with no evidence."none" - Use existing evidence -- ask for the URL or markdown embed, then pass it as free-text steering to or splice in before apply.
ce-pr-description - Skip -- proceed with no evidence section.
When evidence is not possible (docs-only, markdown-only, changelog-only, release metadata, CI/config-only, test-only, or pure internal refactors), skip without asking.
Delegate title and body generation to . Load the skill:
ce-pr-descriptionce-pr-description- For a new PR (no existing PR found in Step 3): invoke with using the already-resolved base from earlier in this step, so
base:<base-remote>/<base-branch>describes the correct commit range even when the branch targets a non-default base (e.g.,ce-pr-description,develop). Append any captured-evidence context or user focus as free-text steering (e.g., "include the captured demo: <URL> as arelease/*section", or "evidence captured locally — not embedded" for local saves).## Demo - For an existing PR (found in Step 3): invoke with the full PR URL from the Step 3 context (e.g., ). The URL preserves repo/PR identity even when invoked from a worktree or subdirectory; the skill reads the PR's own
https://github.com/owner/repo/pull/123so nobaseRefNameoverride is needed. Append any focus steering as free text after the URL.base:
Steering discipline. Pass only what the diff cannot reveal: a user focus ("emphasize the performance win"), a specific framing concern ("this needs to read as a migration not a feature"), or a pointer to institutional knowledge. Do NOT dump an exhaustive scope summary or a numbered list of every change — reads the diff itself. Over-specified steering encourages the downstream skill to cover everything passed in, producing verbose output. Cap steering at roughly 100 words; if a longer framing feels necessary, trust the diff and cut.
ce-pr-descriptionce-pr-description{title, body_file}If returns a graceful-exit message instead of (e.g., closed PR, no commits to describe, base ref unresolved), report the message and stop — do not create or edit the PR.
ce-pr-description{title, body_file}步骤1中的工作区差异仅显示调用时的未提交变更。PR描述必须覆盖PR中的所有提交。
检测基准分支和远程仓库。解析基准分支和远程仓库(基于fork的PR可能使用以外的远程仓库)。按以下顺序尝试,直到成功:
origin- PR元数据(如果步骤3中发现现有PR):
提取bash
gh pr view --json baseRefName,url。将PR URL中的baseRefName与owner/repo的fetch URL匹配,找到基准远程仓库。默认使用git remote -v。origin - 上下文信息中的远程默认分支——如果已解析,去除前缀。使用
origin/。origin - GitHub元数据:
使用bash
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'。origin - 常见名称——依次检查、
main、master、develop:trunk使用bashgit rev-parse --verify origin/<candidate>。origin
如果均无法解析,请询问用户指定目标分支。
收集完整分支差异(证据决策前)。步骤1中的工作区差异仅反映调用时的未提交变更——在常见的“功能分支,所有提交已推送,存在开放PR”流程中,步骤1会跳过提交/推送步骤,工作区差异为空。下方的证据决策需要真实的分支差异来判断行为是否可观察,因此需针对上述解析出的基准分支明确计算差异。仅当本地引用不可用时才执行fetch——如果已在本地解析,从本地状态运行diff,避免离线/受限网络/过期认证环境下出现硬失败:
<base-remote>/<base-branch>bash
git rev-parse --verify <base-remote>/<base-branch> >/dev/null 2>&1 \
|| git fetch --no-tags <base-remote> <base-branch>
git diff <base-remote>/<base-branch>...HEAD使用此分支差异(而非工作区差异)进行证据决策。如果分支差异为空(例如:HEAD已合并到基准分支,或分支无唯一提交),跳过证据提示并继续委托步骤。
证据决策(委托前)。在运行完整决策前,有两个短路条件:
-
用户明确要求提供证据。如果用户调用时要求(“附带demo发布”“包含截图”),直接进行捕获。如果捕获不可行(无运行界面、缺少凭证、仅文档差异)或明显无用,简要说明后继续,不强制捕获。
-
Agent对已编写变更的判断。如果本会话中是你编写的提交,且明确知道变更不可观察(内部管道、无用户可见影响的后端重构、类型级别变更等),无需询问直接跳过。以下分类跳过列表并不详尽——相信你对刚编写的变更的判断。
否则,运行完整决策:如果分支差异变更了可观察行为(UI、CLI输出、可运行代码的API行为、生成的工件、工作流输出),且证据未被阻止(无可用凭证、付费服务、仅部署基础设施、硬件限制),询问:“此PR包含可观察行为。是否为PR描述捕获证据?”
- 立即捕获——加载技能,并传入从分支差异推断出的目标描述。ce-demo-reel会返回
ce-demo-reel、Tier、Description和URL。Path或URL中仅有一个为真实值,另一个为Path。如果捕获返回公共URL,将其作为指导传递给"none"(例如:“将捕获的demo:<URL>作为ce-pr-description部分包含在内”),或在应用前插入返回的正文。如果捕获返回本地## Demo(用户选择本地保存),传递指导文本说明证据已捕获但仅本地可用(例如:“证据已本地捕获——在PR中注明已录制demo但未嵌入,因用户选择本地保存”)。如果捕获返回Path或Tier: skipped和URL均为Path,则不添加证据继续。"none" - 使用现有证据——询问用户获取URL或markdown嵌入代码,然后将其作为自由文本指导传递给,或在应用前插入。
ce-pr-description - 跳过——不添加证据部分继续。
当无法提供证据时(仅文档、仅markdown、仅变更日志、仅发布元数据、仅CI/配置、仅测试、纯内部重构),无需询问直接跳过。
委托标题和正文生成给。加载技能:
ce-pr-descriptionce-pr-description- 新PR(步骤3中未发现现有PR):使用之前解析出的基准分支,以的形式调用,这样即使分支目标是非默认基准分支(如
base:<base-remote>/<base-branch>、develop),release/*也能描述正确的提交范围。附加任何捕获的证据上下文或用户重点作为自由文本指导(例如:“将捕获的demo:<URL>作为ce-pr-description部分包含在内”,或“证据已本地捕获——未嵌入”)。## Demo - 现有PR(步骤3中发现):使用步骤3上下文中的完整PR URL调用(例如:)。即使在工作树或子目录中调用,URL也能保留仓库/PR的身份信息;技能会读取PR自身的
https://github.com/owner/repo/pull/123,无需baseRefName覆盖。在URL后附加任何重点指导作为自由文本。base:
指导原则。仅传递差异无法揭示的信息:用户重点(“强调性能提升”)、特定框架关注点(“需将其描述为迁移而非功能”)或机构知识指针。不要传入详尽的范围摘要或每个变更的编号列表——会自行读取差异。过度指定的指导会导致下游技能覆盖所有传入内容,产生冗长输出。指导文本控制在约100词以内;如果需要更长的框架说明,相信差异本身并精简内容。
ce-pr-descriptionce-pr-description{title, body_file}如果返回优雅退出消息而非(例如:PR已关闭、无提交可描述、基准引用未解析),报告该消息并停止操作——不要创建或编辑PR。
ce-pr-description{title, body_file}Step 7: Create or update the PR
步骤7:创建或更新PR
New PR (no existing PR from Step 3)
新PR(步骤3中未发现现有PR)
Using the / block returned by , substitute and verbatim. If contains , , , or , escape them or switch to single quotes:
=== TITLE ====== BODY_FILE ===ce-pr-description<TITLE><BODY_FILE><TITLE>"`$\bash
gh pr create --title "<TITLE>" --body "$(cat "<BODY_FILE>")"Keep the title under 72 characters; already emits a conventional-commit title in that range.
ce-pr-description使用返回的 / 块,直接替换和。如果包含, , , 或,请转义这些字符或改用单引号:
ce-pr-description=== TITLE ====== BODY_FILE ===<TITLE><BODY_FILE><TITLE>"`$\bash
gh pr create --title "<TITLE>" --body "$(cat "<BODY_FILE>")"标题长度保持在72字符以内;已生成符合该长度的约定式提交标题。
ce-pr-descriptionExisting PR (found in Step 3)
现有PR(步骤3中发现)
The new commits are already on the PR from Step 5. Report the PR URL, then ask whether to rewrite the description.
-
If no -- skip Step 6 entirely and finish. Do not run delegation or evidence capture when the user declined the rewrite.
-
If yes, perform these three actions in order. They are separate steps with a hand-off boundary between them -- do not stop between actions.
-
Run Step 6 to generate via(passing the existing PR URL as
ce-pr-description).pr:explicitly does not apply on its own; it returns itsce-pr-description/=== TITLE ===block and stops.=== BODY_FILE === -
Preview and confirm. Read the first two sentences of the Summary from the body file, plus the total line count. Ask the user (per the "Asking the user" convention at the top of this skill): "New title:(
<title>chars). Summary leads with:<N>. Total body:<first two sentences>lines. Apply?" The first two sentences of the Summary carry most of the reviewer's attention; they are the single highest-leverage text in the description, so they are what the preview spotlights. If the user declines, they may pass steering text back for a regenerate; do not apply.<L> -
If confirmed, apply the returned title and body file yourself. This is this skill's responsibility, not the delegated skill's. Substituteand
<TITLE>verbatim from the return block; if<BODY_FILE>contains<TITLE>,",`, or$, escape them or switch to single quotes:\bashgh pr edit --title "<TITLE>" --body "$(cat "<BODY_FILE>")"
Then report the PR URL (Step 8). -
新提交已通过步骤5推送到PR。报告PR URL,然后询问用户是否重写描述。
-
如果否——完全跳过步骤6并结束。当用户拒绝重写时,不要运行委托或证据捕获。
-
如果是,按顺序执行以下三个操作。这是三个独立步骤,中间有交接边界——步骤间不要停止。
-
运行步骤6,通过生成描述(传入现有PR URL作为
ce-pr-description参数)。pr:明确不会自动应用;它会返回ce-pr-description/=== TITLE ===块并停止。=== BODY_FILE === -
预览与确认。读取正文文件中Summary的前两句,以及总行数。按照本技能顶部“询问用户”的约定询问用户:“新标题:(
<title>字符)。摘要开头:<N>。正文总长度:<前两句>行。是否应用?”摘要的前两句是评审者最关注的内容;它们是描述中影响力最高的文本,因此预览重点展示这部分。如果用户拒绝,他们可能会返回指导文本要求重新生成;不要应用。<L> -
如果用户确认,自行应用返回的标题和正文文件。这是本技能的职责,而非委托技能的职责。直接替换返回块中的和
<TITLE>;如果<BODY_FILE>包含<TITLE>,",`, 或$,请转义这些字符或改用单引号:\bashgh pr edit --title "<TITLE>" --body "$(cat "<BODY_FILE>")"
然后报告PR URL(步骤8)。 -
Step 8: Report
步骤8:报告结果
Output the PR URL.
输出PR的URL。