본문으로 건너뛰기
Skillpedia
일반 코딩311k · #93

finishing-a-development-branch

하는 일

AI 에이전트가 완성된 개발 브랜치의 마무리 단계를 안내합니다. 테스트 확인부터 작업을 반영하는 것까지 다룹니다. 기능을 완성하고 깔끔하게 끝내려는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓기능이 완료되었고 그 작업을 메인 코드에 어떻게 넣을지 정해야 할 때.
  • ✓작업을 병합하거나 제출하기 전에 모든 테스트가 통과해야 할 때.
  • ✓작업을 반영한 뒤 임시 작업공간을 정리하고 싶을 때.

스킬 링크

https://github.com/obra/superpowers/blob/main/skills/finishing-a-development-branch/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/obra/superpowers/blob/main/skills/finishing-a-development-branch/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“기능이 완료되었습니다. 테스트를 실행하고, 병합할지 풀 리퀘스트를 열지 정하도록 도와주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 먼저 전체 테스트 모음을 실행하고, 실패하면 멈춥니다. 모두 통과하면 환경을 확인하고 선택지를 보여 준 뒤, 사용자가 고른 방법을 실행하고 정리합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Finishing a Development Branch

Overview

Core principle: Verify tests → Detect environment → Present options → Execute choice → Clean up.

Announce at start: "I'm using the finishing-a-development-branch skill to complete this work."

Step 1: Verify Tests

Run the project's full test suite (npm test / cargo test / pytest / go test ./...).

If tests fail, report the failures and stop — the menu comes after a green suite:

Tests failing (<N> failures). Must fix before completing:

[Show failures]

If tests pass: continue to Step 2.

Step 2: Detect Environment

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)
# Capture now, while still inside the workspace — Step 5 changes directory
# before cleanup (Step 6) needs this value
WORKTREE_PATH=$(git rev-parse --show-toplevel)

This determines which menu to show and how cleanup works:

State Menu Cleanup
GIT_DIR == GIT_COMMON (normal repo) Standard 3 options No worktree to clean up
GIT_DIR != GIT_COMMON, named branch Standard 3 options Provenance-based (see Step 6)
GIT_DIR != GIT_COMMON, detached HEAD Reduced 2 options (no merge) Externally managed — leave in place

Step 3: Determine Base Branch

The base branch is whatever this work forked from — usually named in the plan, the conversation, or the branch's upstream. If it is not already known, ask: "This branch split from <your best guess> - is that correct?" Confirm before merging: merging into the wrong base is expensive to undo.

Step 4: Present Options

Normal repo and named-branch worktree — present exactly these 3 options:

Implementation complete. What would you like to do?

1. Merge back to <base-branch> locally
2. Push and create a Pull Request
3. Keep the branch as-is (I'll handle it later)

Which option?

Detached HEAD — present exactly these 2 options:

Implementation complete. You're on a detached HEAD (externally managed workspace).

1. Push as new branch and create a Pull Request
2. Keep as-is (I'll handle it later)

Which option?

Present the menu exactly as written — concise, with every option coming from the list above. Discarding the work happens only in response to your human partner explicitly asking for it (see "If your human partner asks to discard the work" below). Wait for their answer; the integration decision is theirs.

Step 5: Execute Choice

Option 1: Merge Locally

# Get main repo root for CWD safety
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"

# Merge first — verify success before removing anything
git checkout <base-branch>
git pull
git merge <feature-branch>

# Verify tests on merged result
<test command>

If tests fail on the merged result: stop, leave the worktree and branch in place, and investigate — nothing has been pushed, so the merge is local and recoverable.

Once the merged result is green: clean up the worktree (Step 6), then delete the branch:

git branch -d <feature-branch>

Option 2: Push and Create PR

git push -u origin <feature-branch>
# From a detached HEAD, name the new branch on the remote:
# git push origin HEAD:refs/heads/<new-branch>

Then create the pull/merge request against <base-branch> with the forge's tooling — its CLI if one is available, or the creation URL most forges print when you push — following the repo's PR template and conventions if present, and report the URL to your human partner.

Keep the worktree — your human partner iterates on PR feedback there.

Option 3: Keep As-Is

Report: "Keeping branch <name>. Worktree preserved at <path>."

If your human partner asks to discard the work

This path exists only as a response to an explicit request to throw the work away. Confirm first:

This will permanently delete:
- Branch <name>
- All commits: <commit-list>
- Worktree at <path>

Type 'discard' to confirm.

Wait for that exact confirmation. When it arrives:

MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"

Then clean up the worktree (Step 6) and force-delete the branch:

git branch -D <feature-branch>

Step 6: Cleanup Workspace

Runs for Option 1 and confirmed discards. Options 2 and 3 always preserve the worktree. Bo

자주 묻는 질문

테스트가 실패하면 어떻게 되나요?

스킬은 실패를 보고하고 멈추므로, 테스트가 통과한 뒤에만 선택지가 나타납니다.

스스로 작업을 버리나요?

아닙니다. 반영 방식은 사용자가 고르며, 정리는 작업이 시작된 곳에 따라 진행하므로 스스로 만들지 않은 것은 지우지 않습니다.

분리된 브랜치도 다루나요?

예. 분리된 브랜치는 더 적은 선택지를 받고, 외부에서 관리되는 작업공간은 그대로 둡니다.

상세 정보

작성자의 원본 설명

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

repo: obra/superpowers

인기도

GitHub 스타
311k
순위
#93
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬