00-bkci-global-archite…
用于跨模块开发、排查链路归属、判断某个需求应该落在哪个 BK-CI 模块,或需要快速理解流水线全链路协作时使用。单模块修改时优先读取对应模块 skill,而不是停留在这里。
清理长时间未使用的 git worktree(GitHub 版)。仅在用户明确要求清理 worktree 时使用,不自动触发。 关键词:清理 worktree、删除 worktree、移除旧分支、worktree 回收。
$ npx -y skills add tencentblueking/bk-ci --skill cleanup-github-worktree --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/cleanup-github-worktreeContext preview
The summary Claude sees to decide when to auto-load this skill.
清理长时间未使用的 git worktree(GitHub 版)。仅在用户明确要求清理 worktree 时使用,不自动触发。 关键词:清理 worktree、删除 worktree、移除旧分支、worktree 回收。
name: cleanup-github-worktree description: >- 清理长时间未使用的 git worktree(GitHub 版)。仅在用户明确要求清理 worktree 时使用,不自动触发。 关键词:清理 worktree、删除 worktree、移除旧分支、worktree 回收。 disable-model-invocation: true
手动触发:当用户明确要求清理、删除或回收长时间未使用的 worktree 时执行。
**必须在 master 上执行**:执行前 `git branch --show-current`;若不是 `master`,中止并提示用户切换。
使用 AskQuestion 让用户选择阈值:
将用户选择映射为天数:
| 选项 | 天数 | |------|------| | 1 周 | 7 | | 2 周 | 14 | | 1 个月 | 30 |
运行清理脚本,输出候选分支名列表(每行一个分支名),不执行删除。
根据操作系统选择脚本(通过用户信息中的 `OS Version` 判断):
**Windows(PowerShell):**
powershell -File .cursor/skills/cleanup-github-worktree/scripts/cleanup-worktree.ps1 -Days <天数>
**macOS / Linux(Bash):**
bash .cursor/skills/cleanup-github-worktree/scripts/cleanup-worktree.sh -d <天数>
将脚本输出的分支名列表展示给用户。如果没有找到过期 worktree,告知用户并结束。
使用 AskQuestion 让用户确认是否继续:
用户选择取消时,结束工作流。
对 Step 2 识别出的**每一个候选分支**,以该分支名作为目标分支,执行 `close-github-worktree-done` skill 的 **Step 1 ~ Step 5** 完整流程(跳过其 Step 0 的交互选择)。
向用户展示清理结果摘要,包含每个分支的处理状态:
| 分支名 | GitHub Issue | worktree | 本地分支 | 备注 | |--------|--------------|----------|----------|------| | bug-12994 | ✅ closed | ✅ 已移除 | ✅ 已删除 | | | feat-11524 | ⏭ 跳过 | ✅ 已移除 | ✅ 已删除 | 分支名无 issue 号 | | pref-12948 | — | — | — | 跳过(有未提交变更) |
| 脚本 | 系统 | 路径 | |------|------|------| | cleanup-worktree.ps1 | Windows | `.cursor/skills/cleanup-github-worktree/scripts/cleanup-worktree.ps1` | | cleanup-worktree.sh | macOS/Linux | `.cursor/skills/cleanup-github-worktree/scripts/cleanup-worktree.sh` |
脚本职责:
1. 通过 `git worktree list --porcelain` 获取所有 worktree 2. 跳过主 worktree(第一个)和 bare 条目 3. 通过 `git log -1 --format=%ct <branch>` 获取分支最后一次 commit 时间;detached HEAD 时回退到目录修改时间 4. 筛选超出阈值的条目,**仅输出候选分支名列表**(每行一个),供本 skill Step 2 解析使用
用于跨模块开发、排查链路归属、判断某个需求应该落在哪个 BK-CI 模块,或需要快速理解流水线全链路协作时使用。单模块修改时优先读取对应模块 skill,而不是停留在这里。
处理 BK-CI Agent 构建机侧能力时使用,例如守护进程、心跳、Ask 轮询、任务拉起、升级更新和与 Dispatch/Worker 的协作。当用户要改构建机宿主侧行为而不是…
设计 BK-CI API 契约时使用,例如 Resource 路径设计、HTTP 方法选择、请求响应对象、错误码和版本策略。当用户要定义接口而不是实现业务逻辑时优先使用。
处理 BK-CI 制品上传下载、制品元数据、BkRepo 或磁盘后端存储、文件任务和清理链路时使用。当用户提到构建产物、制品归档、下载令牌、报告文件、BkRepo…
处理 BK-CI Auth 模块时使用,例如 RBAC 权限校验、用户组与资源管理、IAM 集成、授权迁移和 OAuth2 认证。当用户要改权限平台实现而不是单次权限模型变更时优先使用。
编写 BK-CI 后端微服务代码时使用,例如新增 Resource、组织 API/Service/DAO 分层、依赖注入、服务归属判断和 Spring Boot 开发约定。当用户要做…