본문으로 건너뛰기
cccskills
무료GitHub에 공개

skill-finish-branch

Finish a development branch by running tests and reviewing changes, then choose whether to create a pull request, merge locally, keep the branch, or discard it. Optional version and changelog updates support release preparation.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Wrap up a branch — run tests, create PR, merge or discard — use when implementation is done

연동 도구GitHub
설치 방법 보기

이럴 때 유용합니다

  • Create a pull request after implementation is complete
  • Merge a tested branch into the base branch locally
  • Update the version and changelog before shipping
  • Keep or discard a completed development branch

포함된 파일(2)

  • SKILL.md9.7 KB
  • agents/openai.yaml172 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Host: Codex CLI — This skill was designed for Claude Code and adapted for Codex. Cross-reference commands use installed skill names in Codex rather than /octo:* slash commands. Use the active Codex shell and subagent tools. Do not claim a provider, model, or host subagent is available until the current session exposes it. For host tool equivalents, see skills/blocks/codex-host-adapter.md.

Execution Contract (MANDATORY - CANNOT SKIP)

This generated Codex skill preserves an enforced workflow contract from the source skill.

PROHIBITED:

  • Do not summarize, simulate, or skip the referenced workflow command when this skill requires execution.
  • Do not claim provider output or validation artifacts exist without checking the actual files or command output.
  • Do not continue silently when a required provider, command, or host capability is unavailable; report the unavailable dependency and use a supported fallback.

Finishing a Development Branch

Your first output line MUST be: 🐙 **CLAUDE OCTOPUS ACTIVATED** - Branch Completion

Overview

Full ship pipeline: tests → multi-provider review → version bump → changelog → commit → push → PR.

Core principle: Verify tests → Review diff → Bump version → Update changelog → Present options → Execute choice → Clean up.

The Process

Step 1: Verify Tests Pass

Before anything else, verify tests pass:

# Detect and run project's test suite
if [[ -f "package.json" ]]; then npm test
elif [[ -f "pytest.ini" ]] || [[ -f "pyproject.toml" ]]; then pytest
elif [[ -f "Cargo.toml" ]]; then cargo test
elif [[ -f "go.mod" ]]; then go test ./...
elif [[ -f "Makefile" ]] && grep -q '^test:' Makefile; then make test
fi

If tests fail: STOP. Show failures. Do not proceed.

If tests pass: Continue to Step 2.

Step 2: Multi-Provider Diff Review

Run a quick multi-provider review of the changes before shipping. This catches issues before they reach PR reviewers.

# Get the diff summary
DIFF_STAT=$(git diff --stat $(git merge-base HEAD main)..HEAD)
DIFF_FILES=$(git diff --name-only $(git merge-base HEAD main)..HEAD)

Always run a quick review — this is automatic, not optional:

# Quick review via orchestrate.sh (uses available providers)
${HOME}/.claude-octopus/plugin/scripts/orchestrate.sh spawn reviewer "Review this diff for bugs, security issues, and code quality problems. Be concise — only flag real issues, not style preferences.

$(git diff $(git merge-base HEAD main)..HEAD | head -500)"

If critical issues found: Present them and ask whether to fix or ship anyway. If clean: Continue to Step 3. Show a brief ✓ Review clean — no issues found.

Step 3: Determine Base Branch & Version

# Identify the base branch
BASE_BRANCH=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
[[ -z "$BASE_BRANCH" ]] && BASE_BRANCH="main"

# Check for VERSION file
VERSION_FILE=""
for f in VERSION version.txt package.json; do
  [[ -f "$f" ]] && VERSION_FILE="$f" && break
done

Step 4: Version Bump & Changelog (Optional)

If a VERSION file or package.json exists, offer to bump:

AskUserQuestion({
  questions: [{
    question: "Version bump?",
    header: "Version",
    multiSelect: false,
    options: [
      {label: "Patch (Recommended)", description: "Bug fixes, minor changes (1.2.3 → 1.2.4)"},
      {label: "Minor", description: "New features, backward compatible (1.2.3 → 1.3.0)"},
      {label: "Major", description: "Breaking changes (1.2.3 → 2.0.0)"},
      {label: "Skip", description: "Don't bump version"}
    ]
  }]
})

If bumping: Update the version file and prepend a changelog entry summarizing the diff:

# Generate changelog entry from commits
COMMITS=$(git log --oneline $(git merge-base HEAD $BASE_BRANCH)..HEAD)
# Prepend to CHANGELOG.md if it exists

Step 5: Present Options

Present exactly these 4 options:

✅ Ship ready. Tests passing. Review clean. What would you like to do?

1. **Create PR** (Recommended) - Push and create a Pull Request for review
2. **Merge locally** - Merge back to <base-branch> on this machine
3. **Keep as-is** - Leave the branch, I'll handle it later
4. **Discard** - Delete this work permanently

Which option? (1-4)

Keep options concise. Don't add explanations unless asked.

Step 4: Execute Choice

Option 1: Merge Locally

# Get current branch name
FEATURE_BRANCH=$(git branch --show-current)
BASE_BRANCH="main"  # or detected base

# Switch to base branch
git checkout $BASE_BRANCH

# Pull latest
git pull origin $BASE_BRANCH

# Merge feature branch
git merge $FEATURE_BRANCH

# Verify tests on merged result
npm test  # or appropriate test command

# If tests pass, delete feature branch
git branch -d $FEATURE_BRANCH

Report:

✅ Merged $FEATURE_BRANCH into $BASE_BRANCH
✅ Tests pass on merged result
✅ Feature branch deleted

Ready to push when you want: git push origin $BASE_BRANCH

Option 2: Create PR

# Get branch info
FEATURE_BRANCH=$(git branch --show-current)

# Push branch
git push -u origin $FEATURE_BRANCH

# Create PR with a validated description file
REPO_SLUG=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
PR_TITLE=${PR_TITLE:?Complete PR_TITLE before creating the pull request}
CHANGE_SUMMARY=${CHANGE_SUMMARY:?Complete CHANGE_SUMMARY before creating the pull request}
CHANGE_REASON=${CHANGE_REASON:?Complete CHANGE_REASON before creating the pull request}
PR_BODY=$(cat <<EOF
## Summary
- ${CHANGE_SUMMARY}
- ${CHANGE_REASON}

## Test Plan
- [x] Unit tests pass
- [x] Manual verification done
- [ ] Code review needed
EOF
)
if ! "${CLAUDE_PLUGIN_ROOT:-${HOME}/.claude-octopus/plugin}/scripts/safe-gh-comment.sh" \
    --repo "$REPO_SLUG" pr-create "$PR_TITLE" "$FEATURE_BRANCH" - <<< "$PR_BODY"; then
  echo "GitHub write state is unknown; check for an existing pull request before retrying:" >&2
  gh pr list --repo "$REPO_SLUG" --head "$FEATURE_BRANCH" --state all --json number,state,url || true
  return 1 2>/dev/null || exit 1
fi

Report:

✅ Branch pushed to origin/$FEATURE_BRANCH
✅ PR created: https://github.com/owner/repo/pull/123

Branch preserved for review process.

Option 3: Keep As-Is

✅ Keeping branch $FEATURE_BRANCH as-is.

Current state:
- Branch: $FEATURE_BRANCH
- Commits ahead of $BASE_BRANCH: N
- Tests: Passing

When ready, you can:
- Merge: git checkout main && git merge $FEATURE_BRANCH
- PR: git push -u origin $FEATURE_BRANCH && gh pr create
- Discard: git branch -D $FEATURE_BRANCH

Do NOT clean up anything.

Option 4: Discard

Confirm first (REQUIRED):

⚠️ This will PERMANENTLY delete:
- Branch: $FEATURE_BRANCH
- All commits:
  - abc1234 feat: add user validation
  - def5678 fix: handle edge case
  - ghi9012 test: add integration tests

Type 'discard' to confirm, or anything else to cancel.

Wait for exact confirmation: discard

If confirmed:

# Switch to base branch first
git checkout $BASE_BRANCH

# Force delete the feature branch
git branch -D $FEATURE_BRANCH

# If remote exists, delete it too (with confirmation)
git push origin --delete $FEATURE_BRANCH 2>/dev/null || true

Report:

✅ Branch $FEATURE_BRANCH deleted locally
✅ Remote branch deleted (if existed)

Work has been permanently discarded.

Step 5: Cleanup (If Using Worktrees)

For Options 1, 2, 4: Check if in a worktree and clean up:

# Check if current directory is a worktree
if git worktree list | grep -q "$(pwd)"; then
  # Get worktree path
  WORKTREE_PATH=$(pwd)
  
  # Switch to main worktree
  cd $(git worktree list | head -1 | awk '{print $(1)}')
  
  # Remove the worktree
  git worktree remove "$WORKTREE_PATH"
  
  echo "✅ Worktree cleaned up"
fi

For Option 3: Keep worktree intact.

Quick Reference

OptionMergePushKeep BranchCleanup
1. Merge locally✓-Delete✓
2. Create PR-✓Keep-
3. Keep as-is--Keep-
4. Discard--Delete✓

Integration with Claude Octopus

After completing octopus workflows, use this skill:

# After tangle (develop) phase completes successfully
# After ink (deliver) phase validates the work

# User says: "I'm done, create a PR"
# → Invoke finishing-branch skill
# → Verify tests
# → Present options
# → Execute Option 2 (Create PR)

With Octopus Validation

# Run octopus validation before finishing
${HOME}/.claude-octopus/plugin/scripts/orchestrate.sh ink "Validate before merge"

# If validation passes, proceed with finishing-branch

Red Flags - Never Do

ActionWhy It's Dangerous
Merge without testingShips broken code
Skip confirmation for discardLoses work permanently
Force-push without askingDestroys history
Delete remote branch silentlyAffects collaborators
Proceed when tests failCorrupts main branch

Common Mistakes

MistakeFix
Offering options before testingAlways verify tests FIRST
Auto-merging without askingPresent 4 options, let user choose
Deleting without confirmationRequire typed "discard"
Cleaning up worktree on "keep"Only cleanup for options 1, 2, 4

The Bottom Line

Finishing branch → Tests verified AND user chose option
Otherwise → Not complete

Verify tests. Present options. Execute safely. Clean up appropriately.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Interpret the saved results of a completed AI council review. Count verdicts, check whether enough participants responded and whether models are independent, surface substantive dissent, and explain what action the outcome supports.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Explain a completed council review
  • Check vote counts and quorum
  • Assess model independence and dissent
nyldn/claude-octopus4.3천2026년 10월 22일 업데이트

Turn a technical choice into a structured debate between different AI model families. Assign explicit positions, launch the discussion, and summarize agreement, disagreement, and a recommendation supported by the strongest argument that survives the debate.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Compare Redis and Memcached for session storage
  • Debate monorepo versus polyrepo organization
  • Examine a technical choice from opposing positions
nyldn/claude-octopus4.3천2026년 10월 22일 업데이트

Clarify a feature’s requirements with multiple AI providers, combining technical constraints with user and business needs. Produce a scoped definition covering priorities, edge cases, exclusions, and a requirements checklist before implementation begins.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Defining requirements for a user authentication system
  • Setting boundaries for a notification feature
  • Identifying technical constraints and edge cases
nyldn/claude-octopus4.3천2026년 10월 22일 업데이트

Review code or documents with available AI providers before delivery. Combine findings into a scored validation report that checks prior requirements and decisions, separates critical issues from warnings, and recommends next steps.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Review authentication code before release
  • Check API readiness before deployment
  • Review a PRD for missing requirements
nyldn/claude-octopus4.3천2026년 10월 22일 업데이트

Develop complex features or business documents by gathering approaches from available AI providers. Combine their perspectives with prior project decisions and quality checks to produce a proposed plan, then proceed with implementation after user confirmation.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Planning and implementing a complex feature
  • Comparing approaches for an external service integration
  • Developing a product requirements document or strategy
nyldn/claude-octopus4.3천2026년 10월 22일 업데이트

Research technical or business questions through multiple available AI providers, each assigned a different perspective. Combine usable results into a report covering findings, disagreements, evidence gaps, priorities, and recommended next steps.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Compare libraries and technical approaches
  • Research markets and competitor strategies
  • Synthesize literature from multiple perspectives
nyldn/claude-octopus4.3천2026년 10월 22일 업데이트

nyldn의 스킬 모두 보기

이 스킬의 문제 신고