plugins/dev-tools/skills-codex/using-git-worktrees/SKILL.md
Creates isolated git worktrees for parallel development. Use when starting feature work needing isolation or working on multiple branches simultaneously. Not for simple branch switching or basic git operations.
npx skillsauth add alexei-led/claude-code-config using-git-worktreesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Main repo stays on main/master — never edit directly. Every branch gets its own worktree (a sibling folder). Delete the worktree after the branch merges.
Think of a worktree as a disposable branch folder, not a long-lived parallel environment.
Exception: Trivial one-liner commits on a solo project can go directly on main to avoid ceremony overhead.
Check repo state before creating a worktree. Any worktree workflow description must name this dirty-state check before git worktree add:
git status --short
git branch --show-current
git worktree list
If the current worktree is dirty, ask whether to commit, stash, or create the new worktree anyway before proceeding. Confirm before running cleanup commands that remove worktrees or delete branches.
# 1. Create worktree for new work (from main repo)
git worktree add ../myproject-fix-cron -b fix-cron
# 2. Work there (open editor/Claude Code in that folder)
cd ../myproject-fix-cron
# 3. After PR is merged — confirm cleanup, then run from main repo
cd ../myproject
git worktree remove ../myproject-fix-cron
git branch -d fix-cron
git pull
Worktrees are sibling directories (not nested inside the repo):
~/projects/
├── myproject/ # main worktree — always on main, always clean
├── myproject-fix-cron/ # worktree for fix-cron branch
└── myproject-add-model/ # worktree for add-model branch
Why siblings: no .gitignore pollution, clean git status, independent build artifacts.
<project>-<branch-slug> — slashes become dashes, self-documenting.
| Branch | Worktree Directory |
| ------------------ | --------------------------- |
| fix-cron | ../myproject-fix-cron |
| feature/auth | ../myproject-feature-auth |
| bugfix/issue-123 | ../myproject-bugfix-123 |
tools
Idiomatic shell development for POSIX sh, Bash, Zsh, Fish, hooks, CI shell steps, and scriptable CLI glue. Use when writing or changing `.sh`, `.bash`, `.zsh`, `.fish`, `.bats`, shell functions, shell pipelines, or command-runner recipes. Emphasizes portability, quoting, safe filesystem/process handling, non-TUI CLI tools, ShellCheck, shfmt, Bats, and ShellSpec. NOT for Python, TypeScript, Go, web code, or infrastructure operations.
tools
Use when planning, executing, checkpointing, finishing, or inspecting lightweight spec-driven work. Runs one task at a time using `.spec/` markdown files and the bundled `specctl` helper. NOT for broad product discovery beyond a short requirement interview.
testing
Author, inspect, troubleshoot, and review infrastructure across IaC, Kubernetes, cloud resources, containers, CI/CD, and Linux hosts. Use when changing Terraform/OpenTofu, Kubernetes, Helm, Kustomize, Dockerfiles, GitHub Actions, AWS, GCP, Cloud Run, BigQuery, IAM, logs, instances, or service health. NOT for deploy/apply/rollback workflows (see deploying-infra). NOT for shell scripts or generic command pipelines (see writing-shell).
development
Configure safe git workflow hygiene: pre-commit/pre-push hooks, Gitleaks secret scanning, .gitignore rules, local git config, and guardrails. Use when setting up git hooks, gitleaks/git leaks, staged pre-commit checks, pre-push validation, core.hooksPath, .gitignore, or git config best practices. NOT for creating commits (use committing-code), cleaning branches/worktrees (use cleanup-git), or creating worktrees (use using-git-worktrees).