ワンクリックで
close-session
Use when the user asks to close, end, clean up, tear down, or finish a worktree/session after work is landed.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when the user asks to close, end, clean up, tear down, or finish a worktree/session after work is landed.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | close-session |
| description | Use when the user asks to close, end, clean up, tear down, or finish a worktree/session after work is landed. |
| user-invocable | true |
Close the current worktree after confirming its work is merged. This skill is a narrow git cleanup only; it does not write summaries or clean runtime state.
You must be inside a worktree, not the target repo/worktree. If you're already in the target repo, tell the user there's nothing to close.
Set TARGET_BRANCH to the branch being landed into, then run this to collect
the worktree and merge-safety details:
WORKTREE_PATH=$(git rev-parse --show-toplevel) && \
BRANCH=$(git rev-parse --abbrev-ref HEAD) && \
git worktree list && \
TARGET_BRANCH="<target branch>" && \
TARGET_REPO=$(git worktree list | awk -v target="[$TARGET_BRANCH]" 'index($0, target) {print $1; exit}') && \
test -n "$TARGET_REPO" && \
UNCOMMITTED=$(git status --porcelain) && \
echo "WORKTREE_PATH=$WORKTREE_PATH" && \
echo "BRANCH=$BRANCH" && \
echo "TARGET_BRANCH=$TARGET_BRANCH" && \
echo "TARGET_REPO=$TARGET_REPO" && \
echo "UNCOMMITTED=$UNCOMMITTED" && \
if [ "$WORKTREE_PATH" = "$TARGET_REPO" ]; then echo "ERROR: You are in the target repo, not a worktree."; exit 1; fi && \
if [ -n "$UNCOMMITTED" ]; then echo "WARNING: Uncommitted changes exist"; fi && \
git log "$TARGET_BRANCH"..$BRANCH --oneline 2>/dev/null && \
echo "---FILES---" && \
git diff --name-only "$TARGET_BRANCH"..$BRANCH 2>/dev/null
If the target branch is unclear, ask the user. If you're in the target repo, stop. If there are uncommitted changes, ask the user what to do.
git -C "$TARGET_REPO" merge-base --is-ancestor "$BRANCH" "$TARGET_BRANCH"
If this fails (exit code non-zero), run the /merge skill first. Wait for it to complete.
Report what will happen: branch name and worktree path.
Then run the teardown as one bash command:
TARGET_REPO="<absolute path>" && \
WORKTREE_PATH="<absolute path>" && \
BRANCH="<branch name>" && \
cd "$TARGET_REPO" && \
git worktree remove "$WORKTREE_PATH" --force && \
git branch -d "$BRANCH" && \
echo "SESSION_CLOSED"
Substitute the actual values collected in step 1. Use -d (not -D) so git refuses if unmerged.
CRITICAL: This is the absolute last action. After running this command:
shell-init: error retrieving current directory are expected and harmless.new-session; close-session must not create, edit, or remove port metadata.-D (force delete). Always -d so git validates the merge.Use when executing a preflight checklist. Triggers: 'fly', 'launch execution', 'run the checklist', or when given a preflight checklist file path.
Use when the user says '/learn', 'learn this', 'document this', 'capture this', 'remember this for next time', 'update the docs', asks to capture a durable project learning, or after fixes/reviews reveal reusable patterns.
Use when the user asks to merge, land, rebase before landing, resolve landing conflicts, or advance an integration branch such as main, master, or m3.
Use when starting an interactive parent task session, when the user gives feedback about agent behavior, or when the user asks about observations, skill improvements, or observation logs. Skip delegated/non-interactive subagents, review-only workers, verify-only workers, Codex/Claude print-mode reviewers, and sessions that only report back to a parent agent.
Use when the user says 'deep review', 'thorough review', 'full review', 'triple review', or 'ultra review'.
Use when the user says 'new session', 'start a session', 'new worktree', 'start fresh', or 'spin up a workspace'.