Branch finalization. Validate, squash-merge, PR, keep, or discard. Clean state enforced. Triggers on: /godmode:finish, "done with branch", "merge this", "finalize", "wrap up".
From godmodenpx claudepluginhub arbazkhan971/godmodeThis skill uses the workspace's default tool permissions.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
/godmode:finish, "done", "merge", "finalize"Routes here when:
git log main..HEAD --oneline returns 1+ commits
AND user says "done", "merge", "finish"/godmode:build completes all tasks/godmode:finishbranch=$(git branch --show-current)
commits=$(git log main..HEAD --oneline | wc -l | tr -d ' ')
files_changed=$(git diff main..HEAD --stat | tail -1)
echo "Branch: $branch | $commits commits | $files_changed"
# Check if on main
if [ "$branch" = "main" ]; then
echo "ERROR: Already on main. Nothing to finish."
exit 1
fi
staged=$(git diff --cached --name-only)
unstaged=$(git diff --name-only)
untracked=$(git ls-files --others --exclude-standard)
IF staged non-empty: STOP — commit or stash first
IF unstaged non-empty: STOP — commit, stash, or discard
IF untracked files: WARN — won't be in merge
build_cmd && lint_cmd && test_cmd
THRESHOLDS:
Build: must exit 0
Lint: must exit 0 with --max-warnings=0
Tests: 100% pass rate required
IF any failure: STOP, run /godmode:fix first
IF no test runner: WARN, continue
git fetch origin main
git merge-tree \
$(git merge-base HEAD origin/main) origin/main HEAD
IF conflicts: print files, recommend rebase.
PRIORITY (first match wins):
DISCARD: user says "discard", "abandon" (confirm)
KEEP: user says "keep", "not yet", "park it"
MERGE: user says "merge" OR PR approved
PR: default when checks pass
MERGE:
git checkout main && git pull origin main
git merge --squash {branch}
git commit -m "feat({module}): {title}
Squashed {N} commits from {branch}."
git branch -d {branch}
PR:
gh pr create --title "feat({module}): {title}" \
--body "## Changes
$(git log main..HEAD --format='- %s')
## Guard Results
Build: PASS | Lint: PASS | Tests: PASS"
DISCARD: Require confirmation, then git branch -D.
IF MERGE: run build+test on main.
IF fails: git revert HEAD immediately.
IF PR: watch CI checks with gh pr checks.
IF DISCARD: verify branch is gone.
Append to .godmode/finish-results.tsv.
[finish:snapshot] Branch: {branch} | {N} commits
[finish:worktree] Clean worktree confirmed
[finish:guard] Build: PASS | Lint: PASS | Tests: PASS
[finish:preflight] No merge conflicts
[finish:outcome] Outcome: {PR|MERGE|KEEP|DISCARD}
[finish:execute] {result URL or status}
[finish:verify] {verification result}
timestamp branch outcome commits_squashed files_changed tests_result guard_status pr_url
FOR EACH dimension in [tests, coverage, lint, pr]:
tests: full suite pass, new code has tests
coverage: overall >= 80%, changed files >= 60%
lint: zero violations, no TODO/FIXME in diff
pr: rebased on main, diff < 400 lines
DECISION: ALL PASS → ship. ANY FAIL → block.
Never ask to continue. Loop autonomously until done.
KEEP if: all guard checks pass AND outcome valid
DISCARD if: guard fails OR post-merge tests fail
On discard: git revert HEAD for merges.
STOP when FIRST of:
- Branch finalized (MERGED, PR, KEPT, DISCARDED)
- Guard suite re-run 3 times with no improvement
- > 5 failed finalization attempts