원클릭으로
worktree
Worktree lifecycle protocol — context switching, creating, and cleaning up git worktrees for starbunk-rs.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Worktree lifecycle protocol — context switching, creating, and cleaning up git worktrees for starbunk-rs.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Evaluate the CI/CD pipeline on the PR, check for failures, and fix any issues.
Analyzes the current branch/PR and adds comprehensive, well-formatted structured logging and spans for observability.
Review PR comments, categorize them into critical/nitpicks, fix user-selected ones, and close resolved comments.
Create a PR using the current branch. Generates a PR description, commits changes, and pushes.
Mandatory rules for general git use in this repository. Follow these constraints before starting work, committing, or pushing.
Feature developer and task runner. Start a new task on a fresh branch, orchestrate worktrees, do the implementation work, and open a PR when done.
| name | worktree |
| description | Worktree lifecycle protocol — context switching, creating, and cleaning up git worktrees for starbunk-rs. |
Every task lives in its own isolated git worktree under .claude/worktrees/. The main worktree
stays on main and is kept functionally empty — it is a launchpad, not a workspace.
git worktree list
Ask: does this task belong to the current worktree's branch?
ROOT="$(git rev-parse --show-toplevel)"
# 1. Sync main to origin — always start from a clean base
git -C "$ROOT" fetch origin main
git -C "$ROOT" reset --hard origin/main
# 2a. Worktree for the target branch already exists — go there
cd "$ROOT/.claude/worktrees/<branch-slug>"
# 2b. No worktree yet — create one from the freshly synced main
BRANCH=feat/my-feature
mkdir -p "$ROOT/.claude/worktrees"
git -C "$ROOT" branch $BRANCH main
git -C "$ROOT" worktree add "$ROOT/.claude/worktrees/${BRANCH//\//-}" $BRANCH
cd "$ROOT/.claude/worktrees/${BRANCH//\//-}"
Never carry work from one branch's worktree into another.
Use reset --hard rather than pull to eliminate local drift:
ROOT="$(git rev-parse --show-toplevel)"
git -C "$ROOT" fetch origin main
git -C "$ROOT" reset --hard origin/main
Run this every time you start a new task or switch contexts.
Run scripts/cleanup-worktrees.sh to remove worktrees whose working tree is completely clean
(no staged, unstaged, or untracked files). Always dry-run first:
bash scripts/cleanup-worktrees.sh # dry-run
bash scripts/cleanup-worktrees.sh --apply # remove clean worktrees
main, always synced to origin/main, never edited directly.reset --hard origin/main, not pull..claude/worktrees/ — gitignored, auto-cleaned when idle.