bonsai

Create and remove git worktrees with safety checks for uncommitted changes.

3|1|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/epologee/leclause-skills --skill bonsai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bonsai
Source: https://github.com/epologee/leclause-skills/tree/main/packages/bonsai/skills/bonsai
Command: npx skills add https://github.com/epologee/leclause-skills --skill bonsai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill removes the friction and risk of managing multiple git worktrees by automating creation, environment setup, and safe cleanup so developers do not lose uncommitted or unpushed work.

Core Features & Use Cases

  • Automates creating a new worktree, calculating a deterministic development port, copying local runtime files listed in a project .bonsai file, installing common dependencies, and opening a Claude session in a new iTerm2 pane.
  • Provides a context-aware prune workflow that classifies worktrees, performs safety checks for uncommitted changes and unpushed commits, detects PR integration, and prunes branches only when safe.
  • Use case examples: quickly spawn an isolated worktree for a GitHub issue with a prefilled Claude prompt and assigned port, or run a repository-wide prune to remove merged and clean worktrees while preserving local or active work.

Quick Start

Ask the agent to create a new worktree and start a Claude session by saying: /bonsai new my-branch add a short prompt describing the work so the session starts with context.

Frequently Asked Questions about bonsai

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely prune git worktrees without losing uncommitted changes?

Safely prune git worktrees by running a context-aware classification workflow that checks for uncommitted changes and unpushed commits, detects origin merges, and only removes clean branches to prevent accidental loss of local work.

How do I automate git worktree creation and assign a deterministic dev server port?

Automate git worktree creation to calculate a deterministic development port, copy local runtime files via a project .bonsai file, install dependencies, and open a Claude session in a new iTerm2 pane on macOS for an isolated environment.

Does the git worktree automation workflow work with iTerm2 and macOS?

Yes, the git worktree automation workflow is built for macOS and iTerm2, using osascript and the CLAUDE_CLI environment variable to launch new panes and start Claude sessions directly within your existing terminal setup.

What is the best way to manage multiple git worktrees for isolated GitHub issue branches?

The best way to manage multiple git worktrees is using an automated lifecycle tool that spawns isolated branches, assigns deterministic ports, copies runtime files, and prefills Claude session prompts with GitHub issue context.

How do I copy local runtime files when creating a new git worktree?

Copy local runtime files when creating a new git worktree by defining a project .bonsai file. The automation reads this file and automatically duplicates the specified local files into the new worktree directory.