From bonsai
Safely remove a finished or abandoned git worktree while preserving unintegrated work.
How this skill is triggered — by the user, by Claude, or both
Slash command
/bonsai:pruneThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Tear down a worktree, safely. The gate is the point: a worktree that is clean
Tear down a worktree, safely. The gate is the point: a worktree that is clean but not yet integrated still holds work, so it is kept by default.
resolve_bonsai_root() {
if [ -n "${BONSAI_BIN:-}" ]; then dirname "$(dirname "$BONSAI_BIN")"; return 0; fi
if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then printf '%s\n' "$CLAUDE_PLUGIN_ROOT"; return 0; fi
if command -v codex >/dev/null 2>&1; then
codex plugin list | awk '$1 == "bonsai@laicluse-agent-fieldkit" { print $NF; found=1; exit } END { exit found ? 0 : 1 }'
return $?
fi
return 1
}
ROOT="$(resolve_bonsai_root)" || { echo "bonsai plugin root not found" >&2; exit 1; }
BONSAI="${BONSAI_BIN:-$ROOT/bin/bonsai}"
node "$BONSAI" teardown <worktree|branch> --repo "<root>" --dry-run --json # classify only
node "$BONSAI" teardown <worktree|branch> --repo "<root>" --json # remove if safe
A worktree is removed only when it is integrated into the default branch, or
when it is clean with nothing ahead of the default. Otherwise teardown keeps it
and returns removed: false with a reason. --dry-run reports the same
classification and warnings without removing anything. --force overrides the
gate and also deletes an unmerged branch; reach for it only on a deliberate
throwaway, and never wire it into an unattended caller.
npx claudepluginhub epologee/laicluse-agent-fieldkit --plugin bonsaiGuides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Synthesizes the current conversation into a structured spec (PRD) and publishes it to the project issue tracker with a ready-for-agent label, without interviewing the user.