Skip to content
Agentmart
Submit a tool

finish-branch

实现完成、所有测试通过时使用 — 呈现结构化选项:merge/PR/保留/丢弃

Skill by noobke

IndexedMIT★ 3
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/noobke-finish-branch

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

实现完成、所有测试通过时使用 — 呈现结构化选项:merge/PR/保留/丢弃

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/finish-branch

What's inside

Skill name
finish-branch
Description
实现完成、所有测试通过时使用 — 呈现结构化选项:merge/PR/保留/丢弃
License
MIT
Instructions
83 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • name: missing

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Finish Branch — 完成开发分支

## 概述

完成开发工作后,呈现清晰选项并执行选择的工作流。

**核心原则:** 验证测试 → 检测环境 → 呈现选项 → 执行选择 → 清理。

## 流程

### 步骤 1: 验证测试

```bash
npm test  # 或其他测试命令
```

**测试失败?** 停下来。不能继续。先修复。

### 步骤 2: 检测环境

```bash
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
BRANCH=$(git branch --show-current)
```

### 步骤 3: 确定 base 分支

```bash
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
```

### 步骤 4: 呈现选项

```
实现完成。你想怎么做?

1. 合并回 <base-branch>(本地)
2. Push 并创建 Pull Request
3. 保持分支现状(我之后处理)
4. 丢弃这个工作

选哪个?
```

### 步骤 5: 执行选择

**选项 1 — 本地合并:**
```bash
git checkout <base-branch>
git pull
git merge <feature-branch>
npm test  # 验证合并结果
git worktree remove .worktrees/<branch-name>
git branch -d <feature-branch>
```

**选项 2 — Push 并创建 PR:**
```bash
git push -u origin <feature-branch>
gh pr create --title "<title>" --body "<summary>"
```
**不要清理 worktree** — 用户需要它来做 PR 迭代。

**选项 3 — 保持现状:**
报告 "保留分支 <name>。Worktree 保留在 <path>。"

**选项 4 — 丢弃:**
先确认。等用户输入 "discard" 确认后:
```bash
git checkout <base-branch>
git worktree remove .worktrees/<branch-name>
git branch -D <feature-branch>
```

## 记住

- 不要在有失败测试的情况下继续
- 不要未经确认就删除工作
- 不要在 worktree 内部运行 `git worktree remove`(要先 cd 到主仓库)
- 清理后运行 `git worktree prune`

From noobke/reasonix-skills, MIT.

More from noobke/reasonix-skills

Signals

Stars
3
Forks
0
Open issues
0
Last commit (this folder)
May 28, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from noobke

Cite this page

finish-branch skill. Agent Mart. https://agentmart.dev/skills/noobke-finish-branch (last updated 2026-10-24)