/whetstone:ia-git-worktreefrom whetstone
Manages Git worktrees for isolated parallel development. Handles creation, listing, switching, and cleanup with environment copying and dependency installation.
Ships in whetstone. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
GATE: If the task runs inside an existing worktree (a worktree path is given and no create/remove/switch is requested), none of the creation flow applies: work in place and skip this skill. To check: git rev-parse --show-toplevel appears as a linked entry in git worktree list.
Never call git worktree add directly; always use the worktree-manager.sh script.
The manager handles setup:
.env, .env.local, .env.test, etc. from the main checkout, only when the base is the default branch or a local branch that already contains the fetched commit (a branch that exists only on origin gets none); it never overwrites or follows an existing file or symlink in the new treepackage.json → npm install, composer.json → composer install, pyproject.toml → pip install -e ., go.mod → go mod downloadFor untrusted bases such as PR heads, fork or origin-only branches, or third-party code, create with --no-env, which suppresses checkout hooks and environment copying for the creation command. Keep credentials out of its commands and never copy-env into the tree. Skip installs where possible. If an install is necessary, disable lifecycle scripts and plugins (npm ci --ignore-scripts, composer install --no-scripts --no-plugins). Do not run pip install -e ., which runs the build backend.
All commands use: bash ${CLAUDE_PLUGIN_ROOT}/skills/ia-git-worktree/scripts/worktree-manager.sh <command>. If CLAUDE_PLUGIN_ROOT is unset (non-Claude-Code harness), resolve the script relative to this skill's own directory.
Before creating worktrees, export a unique WORKTREE_SESSION_ID and retain that same value for this session's later manager calls. Example: export WORKTREE_SESSION_ID="$(python3 -I -c 'import uuid; print(uuid.uuid4())')". The manager records ownership in each new worktree's Git metadata. Creation without a session ID works, but manager cleanup then refuses that tree; never adopt a previous session's ID to bypass ownership.
The manager script fetches <base> from origin into an invocation-private ref, resolves that commit, and creates the branch from its SHA, even when origin/<base> is absent or stale or another checkout fetches concurrently. It removes only its private ref and never checks out <base> in the caller's working tree. If the fetch fails (offline, no remote), it resolves the local <base> instead. PR review: pass the fetched PR head as <base>, then verify its SHA (workflow-examples.md). Details: troubleshooting.md.
| Command | Description | Example |
|---|---|---|
create [--no-env] <branch> [from] | Create worktree + branch (default: from main) | ...worktree-manager.sh create feature-login |
list / ls | List all worktrees with status | ...worktree-manager.sh list |
switch <name> / go | Print the registered worktree's absolute path; the caller applies it as workdir | target=$(...worktree-manager.sh switch feature-login) |
copy-env <name> | Copy .env files to existing worktree | ...worktree-manager.sh copy-env feature-login |
cleanup <name> [...] / clean | Confirm removal of named, session-owned, clean worktrees | ...worktree-manager.sh cleanup feature-login |
Run commands with env -C "$target" <command> or the harness workdir argument. A child script cannot change the caller's working directory. Listing and name resolution work from any main or linked checkout, including subdirectories.
Cleanup refuses the current checkout, another session's tree, and tracked, untracked, or ignored files. Auto-copied .env files and installed dependencies therefore require explicit user-managed disposition before cleanup. Confirm no process uses the named trees; the manager cannot detect every external reader. Git's normal removal safeguards remain enabled, including locked-tree refusal. Do not force deletion or suppress failures to finish cleanup.
The manager verifies effective exclusion of the worktree path before creation. If a project rule prevents the local exclude from taking effect, stop and report the conflict. See hooks-and-excludes.md.
Before any baseline suite or migration, apply ia-verification-before-completion's effective-target preflight. Resolve worktree environment/configuration overlays; verify disposable database and service targets, never the dev database. Copied .env files do not prove isolation. Without verified disposable targets, stop before tests. Then run the suite or its fastest relevant subset to establish a clean baseline before implementation.
git worktree list entry not created in the current session as read-only; a tree left from a previous round is not the current session's either. Reuse is most tempting exactly where it is most dangerous: an existing tree already has dependencies and env wired up, and another session may be running a suite in it.git status --short empty) has returned.git status --short) rather than trusting git checkout --.git commit -- <paths> records complete working-tree files, including caller or peer hunks. Use a pathspec commit only after establishing whole-file ownership of every selected change. For mixed hunks, commit the attributable patch in a clean session-owned checkout while preserving the caller's HEAD, index, and files. Inspect the exact proposed and committed patches, not only filenames or --stat; follow commit-ownership.md.HEAD: in a git -C push. Resolve the SHA in the edited worktree, push it explicitly, and confirm with git ls-remote; a lease cannot catch selection of another checkout's HEAD. Details: commit-ownership.md.git stash for red/green: linked worktrees share one stash stack. Use the patch-file cycle and stash recovery in commit-ownership.md.rev-parse <branch>), not a worktree's HEAD, which other sessions can move; see commit-ownership.md.Use env -C <worktree> <cmd> for every command, never cd. A shell's cwd persists across calls, so one cd <repo-root> for an unrelated reason silently relocates every later command: probe files get written into the shared main tree and run against its bytes, and the tidy-up reflex git checkout -- <path> becomes a write aimed at the wrong tree. The git -C habit does not generalize: interpreters, test runners, linters, and a heredoc cat > all take the cwd. Have any probe print the tree it ran in.
git worktree list shows the new entry.worktrees is ignored, or inside the bare common directoryRead the relevant reference before implementing or reviewing the matching behavior:
Existing specialized references, when the corresponding topic applies:
SPEC.md (opens in a new tab)references/commit-ownership.md (opens in a new tab)references/hooks-and-excludes.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)references/workflow-examples.md (opens in a new tab)references/worktree-integration.md (opens in a new tab)scripts/worktree-manager.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub iliaal/whetstone --plugin whetstone29 skills in this plugin
/ia-agent-native-architectureDesign agent-native applications where agents replace UI users as the primary actor. Use when designing MCP tools, agent-loop architectures, system prompt design, hooks policy, shared-workspace file patterns, or self-modifying agent systems./ia-brainstormingPre-implementation exploration: deep interview, approach comparison, design doc. Use when exploring a vague feature idea, clarifying ambiguous requirements, or comparing approaches before coding. For the full workflow, use the ia-brainstorm command (Claude Code)./ia-code-reviewStructured code reviews with severity-ranked findings and deep multi-agent mode. Use when performing a code review, auditing code quality, or critiquing PRs, MRs, or diffs, including a diff or patch pasted inline, even when the review looks quick from reading it. For the full multi-agent workflow, use the ia-review command (/ia-review in Claude Code)./ia-cpp-systemsModern C++ patterns: RAII and ownership, rule of zero/five, exceptions and error handling, API and ABI boundaries, templates, and CMake tooling. Use when writing, reviewing, refactoring, or debugging C++, working with smart pointers, move semantics, memory leaks, template errors, or gtest. For plain C, see ia-c-systems./ia-c-systemsC patterns for systems code, libraries, and native extensions: module layout, function decomposition, status-enum errors, memory safety, undefined behavior, and performance measurement. Use when writing, reviewing, refactoring, or debugging C, working with malloc lifetimes, buffer overflows, sanitizers, or Valgrind, or building native extensions. For C++, see ia-cpp-systems./ia-debuggingSystematic root-cause debugging with verification. Use for errors, stack traces, broken tests, flaky tests, regressions, or anything not working as expected, including a pasted stack trace or failing test whose cause looks obvious from reading it. For validating bug reports before fixing, use bug-reproduction-validator agent.Other plugins' skills for the same job