Agent skill

using-git-worktrees

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback

guanyang940★ · 1 repos on radarProfile →
claude-codeMIT
Install
npx skills add guanyang/open-agent-hub --skill using-git-worktrees --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 7 KB
Bundled scripts: none
Path: skills/using-git-worktrees/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 948
Language: TypeScript

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Using Git Worktrees ## Overview Ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available. **Core principle:** Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness. **Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace." ## Step 0: Detect Existing Isolation **Before creating anything, check if you are already in an isolated workspace.** ```bash GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P) GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P) BRANCH=$(git branch --show-current) ``` **Submodule guard:** `GIT_DIR != GIT_COMMON` is also true inside git submodules. Before concluding "already in a worktree," verify you are not in a submodule: ```bash # If this returns a path, you're in a submodule, not a worktree — treat as normal repo git rev-parse --show-superproject-working-tree 2>/dev/null ``` **If `GIT_DIR != GIT_COMMON` (and not a submodule):** You are already in a linked worktree. Skip to Step 2 (Project Setup). Do NOT create another worktree.

What's inside
Steps it walks through
  1. Overview
  2. Step 0: Detect Existing Isolation
  3. Step 1: Create Isolated Workspace
  4. 1a. Native Worktree Tools (preferred)
  5. 1b. Git Worktree Fallback
  6. Step 2: Project Setup
  7. Step 3: Verify Clean Baseline
  8. Report
  9. Quick Reference
  10. Common Rationalizations
Commands it runs
If this returns a path, you're in a submodule, not a worktree — treat as normal repo
git rev-parse --show-superproject-working-tree 2>/dev/null
ls -d .worktrees 2>/dev/null     # Preferred (hidden)
ls -d worktrees 2>/dev/null      # Alternative
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
Determine path based on chosen location
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"
Node.js
if [ -f package.json ]; then npm install; fi
More from open-agent-hub
All skills →
About this skill
What does the using-git-worktrees skill do?

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback

How do I install it?

Run `npx skills add guanyang/open-agent-hub --skill using-git-worktrees --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From guanyang/open-agent-hub, a repository with 948 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going