Guide completion of development work by presenting merge/PR options. Use when "I'm done", "merge this", "create PR", "finish up", or when implementation is complete and tests pass.
/plugin marketplace add pproenca/dot-claude/plugin install dev-workflow@pproencaThis skill is limited to using the following tools:
Guide completion of development work by presenting clear options.
After code review passes, tests pass, work is ready to integrate.
Invoked by:
npm test # or cargo test / pytest / go test ./...
If tests fail: Stop. Cannot proceed until tests pass.
git merge-base HEAD main 2>/dev/null && BASE="main" || \
git merge-base HEAD master 2>/dev/null && BASE="master" || \
BASE="unknown"
If unknown, ask user which branch.
Use AskUserQuestion:
AskUserQuestion:
header: "Integration"
question: "Work complete. How to proceed?"
multiSelect: false
options:
- label: "Merge locally"
description: "Rebase onto base, fast-forward merge (linear history)"
- label: "Create PR"
description: "Push branch and create Pull Request"
- label: "Keep as-is"
description: "Preserve branch and worktree for later"
- label: "Discard"
description: "Delete branch and all commits"
Uses rebase for linear history (stacked-diffs approach):
source "${CLAUDE_PLUGIN_ROOT}/scripts/worktree-manager.sh"
FEATURE="$(git branch --show-current)"
# Safety check: uncommitted changes
if [ -n "$(git status --porcelain)" ]; then
echo "Error: Uncommitted changes. Commit first."
exit 1
fi
# SAFETY: Push branch to remote BEFORE rebase (prevents data loss)
echo "Pushing branch to remote before rebase..."
git push -u origin "$FEATURE" || {
echo "ERROR: Failed to push. Cannot proceed."
echo "This prevents data loss - all work must be on remote before rebase."
exit 1
}
# Verify push succeeded by comparing SHAs
LOCAL_SHA=$(git rev-parse "$FEATURE")
REMOTE_SHA=$(git ls-remote origin "$FEATURE" | cut -f1)
if [[ "$LOCAL_SHA" != "$REMOTE_SHA" ]]; then
echo "ERROR: Local and remote are out of sync. Push may have failed."
exit 1
fi
echo "Branch pushed successfully. Safe to proceed."
# Store original SHA for recovery reference
ORIGINAL_SHA="$LOCAL_SHA"
# Fetch latest changes
git fetch origin
# Rebase feature branch onto base (linear history)
echo "Rebasing $FEATURE onto origin/$BASE..."
if ! git rebase "origin/$BASE"; then
echo ""
echo "ERROR: Rebase conflict detected. Aborting rebase."
# Abort to restore working state
git rebase --abort
echo ""
echo "Your branch has been restored to its original state."
echo "Original commit: $ORIGINAL_SHA"
echo "Remote backup: origin/$FEATURE"
echo ""
echo "To resolve manually:"
echo " 1. git rebase origin/$BASE"
echo " 2. Resolve conflicts in each file"
echo " 3. git add <resolved-files>"
echo " 4. git rebase --continue"
echo " 5. Re-run this merge process"
exit 1
fi
echo "Rebase successful."
# Force push rebased branch (safe - we have backup on remote)
echo "Force pushing rebased branch..."
if ! git push --force-with-lease origin "$FEATURE"; then
echo "ERROR: Force push failed."
echo "This may happen if someone else pushed to this branch."
echo "Your rebased changes are still local."
echo "Remote backup exists at origin/$FEATURE (pre-rebase)"
exit 1
fi
# Get main repo path
MAIN_REPO="$(get_main_worktree)"
# If in worktree, go to main repo for the merge
if ! is_main_repo; then
cd "$MAIN_REPO"
fi
# Checkout base and fast-forward merge (no merge commit)
git checkout "$BASE"
git pull origin "$BASE" 2>/dev/null || true
echo "Fast-forward merging $FEATURE into $BASE..."
if ! git merge --ff-only "origin/$FEATURE"; then
echo "ERROR: Fast-forward merge failed."
echo "This should not happen after a successful rebase."
echo "The base branch may have changed. Try again."
exit 1
fi
npm test # verify merged result
If tests pass and was in worktree:
source "${CLAUDE_PLUGIN_ROOT}/scripts/worktree-manager.sh"
# Clean up worktree if we were in one (not main repo)
if ! is_main_repo; then
# remove_worktree has safety checks for unpushed commits
remove_worktree
fi
Skip to Step 5.
FEATURE=$(git branch --show-current)
git push -u origin $FEATURE
gh pr create --title "[title]" --body "## Summary\n[changes]\n\n## Tests\n- All passing"
Proceed to Step 5.
Report branch and worktree location. Skip Step 5. Return.
First, check for unpushed commits and warn user:
source "${CLAUDE_PLUGIN_ROOT}/scripts/worktree-manager.sh"
FEATURE="$(git branch --show-current)"
# Check if branch has unpushed commits
if ! git ls-remote --heads origin "$FEATURE" 2>/dev/null | grep -q .; then
echo "WARNING: Branch '$FEATURE' has NEVER been pushed to remote!"
echo "Discarding will PERMANENTLY delete all work on this branch."
elif [[ -n "$(git log origin/$FEATURE..$FEATURE --oneline 2>/dev/null)" ]]; then
echo "WARNING: Branch '$FEATURE' has unpushed commits:"
git log "origin/$FEATURE..$FEATURE" --oneline
echo "Discarding will PERMANENTLY delete these commits."
fi
Then confirm with AskUserQuestion:
AskUserQuestion:
header: "Confirm"
question: "Discard all work on this branch? This CANNOT be undone."
multiSelect: false
options:
- label: "Yes, discard permanently"
description: "Delete branch and all commits - NO recovery possible"
- label: "Cancel"
description: "Return to integration options"
If user confirms discard:
source "${CLAUDE_PLUGIN_ROOT}/scripts/worktree-manager.sh"
FEATURE="$(git branch --show-current)"
# If in worktree, go to main repo first
if ! is_main_repo; then
WORKTREE_PATH="$(pwd)"
MAIN_REPO="$(get_main_worktree)"
cd "$MAIN_REPO"
# Force remove worktree (user explicitly confirmed discard)
git worktree remove --force "$WORKTREE_PATH"
fi
# Force delete branch (user explicitly confirmed discard)
git checkout "$BASE"
git branch -D "$FEATURE"
Proceed to Step 5.
Report:
Branch finished:
- Action: [Merged / PR created / Discarded]
- Branch: [name]
- Worktree: [cleaned up / preserved]
Return to caller.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.