一键导入
team-issue-create-mr-gitlab
为已完成的单个 issue 分支推送代码并创建关联 issue 的 GitLab Merge Request。Push a completed issue branch and create an issue-linked GitLab Merge Request.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
为已完成的单个 issue 分支推送代码并创建关联 issue 的 GitLab Merge Request。Push a completed issue branch and create an issue-linked GitLab Merge Request.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
创建、审阅和优化团队自有项目 README.md,以准确事实和自上而下的信息层级呈现定位、快速开始、使用与维护入口。Create, review, and improve README.md for team-owned projects using verified facts and a progressive top-to-bottom reading flow.
将代码库事实转化为面向业务、产品和管理者的能力说明、场景材料和影响分析。Turn codebase evidence into business-facing capability briefs, scenario narratives, and impact analysis.
从已有代码仓库提取可追溯的功能清单、架构说明和 AI 接手上下文。Extract traceable feature inventory, architecture notes, and AI onboarding context from an existing codebase.
基于 onboarding 产物和源码,围绕功能清单做代码库走读、问答和证据追踪。Guide developers through codebase features with walkthroughs, Q&A, and source-backed explanations.
为已完成的单个 issue 分支推送代码并创建关联 issue 的 GitHub Pull Request。Push a completed issue branch and create an issue-linked GitHub Pull Request.
为具体代码项目维护 Codex 运行时检索层、入口约束、失败记忆和验证 harness。Maintain a Codex runtime retrieval layer, entry constraints, failure memory, and verification harness for a concrete code project.
| name | team-issue-create-mr-gitlab |
| description | 为已完成的单个 issue 分支推送代码并创建关联 issue 的 GitLab Merge Request。Push a completed issue branch and create an issue-linked GitLab Merge Request. |
| license | MIT |
| metadata | {"author":"coolbeevip","version":"1.0"} |
| triggers | ["创建 GitLab MR","创建合并请求","给这个 issue 建 MR","推送分支并创建 MR","准备提 MR","create GitLab MR","open merge request","create merge request for issue","push branch and open MR","open MR for this issue"] |
这个技能用于在 team-issue-implement 和 team-issue-verify 后,把已经提交好的当前 issue 分支推送到 GitLab,并创建关联 issue 的 Merge Request。它关注“少出错、可预览、可追踪”,避免手动复制 issue 编号、标题规范和正文模板时遗漏关联。
v1 仅支持 GitLab Merge Request。GitHub Pull Request 应使用独立技能。
team-issue-create-pr-github;实现尚未验证时,先转交 team-issue-verify。统一读取目标项目根目录 team-spec/config.yml:
language: zh-CN
version_control:
system: git
trunk_branch: main
contribution_model: fork-pull
source_remote: origin
target_remote: upstream
access_policy:
mode: default-readonly
directory_file: team-spec/access_policy/default.md
user_file_template: team-spec/access_policy/{user_name}.md
语言优先级:用户本轮明确指定或脚本 --language > team-spec/config.yml > en-US 兜底。若配置不存在,技能执行时应先按团队规范询问语言偏好并创建配置;固定脚本独立运行时不交互,使用 en-US 兜底。
远端 GitLab Merge Request 正文模板标题、兜底文案和检查项必须使用 language;本地 issue 草稿已有内容保持原文。
版本管理优先级:用户显式参数 > team-spec/config.yml 的 version_control > git 命令推断 > 询问用户。若缺少 version_control,先用 git remote -v、git branch --show-current、git branch -r、git symbolic-ref refs/remotes/{remote}/HEAD 和 git config --get branch.{branch}.remote 推断 source remote、target remote、主干分支和贡献方式;无法唯一判断时再询问用户,并在用户确认后回写 team-spec/config.yml。
team-spec/config.yml;如果存在 access_policy,先应用目录访问边界,再进入任何推送或写入流程。创建 GitLab MR 时,优先使用本技能目录下的固定脚本,不要临时重写 GitLab API 调用代码:
./scripts/create_gitlab_mr.py
脚本依赖同目录下的公共辅助模块 ./scripts/_team_common.py(vendored copy,与仓库根目录 scripts/_team_common.py 保持同步)。复制本技能目录时需一并复制该文件。
脚本能力:
team-spec/config.yml 或 git remote 推断 source project 与 target project。--execute 时先做执行前确认,再 push 当前分支并创建 GitLab Merge Request。--commit-message 搭配 --commit-all、--commit-path 或 --commit-staged 在 push 前创建本地提交。team-spec/ 下的文件执行 git add;如果发现 team-spec/ 文件已经在暂存区,必须停止并要求先取消暂存。[BugFix] Fix export filter;正文使用 ./scripts/templates/mr_body.md.tpl 按 language 渲染,并保留 Fixes #{issue_iid} 以便 GitLab 自动关联并在合并后关闭 issue。Status: mr-created,并记录 MR: 和 Pushed Branch:;该回写只修改本地文件,不会自动 git add 或提交 team-spec/。version_control.trunk_branch。.gitignore 规则的文件,并要求人类确认是否继续。推荐 dry-run:
GITLAB_URL=https://gitlab.example.com python3 {skill_dir}/scripts/create_gitlab_mr.py
用户确认后正式执行:
GITLAB_URL=https://gitlab.example.com GITLAB_TOKEN=... python3 {skill_dir}/scripts/create_gitlab_mr.py --execute
如果当前工作区或暂存区存在已验证但尚未提交的变更,必须先列出变更文件、暂存状态和推荐提交范围;用户确认提交范围和提交信息后,可在正式执行时指定提交范围。--commit-all 只会暂存非 team-spec/ 文件:
GITLAB_URL=https://gitlab.example.com GITLAB_TOKEN=... python3 {skill_dir}/scripts/create_gitlab_mr.py --execute --commit-message "Resolve #123: add export filter" --commit-all
也可以只提交指定路径或已暂存内容;指定路径不得位于 team-spec/ 下,已暂存内容中也不得包含 team-spec/ 文件:
GITLAB_URL=https://gitlab.example.com GITLAB_TOKEN=... python3 {skill_dir}/scripts/create_gitlab_mr.py --execute --commit-message "Resolve #123: add export filter" --commit-path src/export.py --commit-path tests/test_export.py
GITLAB_URL=https://gitlab.example.com GITLAB_TOKEN=... python3 {skill_dir}/scripts/create_gitlab_mr.py --execute --commit-message "Resolve #123: add export filter" --commit-staged
其中 {skill_dir} 是当前技能目录。技能内部定位脚本时应使用相对 SKILL.md 的路径 ./scripts/create_gitlab_mr.py,执行命令时再解析成实际文件路径。
常用参数:
--issue-iid 123:显式指定要关联的 GitLab issue IID。--target-branch master:指定目标分支;如果不传,脚本优先读取 team-spec/config.yml 的 version_control.trunk_branch,再通过 remote HEAD 推断。--source-remote origin:指定推送当前分支的 remote。--target-remote upstream:指定 MR 目标项目 remote。--target-project namespace/project:显式指定目标项目,优先级高于 remote 推断。--source-project namespace/project:显式指定 source project,用于 fork 工作流。--title "[Component] Add export filter":显式指定 MR 标题;推荐把组件标签放在最前面并用方括号,不建议在标题中包含 issue IID。--issue-file team-spec/active/{slug}/issues/123-short-title.md:显式指定本地 issue 草稿,用其中的 # 标题 或 ## Title 首行生成 MR 标题。--body-file path/to/body.md:显式指定 MR 正文;如未指定,脚本使用 ./scripts/templates/mr_body.md.tpl 生成标准正文。--language zh-CN:显式覆盖 MR 正文模板语言;不传时读取 team-spec/config.yml。--draft:创建 Draft MR。--label label-name:可重复传入多个 label。--assignee-id 123、--reviewer-id 456:可重复传入多个人员 ID。--commit-message "Resolve #123: ...":在 push 前提交本地未提交变更;必须搭配一个提交范围参数。--commit-all:用 git add -A 暂存整个工作区中除 team-spec/ 以外的变更后提交。--commit-path path:只暂存并提交指定路径;可重复传入,但路径不得位于 team-spec/ 下。--commit-staged:只提交已经暂存的内容,不额外暂存文件;如果暂存区包含 team-spec/ 文件,必须停止。--json:输出机器可读 JSON。GITLAB_URL=https://gitlab.example.com:GitLab 平台地址,必须通过环境变量提供;脚本不提供命令行覆盖参数,也不会默认猜测平台地址。优先读取:
123、issue-123、123-add-export-filter。team-spec/ 的未提交变更,team-spec/ 下未提交变更可留在工作区。team-spec/active/{slug}/issues/{issue-number}-{short-issue-slug}.md,如果能从分支、用户输入或对话中确定。team-spec/config.yml 的 version_control 配置,以及 Git remote 信息,用于推断 source project、target project、target branch 和贡献方式。必须参数或可推断信息:
GITLAB_URL 读取;不得通过命令行参数临时覆盖,未设置时脚本必须停止。version_control.trunk_branch,再其次来自 remote HEAD。如果无法唯一确定 issue IID、source project、target project、token 来源或 target branch,必须停止并向用户确认,不得猜测。
当用户没有显式提供 GitLab project 时,按以下规则推断:
--target-remote;否则使用名为 upstream 的 GitLab remote;否则使用当前分支 tracking remote;仍不唯一时要求用户指定。--source-remote;否则使用当前分支 tracking remote;否则使用 origin;如果只有一个 GitLab remote,则使用这个 remote。team-spec/config.yml 已配置 version_control.target_remote 或 version_control.source_remote,在未传显式参数时优先使用配置值。version_control.contribution_model: fork-pull,默认 target_remote 为 upstream、source_remote 为 origin;如果配置或 remote 与该模式冲突,先 dry-run 展示冲突并要求人类确认。自建 GitLab 场景下,remote host 必须与平台地址一致;如果不一致,应要求用户确认平台地址和项目。
[Component] Add clear change title,例如 [BugFix] Fix export filter、[CI] Add release check、[microTVM][CI] Fix board test workflow。[microTVM][CI]。Add ...、Fix ...、Update ...,不要写 Added ...、Fixed ...、Updated ...。API、CI、microTVM。. / 。。--title,优先使用该标题;脚本不会自动向标题补 issue IID,也不会猜测组件标签。--issue-file 指定的本地 issue 草稿读取标题;其次从 team-spec/active/*/issues/{issue-iid}-*.md 的唯一匹配文件读取标题,并兼容旧布局 team-spec/active/issues/*/{issue-iid}-*.md。# 标题 或 ## Title 段首行,不得回退到文件名。implementation,必须停止并要求用户提供 --title 或 --issue-file。Added、Fixed、Updated 等过去式动词开头,脚本会在 dry-run 预览中输出 Title style notes,提示用户用 --title 覆盖。Fixes #123。./scripts/templates/mr_body.md.tpl,并包含:
What is the purpose of the change?:简要说明为什么需要这个 MR;优先从 issue 的 What to build 映射,缺失时用分支和 issue 生成兜底摘要,并包含 Fixes #{issue_iid}。Brief change log:优先来自 issue 的 Implementation Notes。How was this tested?:优先来自 Commands Run,也兼容 Acceptance Criteria Coverage。Documentation:文档更新检查项。Compatibility / impact:优先来自 Compatibility / impact、Impact 或 Regression Risks。Reviewer notes:优先来自 Findings。--body-file,也必须保留 issue closing keyword;脚本会在缺失时自动补 Fixes #{issue_iid}。不要创建没有 issue 关联正文的 MR,除非用户明确要求。不要创建空泛标题的 MR,例如 implementation 或 Resolve #123: implementation。
team-spec/config.yml,缺失时先用 git 命令推断。git add 和 git commit。用户未确认时停止,不得继续 push 或创建 MR。--commit-all、--commit-path 或 --commit-staged 三选一。team-spec/:不得对 team-spec/ 下文件执行 git add;如果 team-spec/ 文件已经在暂存区,必须停止并要求用户先取消暂存。team-spec/config.yml,或工作区里存在被追踪但命中 .gitignore 的文件,执行前必须向人类确认;确认后可回写 team-spec/config.yml。--execute;如提供提交参数,脚本会先创建本地提交,再推送分支并创建 MR。提交后如仅剩 team-spec/ 下未提交变更,可以继续创建 MR。Status: mr-created、MR: 和 Pushed Branch:;不得自动暂存或提交 team-spec/。git add、git commit、git stash 或任何会改变本地提交历史的操作。git add 和 git commit;仍不得执行 git stash。team-spec/ 下文件执行 git add。如果自动提交前发现 team-spec/ 文件已在暂存区,必须停止,不得提交。team-spec/active/{slug}/issues/ 下对应 issue 草稿,但不得自动暂存或提交这些回写。implementation 这类兜底词。Status: mr-created、MR: 和 Pushed Branch:。必须包含:
mr-created 回写结果。team-spec/ 回写或其他剩余工作区变更。