← ClaudeAtlas

close-story-worktreelisted

Safely clean up a repository story after its pull request has been reviewed and merged. Use when Codex must verify a merged PR, remove the exact clean Git worktree, and delete its merged local branch. Supports codex/ID, worktree-ID, claude/ID, and explicit custom branch or worktree names. Never use before the human merge gate.
astropham1808/astro-agent-skills · ★ 1 · Code & Development · score 59
Install: claude install-skill astropham1808/astro-agent-skills
# Close Story Worktree Clean up a merged story in a strict order. Keep this skill limited to GitHub merge verification and local Git cleanup. ## Required inputs Resolve these before changing state: - story ID; - repository root; - exact head branch; - exact worktree path; - PR URL or number; - base branch. Read applicable `AGENTS.md` files. Preserve unrelated worktrees and branches. Accept branch forms such as `codex/AL-151`, `worktree-AL-161`, or `claude/AL-216`; never rewrite one naming convention into another. ## Sequence 1. Inspect `git status --short --branch` and `git worktree list --porcelain`. 2. Use `gh pr view` or the GitHub connector to confirm the exact PR has `mergedAt` set and targets the expected base branch. 3. If the PR is open, draft, closed without merge, or ambiguous, stop. Return the PR URL and leave the worktree and branch unchanged. 4. Require the story worktree to be clean. Never reset, clean, stash, or force removal to make it appear clean. 5. Run `scripts/cleanup-merged-story.sh` without `--apply` to preview the exact targets and safety checks. 6. Run the same command with `--apply` only when the user has placed cleanup in scope. The script fetches the PR base, verifies the branch tip is an ancestor of the updated base, removes the exact worktree without force, then uses `git branch -d`. 7. Confirm the path no longer appears in `git worktree list --porcelain` and the local branch no longer exists. 8. Report the merge