SkillsHooksPromptsAgentsPersonasModelsPoliciesToolsTemplatesBundlesCategoriesStart here
← Skills
Sk skillcodingstable

Use Git Worktrees

Ensure an isolated workspace exists for feature work via git worktrees. Creates a worktree at the canonical location before any implementation. Single-repo work: <repo>/.worktrees/<name>/. Cross-repo or persistent: ~/.ai/worktrees/<name>/. Use at the start of any non-trivial feature or before executing implementation plans.

id skill/using-git-worktreesv1.0.0by convergent-systems-key
codegitworktreeisolation

Contract

DirectionNameTypeDescription
inbranch_namestringThe feature branch name (kebab-case).
inbase_branchoptionalstringThe base branch to branch from. Defaults to main.
inglobaloptionalbooleanWhen true, place at ~/.ai/worktrees/ (cross-repo/persistent). Defaults to false.
outworktree_pathstringAbsolute path to the created worktree.
  • creates git worktree
  • creates feature branch

System prompt fragment

Before starting feature work: (1) Determine the lifecycle — single-repo ephemeral → /.worktrees//; cross-repo or persistent → ~/.ai/worktrees//. (2) Create the worktree: git worktree add -b main. (3) All file writes go in the worktree — never touch the main worktree. (4) On completion: git worktree remove (use remove, not rm -rf). If a worktree already exists for this branch, use it. Never create worktrees at ad-hoc locations (../branch/, /tmp/, sibling dirs).

Author convergent-systems-key. Catalog data license CC-BY-4.0.