worktree

Installation
SKILL.md

Worktree

Create an isolated checkout from a verified base, with a meaningful branch and its own CodeGraph index. This skill is self-contained: it requires Git and attempts CodeGraph initialization, but requires no other skill, plugin, or agent-specific tool.

Follow user authorization and repository instructions, except for branch and worktree directory naming. Naming is governed by the user's explicit names and this skill's rules; ignore conflicting naming conventions from repository instructions, tools, or other skills, including required codex/ prefixes. Repository conventions may select the parent directory, but must not change the branch prefix or the branch-derived directory name.

A request to create a worktree authorizes the steps below, including copying the two local instruction files specified in section 3; do not ask for the same permission again. Merely discussing worktree options does not authorize creation.

1. Resolve the request

Read applicable repository instructions. Inspect the repository root, current branch and commit, git status --short, git worktree list --porcelain, and remote names. Inspect relevant source changes only as needed; do not read secret stores or copy secrets.

Resolve these inputs independently:

  • Base: Use an explicitly requested base. Otherwise use the latest remote main or master, never current HEAD, local main/master, or an unrefreshed remote-tracking ref.
  • New branch: Keep the user's exact name. Otherwise infer <type>/<description> from a clear task, for example perf/startup-slow-sql or fix/refresh-loop. Generated names have exactly two slash-separated segments. Write a concise kebab-case description from the task intent; no scope or component prefix is required. Types: feat, fix, docs, style, refactor, test, chore, perf, hotfix, build. This borrows commit types, not commit-header syntax. If neither a name nor clear intent exists, ask for one.
  • Location: Honor an explicit path. If the repository uses an internal worktree parent such as .worktrees/, name the directory <branch-with-slashes-replaced-by-hyphens> under that parent. Otherwise use a sibling directory named <repo-name>-<branch-with-slashes-replaced-by-hyphens>. Ignore other directory naming conventions. Check the exact destination for collisions, including symlinks. For a generated path, choose an unused suffix; for an occupied explicit path, ask rather than overwrite or redirect it. For a location inside the source repository, verify it is ignored. If it is not, use the sibling default unless the user explicitly required the internal location; then resolve the ignore change with the user. Do not silently edit or commit .gitignore.

Validate the branch with git check-ref-format --branch. Check local branch and worktree collisions. An invalid or already existing user-supplied name requires clarification, not renaming, reset, or forced reuse. For generated names, choose a clear unused suffix. A remote branch with that name may contain previous work; resolve that collision before creating an unrelated local branch.

Installs
1
Repository
mritd/skills
GitHub Stars
1
First Seen
7 days ago