cnb-code-commit
编写代码、提交推送并创建 PR,适用于功能开发、Bug 修复、重构优化等场景。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
编写代码、提交推送并创建 PR,适用于功能开发、Bug 修复、重构优化等场景。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create professional architecture, workflow, sequence, data-flow, and lifecycle/state diagrams as standalone HTML files with SVG graphics, a built-in dark/light theme toggle, and one-click export to PNG / JPEG / WebP / SVG. Accepts plain-language descriptions or pasted Mermaid code (flowchart, sequenceDiagram, stateDiagram) and lays the diagram out from scratch in archify style. Use when the user asks for system architecture diagrams, infrastructure diagrams, cloud architecture visualizations, security diagrams, network topology, technical workflows, approval flows, runbooks, CI/CD flows, process diagrams, API call sequences, request lifecycles, data pipelines, ETL/ELT maps, PII boundaries, data lineage, state machines, lifecycle diagrams, status transitions, or asks to convert/beautify a Mermaid diagram.
Use when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, cloud architecture from Terraform or Kubernetes manifests, ML/DL model figures (Transformer/CNN/LSTM), mind maps, or any visualization. Also use proactively when explaining systems with 3+ components, complex data flows, or relationships that benefit from visual representation. Best suited when the diagram needs custom styling, rich shape vocabulary, swimlanes, or exportable images (PNG/SVG/PDF/JPG). Generates .drawio XML and exports locally via the native draw.io desktop CLI.
专家团总路由器。用于 Codex CLI 的 $expert-team 调用。 自动在软件开发团队、设计原型专家团、产品战略团队、基础设施运维专家和安全专家之间路由,也支持显式指定 software/design/product/ops/security。 触发词:专家团、团队协作、软件开发、设计原型、产品战略、基础设施运维、安全专家、威胁建模、代码审计、SRE、PRD、竞品、路线图、监控、部署、安全加固
Specialized agent for developing AIUI applications. Invoke when writing AIUI code, needing API references for jsui/wx, debugging AIUI applications, or aligning AIUI visual design with this Skill's design guidelines.
为文章规划并生成可读性强的极简强线条手绘配图。先建立文章地图,识别段落适合流程图、架构图、对比图、关系图、结构图还是概念插图,再通过构思卡组织单一命题、原文指纹、信息单位、阅读顺序和固定橙白圆猫角色。构思通过可读性测试后默认直接生成。用户说配图、手绘配图、给文章配图、文章插图、技术文章插图、流程图、架构图、关系图或 illustrate my article 时使用。
CNB 平台交互命令,支持代码仓库、Issue、PR、CI、制品库读写等操作。
| name | cnb-code-commit |
| description | 编写代码、提交推送并创建 PR,适用于功能开发、Bug 修复、重构优化等场景。 |
根据用户需求选择:
分析用户输入,明确要修改的文件、功能/Bug 描述、目标分支(PR 的 base)。 如需了解项目结构,直接在当前工作区读取代码。如需了解 PR 变更,可使用 cnb-pr-diff Skill。
根据触发场景切换到正确的工作分支:
CNB_PULL_REQUEST_IID 存在):在此分支上继续修改
git checkout "$CNB_PULL_REQUEST_BRANCH"
git pull origin "$CNB_PULL_REQUEST_BRANCH"
git checkout <PR 源分支名> && git pull
auto/{关键词1}-{关键词2}-{4位随机后缀}
git checkout -b auto/{关键词1}-{关键词2}-$(openssl rand -hex 2)
⚠️ 分支命名精简规则:
{关键词}:从 ISSUE 标题/描述中提取 2 个核心关键词(名词或动词),用短横线连接,每个关键词不超过 2 个英文单词{随机后缀}:固定 4 位十六进制,用$(openssl rand -hex 2)生成- 总长度控制:分支名
auto/之后的部分不超过 20 个字符- 示例:
auto/optimize-skill-3a7f、auto/login-error-b2c1
直接在工作区中读取和修改文件,实现代码变更。遵循项目已有的代码风格,确保 import/依赖完整。
生成/修改 .cnb.yml 时的特殊处理:
cnb-pipeline skill 的 SKILL.md,参照其中的语法文档和校验方式生成并验证配置# 查看变更概览
git diff --stat
# 如有构建/lint 命令则执行验证
# 暂存并提交
git add -A
git commit -m "{类型}: {简短描述}"
类型:feat(新功能) / fix(修复) / refactor(重构) / docs(文档) / chore(其他)
# 推送当前分支
git push origin HEAD
根据推送输出判断是否已有 PR:
There is already has pull request):跳过创建 PR,直接在评论中告知用户Create a pull request 或 new branch):走第 6 步创建 PR⚠️ 只有新建分支且推送后确认无 PR 时,才执行第 6 步。
示例 1 — 已有 PR,跳过创建:
$ git push origin HEAD
remote:
remote: There is already has pull request for 'fix/optimize-cnb-code-commit-skill' by visiting:
remote:
remote: https://cnb.cool/cnb/skills/cnb-skill/-/pulls/140
remote:
To https://cnb.cool/cnb/skills/cnb-skill.git
e3d8f95..639bd55 HEAD -> fix/optimize-cnb-code-commit-skill
# 输出包含 "There is already has pull request" → 已有 PR,不再创建
# 在评论中告知用户:PR 已存在,代码已推送到 PR #140
示例 2 — 无 PR,需要创建:
$ git push origin HEAD
remote:
remote: Create a pull request for 'fix/optimize-cnb-code-commit-skill' to 'main' by visiting:
remote:
remote: https://cnb.cool/cnb/skills/cnb-skill/-/compare/main...fix/optimize-cnb-code-commit-skill
remote:
To https://cnb.cool/cnb/skills/cnb-skill.git
* [new branch] fix/optimize-cnb-code-commit-skill -> fix/optimize-cnb-code-commit-skill
# 输出包含 "Create a pull request" → 无 PR,需要走第 6 步创建
cnb pulls post-pull --repo "$CNB_REPO_SLUG" \
--base "$CNB_DEFAULT_BRANCH" \
--head "$(git branch --show-current)" \
--title "{类型}: {简短描述}" \
--body '{变更目的与主要改动,支持 Markdown 真换行}
Ref #'"$CNB_ISSUE_IID"
⚠️
--body用单引号包真换行,不要用\n;非 ISSUE 触发时去掉末尾Ref #...行。
.cnb.yml 文件时需使用 cnb-pipeline skill 技能cnb pulls check-status 等命令反复轮询。如果 CI 失败,平台会自动唤起 NPC 继续处理,NPC 只需在评论中说明已完成的修复即可结束当前会话git push --force(不要强制推送,除非用户明确要求;如需覆盖可用 --force-with-lease)