kata-git-worktree

Create, use, and remove Git worktrees for GitHub issues with PR lifecycle.

Updated Sep 3, 2025
One-click install
npx skills add https://github.com/guardiatechnology/design-system --skill kata-git-worktree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kata-git-worktree
Source: https://github.com/guardiatechnology/design-system/tree/main/.claude/skills/kata-git-worktree
Command: npx skills add https://github.com/guardiatechnology/design-system --skill kata-git-worktree

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents branch-based work from contaminating your main working tree by isolating each issue’s changes inside its own Git worktree and ensuring consistent creation, usage, PR opening, and cleanup.

Core Features & Use Cases

  • Issue-first branch scoping: Forces you to use an existing GitHub issue number in the branch and directory naming scheme (e.g., feat/42-scheduled-payments-api and .worktrees/42-scheduled-payments-api).
  • Safe worktree lifecycle: Verifies whether the branch or directory already exists before creating a new worktree, then enters the worktree to implement and commit changes.
  • End-to-end PR workflow: Pushes the branch, opens a PR that closes the issue, and removes both the worktree and local branch after merge.
  • Use Case: When implementing a feature for a specific ticket (like “Add scheduled payments API”), create an isolated worktree, implement the changes there, and then open a PR without risking other local work.

Quick Start

Ask the AI to create and manage a worktree for issue #42 using type feat and slug scheduled-payments-api, then open the PR and clean up after it’s merged.

Frequently Asked Questions about kata-git-worktree

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

FAQPage Schema
How do I isolate branch-based development using Git worktrees?

To isolate branch-based development with Git worktrees, you can create a dedicated workspace tied to an issue number, ensuring changes remain separate from your main working tree. This prevents local work from contaminating other branches during feature implementation.

What is the best way to manage an issue-based Git worktree lifecycle?

Managing an issue-based Git worktree lifecycle requires verifying existing branches or directories, creating the worktree with deterministic naming, and executing post-merge cleanup. This ensures safe creation, usage, PR opening, and removal without reusing other issues' worktrees.

How do I create a Git worktree for a specific GitHub issue?

To create a Git worktree for a specific GitHub issue, use a deterministic naming scheme like .worktrees/{issue-number}-{slug}/. The workflow validates existing directories via git worktree list before entering the workspace to implement and commit changes.

Does Git worktree branch workflow integrate with GitHub pull requests?

Yes, Git worktree branch workflow integrates with GitHub pull requests by pushing the branch to origin and opening a PR using gh that closes the linked issue. After the PR is merged, both the worktree and local branch are automatically removed.

When should I not use isolated Git worktrees for branch workflow?

You should not use isolated Git worktrees when you need to reuse workspaces across multiple issues, as this workflow strictly removes both the worktree and local branch after PR merge. It also requires an existing GitHub issue number for deterministic directory and branch naming.