完成开发分支:Openclaw Skills 的工作流自动化
作者:互联网
2026-04-06
什么是 完成开发分支?
“完成开发分支”是一项专门的技能,旨在填补已完成代码与集成功能之间的空白。它为使用 Openclaw Skills 的开发人员提供了一个标准化框架,用于处理分支生命周期的最终阶段。通过执行测试优先的哲学,该技能可防止集成损坏的代码,并减轻 Git 维护的认知负荷。
无论您是本地合并到基础分支,还是将功能推送到远程仓库,该技能都会通过四个不同的高级选项引导完成该过程。它确保从分支清理到工作树移除的每一项操作都安全并符合最佳实践,从而维持一个整洁的开发环境。
下载入口:https://github.com/openclaw/skills/tree/main/skills/zlc000190/finishing-a-development-branch
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install finishing-a-development-branch
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 finishing-a-development-branch。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
完成开发分支 应用场景
- 在子代理计划中的所有任务完成后,结束功能开发。
- 自动创建带有摘要和测试计划的标准拉取请求(Pull Request)。
- 在验证测试后,安全地将本地分支合并到 main 或 master 分支。
- 在任务完成后清理临时 Git 工作树,以释放系统资源。
- 舍弃实验性分支,并带有必要的安全确认步骤以防止意外丢失。
- 该技能通过运行项目的测试套件开始,以确保当前实现是稳定的。
- 它识别基础分支(例如 main 或 master),以确定逻辑集成目标。
- 为用户提供四个明确的选项:本地合并、创建 PR、保持分支原样或舍弃工作。
- 选择后,该技能执行必要的 Git 和 GitHub CLI 命令以完成所选路径。
- 它执行最终维护工作,例如删除本地功能分支或针对特定选项移除关联的 Git 工作树。
完成开发分支 配置指南
为了在 Openclaw Skills 中有效使用此技能,请确保您的系统中已安装并验证了 Git CLI 和 GitHub CLI。
# 确保 GitHub CLI 已通过身份验证以创建 PR
gh auth status
# 验证您的测试环境已配置且可访问
npm test # 或 cargo test, pytest, go test 等
完成开发分支 数据架构与分类体系
该技能与 Git 元数据和本地文件结构交互,通过以下架构管理开发生命周期:
| 数据点 | 描述 |
|---|---|
| 基础分支 | 通过 git merge-base 识别的父分支 (main/master)。 |
| 功能分支 | 包含已完成实现的当前工作分支。 |
| PR 模板 | 包含更改摘要和测试计划的结构化格式。 |
| 工作树路径 | 签出分支的物理目录,用于跟踪清理。 |
name: finishing-a-development-branch
description: Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Finishing a Development Branch
Overview
Guide completion of development work by presenting clear options and handling chosen workflow.
Core principle: Verify tests → Present options → Execute choice → Clean up.
Announce at start: "I'm using the finishing-a-development-branch skill to complete this work."
The Process
Step 1: Verify Tests
Before presenting options, verify tests pass:
# Run project's test suite
npm test / cargo test / pytest / go test ./...
If tests fail:
Tests failing ( failures). Must fix before completing:
[Show failures]
Cannot proceed with merge/PR until tests pass.
Stop. Don't proceed to Step 2.
If tests pass: Continue to Step 2.
Step 2: Determine Base Branch
# Try common base branches
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
Or ask: "This branch split from main - is that correct?"
Step 3: Present Options
Present exactly these 4 options:
Implementation complete. What would you like to do?
1. Merge back to locally
2. Push and create a Pull Request
3. Keep the branch as-is (I'll handle it later)
4. Discard this work
Which option?
Don't add explanation - keep options concise.
Step 4: Execute Choice
Option 1: Merge Locally
# Switch to base branch
git checkout
# Pull latest
git pull
# Merge feature branch
git merge
# Verify tests on merged result
# If tests pass
git branch -d
Then: Cleanup worktree (Step 5)
Option 2: Push and Create PR
# Push branch
git push -u origin
# Create PR
gh pr create --title "" --body "$(cat <<'EOF'
## Summary
<2-3 bullets of what changed>
## Test Plan
- [ ]
EOF
)"
Then: Cleanup worktree (Step 5)
Option 3: Keep As-Is
Report: "Keeping branch
Don't cleanup worktree.
Option 4: Discard
Confirm first:
This will permanently delete:
- Branch
- All commits:
- Worktree at
Type 'discard' to confirm.
Wait for exact confirmation.
If confirmed:
git checkout
git branch -D
Then: Cleanup worktree (Step 5)
Step 5: Cleanup Worktree
For Options 1, 2, 4:
Check if in worktree:
git worktree list | grep $(git branch --show-current)
If yes:
git worktree remove
For Option 3: Keep worktree.
Quick Reference
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|---|---|---|---|---|
| 1. Merge locally | ? | - | - | ? |
| 2. Create PR | - | ? | ? | - |
| 3. Keep as-is | - | - | ? | - |
| 4. Discard | - | - | - | ? (force) |
Common Mistakes
Skipping test verification
- Problem: Merge broken code, create failing PR
- Fix: Always verify tests before offering options
Open-ended questions
- Problem: "What should I do next?" → ambiguous
- Fix: Present exactly 4 structured options
Automatic worktree cleanup
- Problem: Remove worktree when might need it (Option 2, 3)
- Fix: Only cleanup for Options 1 and 4
No confirmation for discard
- Problem: Accidentally delete work
- Fix: Require typed "discard" confirmation
Red Flags
Never:
- Proceed with failing tests
- Merge without verifying tests on result
- Delete work without confirmation
- Force-push without explicit request
Always:
- Verify tests before offering options
- Present exactly 4 options
- Get typed confirmation for Option 4
- Clean up worktree for Options 1 & 4 only
Integration
Called by:
- subagent-driven-development (Step 7) - After all tasks complete
- executing-plans (Step 5) - After all batches complete
Pairs with:
- using-git-worktrees - Cleans up worktree created by that skill
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
Rho 加密货币组合追踪器:多平台损益与净值 - Openclaw Skills
AHC-Automator:制造与 CRM 自动化 - Openclaw 技能
hot-aggregator-cn:实时中文社交趋势追踪 - Openclaw Skills
Heimdall:针对 Openclaw Skills 的 AI 驱动安全扫描器
solo-humanize: AI 文本拟人化与模式消除器 - Openclaw Skills
CodeDNA:BNB Chain 上的自主 AI 生命进化 - Openclaw Skills
EvoMap Lite 客户端:自动化 AI 智能体集群协作 - Openclaw Skills
Skill Guard:Openclaw Skills 的高级安全扫描器
Arayun 173 蓝丝黛尔石执行官:AI 执法技能 - Openclaw Skills
乐享:腾讯知识库 API 集成 - Openclaw Skills
AI精选
