Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

closeout

БесплатноБез исполняемых скриптовНе проверен

Safely close out completed Incan work after a PR is merged by verifying merge status, syncing the base branch, removing task-owned local worktrees/assets…

encero-systemsот encero-systems★ 75 звёзд на GitHub

Об этом скилле

Closeout — Incan Project

Purpose

/closeout cleans up local implementation state after a PR has merged. It is for removing task-owned worktrees, local branches, remote topic branches, stale refs, and temporary agent artifacts without touching unrelated user work.

This skill is intentionally conservative. A clean closeout is less important than not deleting active work.

Inputs

The user may provide:

  • A PR number or URL.
  • A branch name.
  • An issue/RFC number.
  • A worktree path.
  • A free-text instruction such as "close out the RFC 028 branch".

If no target is provided, infer it from the current branch, current worktree path, recent PR context, or task-owned temp directory names. If inference is ambiguous, ask the user which PR or branch to close out.

Hard rules

  • Merge first. Do not remove branches, remote refs, or worktrees until the PR is confirmed merged into its base branch.
  • Inventory first. List candidate branches, worktrees, untracked files, and agent artifacts before removing anything.
  • Preserve user work. Never delete a dirty worktree, ambiguous branch with unmerged commits, or untracked files that are not clearly task-owned or explicitly declared disposable by the user.
  • Use git-safe deletion. Prefer git worktree remove, git branch -d, and git push origin --delete <branch> over filesystem deletion.
  • No broad destructive cleanup. Do not use git reset --hard, rm -rf, or git clean -fd as a default cleanup tool.
  • No force unless explicit or GitHub-merged. git branch -D, forced worktree removal, and deleting ambiguous assets require direct user confirmation or an unambiguous closeout instruction that task-owned scratch worktrees should go. The exception is the exact PR head branch for a PR that GitHub reports as merged; if git branch -d refuses because the PR was squash-merged or rebase-merged, delete that exact local branch with git branch -D after its worktrees are removed.
  • Do not delete the active worktree. If the current directory is the worktree being removed, switch command context to the main repository or another safe parent first.
  • Respect unrelated dirt. Existing dirty files in the main repo or unrelated worktrees are blockers for those paths only; report them, do not "fix" them.
  • Ralph worker worktrees are scratch assets. After the orchestrator PR is merged, task-owned worker worktrees created for that implementation are disposable when the user asks to close out the task. Dirty status in those worker slices should trigger an inventory and confirmation path, not a permanent stop.

Workflow

Step 1: Orient

Collect the current repository state:

git rev-parse --show-toplevel
git status --short --branch
git branch --show-current
git remote -v
git worktree list --porcelain

If the task references a PR, fetch its metadata through the GitHub connector when available. If using gh, be prepared for invalid local auth and fall back to GitHub connector data or plain git merge checks.

Record:

  • repo root,
  • current branch,
  • target branch,
  • target PR,
  • base branch,
  • local worktree path(s),
  • remote tracking branch,
  • any dirty files.

Step 2: Verify the PR is merged

Use the strongest available source:

  1. GitHub PR metadata: PR state is merged, with base branch and head branch recorded.
  2. Git ancestry after fetching: the target branch tip is an ancestor of the base branch.
  3. Local merged-branch status: git branch --merged <base> shows the target branch.

Recommended git fallback:

git fetch origin <base-branch> <target-branch>
git merge-base --is-ancestor <target-branch> origin/<base-branch>

GitHub merged status is authoritative for PR closeout when the target branch exactly matches the PR head branch. If GitHub reports the PR as merged but merge-base --is-ancestor fails, treat the branch as squash-merged or rebase-merged: record that ancestry did not prove the merge, then continue cleanup for the exact PR head branch only.

If the PR is open, closed-unmerged, unknown, or there is no reliable merged PR metadata and the branch is not an ancestor of the base branch, stop after reporting status. Do not clean up.

Step 3: Sync the base branch

Once merged, update the base branch in the main worktree if it is clean:

git fetch origin --prune
git switch <base-branch>
git pull --ff-only

If the base worktree is dirty, skip the switch/pull and report the dirty files. Cleanup of separate task worktrees can still proceed if those task worktrees are clean and merge status is confirmed.

Step 4: Build the cleanup inventory

Identify only task-owned candidates:

  • worktrees whose path matches the task branch, issue, RFC, or known temp worktree path,
  • worker worktrees created for the same task by ralph-loop or orchestrate-parallel-work,
  • local branches matching the merged PR head branch,
  • local worker branches for the same task,
  • remote branch `origin/<target
Полный SKILL.md на GitHub

Установить closeout в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл closeout?

Safely close out completed Incan work after a PR is merged by verifying merge status, syncing the base branch, removing task-owned local worktrees/assets, deleting merged local/remote branches, pruning refs, and reporting dirty or ambiguous leftovers. Use when the user says /closeout, asks to clean up after a merged PR, or wants local RFC/issue branch/worktree cleanup.

Как установить скилл closeout?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл closeout запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить closeout с