本文へ移動
cccskills
無料GitHub で公開

pb-worktrees-land

Clean up git worktrees across your repos: list every worktree, classify it as merged, remote-only, local-only or dirty, recap what each holds, and remove only the merged clean ones after GO. Use for "clean up worktrees", "what is in my aos-wt folders", "land my worktrees", "prune worktrees".

インストール方法を見る

含まれるファイル(1)

  • SKILL.md4.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Land and clean up worktrees

What you get: an inventory of your worktrees with a class for each, and the merged clean ones removed after your GO.

Inputs

  • repos (optional) — repo paths to scan; default is the current repo's main worktree (git rev-parse --path-format=absolute --git-common-dir, parent dir)
  • <owner/repo> for each repo comes from git -C <repo> remote get-url origin

Steps

  1. Ask — repos (default as above) → run log in the start directory — repo list confirmed; stops for approval
  2. using-git-worktrees — per repo: git -C <repo> worktree list --porcelain → inventory table (path, branch, HEAD) in the run log — the main worktree, the worktree running this playbook, and any entry marked locked or prunable are keep
  3. github — gh auth status (fails → log it, skip the squash predicate, only ancestry merges count); git -C <repo> fetch origin --prune; default branch: default=$(git -C <repo> symbolic-ref --short refs/remotes/origin/HEAD); default=${default#origin/} (the command prints origin/main) → both in the run log — fetch fails → log it, classify against the local refs, mark the table "stale"
  4. Classify, first match wins:
    • dirty: git -C <wt> status --porcelain --ignored shows anything other than !! entries; !! (ignored files, deleted by removal) are listed per row in the GO line
    • detached HEAD (no <branch>): always local-only, never removed
    • merged: git -C <repo> merge-base --is-ancestor <branch> origin/<default>, or (squash merge) gh pr list -R <owner/repo> --head <branch> --state merged --json number,headRefOid has a PR whose headRefOid equals the worktree HEAD (git -C <wt> rev-parse HEAD); a reused branch name with a different headRefOid does not count
    • remote-only: the upstream exists and git -C <wt> rev-list --count @{u}..HEAD is 0 (safe on the remote, unmerged)
    • local-only: everything else; commits exist only here
    • check: every row has exactly one class plus the output of its evidence command
  5. pr-recap — per non-merged worktree: recap file from pr-recap; if it cannot be built log git -C <wt> log --oneline origin/<default>..HEAD and git -C <wt> diff --stat origin/<default>...HEAD instead — one recap or fallback per row
  6. [GO] removal list = rows classified merged and not keep, shown in full with these exact commands per row: git -C <repo> worktree remove <path> (label the row merged (empty) when git -C <repo> rev-parse <branch> equals git -C <repo> rev-parse origin/<default>; never --force; git refuses dirty trees), then git -C <repo> branch -d <branch> (-d refuses squash-merged branches → log "branch kept, needs -D, human decides"; never -D). The run stops here until the human types GO. GO covers exactly that list, once. The hook does not cover these commands, so this GO is their only guard. Never remove dirty, remote-only, local-only or keep rows, and never use rm -r.
  7. Verify — git -C <repo> worktree list → removed paths are gone, kept rows unchanged
  8. Hand-off — remote-only and local-only rows → next action per row in the run log ("land via /pb-ship", or "push needs GO in that worktree") — nothing runs

Run log: production_artifacts/pb-worktrees-land-<date>.md in the start directory, never committed

Rules

  • Anything other than the literal GO (case-insensitive) is not a GO; a GO covers only that one step, one time.
  • GO is by contract in every harness. The go-gate hook is only a backstop on Claude Code, OpenCode and agy (Codex: unverified; Cursor, Kimi: none). A missing hook is never permission to proceed.
  • A failed check stops the run: write the failure into the run log and report. No silent retries.
  • Write one run-log line per step as it completes (N. done|skipped|failed — artifact — check result) and WAITING FOR GO: <step> at each gate.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use when manage multiple local CLI agents via tmux sessions (start/stop/monitor/assign) with cron-friendly scheduling.

日本語の概要は準備中です。原文の説明を表示しています。

hybridlabor-api/aos62026年10月12日 更新

Use when a hybrid memory system that provides persistent, searchable knowledge management for AI agents (Architecture, Patterns, Decisions).

日本語の概要は準備中です。原文の説明を表示しています。

hybridlabor-api/aos62026年10月12日 更新

Reference for how BDB structures autonomous software engineering work — the seven-node dispatcher graph (Architect, TechLead, UI/UX, Engineering, Media/EventTech, Reviewer, Shipping) that /startcycle-graph actually runs. Use when you need the high-level lifecycle framing without inventing your own process.

日本語の概要は準備中です。原文の説明を表示しています。

hybridlabor-api/aos62026年10月12日 更新

Tools are how AI agents interact with the world. A well-designed tool is the difference between an agent that works and one that hallucinates, fails silently, or costs 10x more tokens than necessary. This skill covers tool design from schema to error handling.

日本語の概要は準備中です。原文の説明を表示しています。

hybridlabor-api/aos62026年10月12日 更新

Harness patterns for coding agents — memory, permissions, context engineering, delegation, skills, hooks, bootstrap.

日本語の概要は準備中です。原文の説明を表示しています。

hybridlabor-api/aos62026年10月12日 更新

agenttrail: live map of a multi-agent build in the browser: which plan component is being worked on, by which agent or harness, what is done and what is stuck. Use when a multi-agent pipeline starts (/startcycle, /startcycle-graph, /teamwork-preview) or after a plan-canvas approve, when the user asks to see what the agents are doing ("live map", "build board", "who is running now"), or by yourself whenever a multi-agent run is under way — no user prompt needed.

日本語の概要は準備中です。原文の説明を表示しています。

hybridlabor-api/aos62026年10月12日 更新

hybridlabor-api のスキルをすべて見る

このスキルの問題を報告する