Skip to content
Back to skills

Finish Worktree

ASecurity

Completes feature branch work by rebasing, pushing, monitoring CI, and squash merging to main

  • 8 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 25, 2026
ai-agentsgobashgit

Works with

  • cli
  • mcp

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 25, 2026

npx -y skills add dravr-ai/dravr-embacle --skill finish-worktree --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Finish Worktree?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Finish Worktree
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dravr-ai-finish-worktree/badge)](https://www.skillsdirectory.com/skills/dravr-ai-finish-worktree)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: finish-worktree
description: Completes feature branch work by rebasing, pushing, monitoring CI, and squash merging to main
user-invocable: true
---

# Finish Worktree Skill

**CLAUDE: When this skill is invoked with `/finish-worktree`, immediately run:**
```bash
./.claude/skills/finish-worktree/finish-worktree.sh
```
**Then guide the user through CI monitoring and merge-and-cleanup.**

## Purpose
Completes feature branch work with proper rebase, CI validation, and squash merge back to main.

## Usage
```bash
/finish-worktree
```

## Workflow Steps

### Step 1: Rebase onto main
```bash
./.claude/skills/finish-worktree/finish-worktree.sh
```

This script:
1. Fetches latest from origin/main
2. Rebases your branch onto main
3. Runs local validation (fmt, architectural, clippy)
4. Pushes with `--force-with-lease`

### Step 2: Monitor CI
Use the first available method (**never ask for a GitHub token**):
1. `gh run list --branch <branch>` / `gh run watch` — if gh CLI is authenticated
2. GitHub MCP tools (`mcp__github__*`) — if MCP server is configured
3. WebFetch `https://github.com/dravr-ai/dravr-platform/actions` — always available

Wait for all checks to pass (green).

### Step 3: If CI Fails
Fix the issues locally, then:
```bash
# Make fixes
cargo fmt
CARGO_BUILD_WARNINGS=deny cargo clippy --all-targets -- -D clippy::all -D clippy::pedantic -D clippy::nursery

# Amend or add commit
git add .
git commit --amend --no-edit  # or new commit

# Push again
git push --force-with-lease origin <branch-name>
```

Repeat until CI is green.

### Step 4: Squash Merge and Cleanup
Once CI is green, run from the **main worktree**:
```bash
cd /path/to/main/worktree
./.claude/skills/finish-worktree/merge-and-cleanup.sh
```

No arguments needed - branch info is saved by `finish-worktree.sh`.

This script:
1. Pulls latest main
2. Squash merges the feature branch
3. Prompts for commit message
4. Pushes main
5. Removes the worktree
6. Deletes the feature branch

## Complete Example Session
```bash
# On feature branch in worktree
./.claude/skills/finish-worktree/finish-worktree.sh

# Wait for CI...
# If red, fix and push again
# Once green, go to main worktree:

cd /path/to/main/worktree
./.claude/skills/finish-worktree/merge-and-cleanup.sh
```

## Related Skills
- `create-worktree` - Creates worktree with environment setup

Files in this skill

  • SKILL.md2.3 KB
  • finish-worktree.sh2 KB
  • merge-and-cleanup.sh3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.