Source profileQuality 87/100Review permissions

GanyuanRan/Aegis/skills/using-git-worktrees/SKILL.md

using-git-worktrees

Use when a coding task needs a concurrent checkout, unrelated dirty state blocks safe branch switching, or the user or repository explicitly requires a worktree.

Source repository stars
927
Declared platforms
0
Static risk flags
1
Last source update
2026-08-06
Source checked
2026-08-06

Decision brief

What it does—and where it fits

Use when a coding task needs a concurrent checkout, unrelated dirty state blocks safe branch switching, or the user or repository explicitly requires a worktree.

Best for

  • Use when a coding task needs a concurrent checkout, unrelated dirty state blocks safe branch switching, or the user or repository explicitly requires a worktree.

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/GanyuanRan/Aegis --skill "skills/using-git-worktrees"
Safe inspection promptEditorial

Inspect the Agent Skill "using-git-worktrees" from https://github.com/GanyuanRan/Aegis/blob/640f943653fdccd1ffd32cd6e3dda889209bb901/skills/using-git-worktrees/SKILL.md at commit 640f943653fdccd1ffd32cd6e3dda889209bb901. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Step 0: Environment Detection

    Before mutation, record the repository root, HEAD, branch/detached state, staged/unstaged/untracked paths, active Git operations, and:

    Before mutation, record the repository root, HEAD, branch/detached state, staged/unstaged/untracked paths, active Git operations, and:Stop on detached HEAD, unresolved conflicts, or an active merge/rebase/ cherry-pick/revert/bisect. Preserve user state: no automatic stash, reset, clean, broad staging, or commit.Before deciding necessity or placement, read the smallest relevant project AGENTS.md, CLAUDE.md, current authority, and existing worktree convention. Repository policy may require or forbid isolation and owns any approv…
  2. 02

    Step 1: Necessity Decision

    Create at most one task-owned worktree only when one of these is true:

    another branch must remain checked out while this task proceeds;unrelated dirty state prevents a safe checkout in the current workspace;explicit user or current repository authority requires it.
  3. 03

    Step 2: Safe Placement

    Use an existing repository convention only when the target directory is already ignored (git check-ignore). Never edit or commit .gitignore solely to host a worktree. If no safe in-repo convention exists, use a task-specific external user-level temporary directory outside the re…

    Use an existing repository convention only when the target directory is already ignored (git check-ignore). Never edit or commit .gitignore solely to host a worktree. If no safe in-repo convention exists, use a task-spe…
  4. 04

    Step 3: Create the Minimum Checkout

    Prefer reusing an existing branch carrying the same goal. Create a branch only when the approved Git lifecycle requires independent history.

    Prefer reusing an existing branch carrying the same goal. Create a branch only when the approved Git lifecycle requires independent history.
  5. 05

    Step 4: Authority-Led Setup and Baseline

    Read the project's install docs, lockfiles, and existing setup scripts. Run only setup the project explicitly requires. Do not infer npm install, cargo build, pip install, poetry install, or dependency downloads merely from manifest presence.

    Read the project's install docs, lockfiles, and existing setup scripts. Run only setup the project explicitly requires. Do not infer npm install, cargo build, pip install, poetry install, or dependency downloads merely…Run the smallest relevant baseline verification. If setup or tests fail, report the exact failure and preserve the worktree; do not hide it by mutating unrelated files.

Permission review

Static risk signals and limitations

Runs scripts

medium · line 22

The documentation asks the agent to run terminal commands or scripts.

git worktree list --porcelain

Runs scripts

medium · line 65

The documentation asks the agent to run terminal commands or scripts.

git worktree add <exact-path> <branch>

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score87/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars927SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
GanyuanRan/Aegis
Skill path
skills/using-git-worktrees/SKILL.md
Commit
640f943653fdccd1ffd32cd6e3dda889209bb901
License
MIT
Collected
2026-08-06
Default branch
main
View the original SKILL.md

Using Git Worktrees

Overview

A worktree is an exception for simultaneously checking out another Git history, not a general safety badge. Prefer the current workspace and reuse an existing suitable worktree. A branch decision and a worktree decision are separate.

Core principle: create only with necessity and ownership evidence; pair every created worktree with a cleanup path.

Announce at start: explain which concrete checkout conflict requires a worktree.

Step 0: Environment Detection

Before mutation, record the repository root, HEAD, branch/detached state, staged/unstaged/untracked paths, active Git operations, and:

git worktree list --porcelain

Stop on detached HEAD, unresolved conflicts, or an active merge/rebase/ cherry-pick/revert/bisect. Preserve user state: no automatic stash, reset, clean, broad staging, or commit.

Before deciding necessity or placement, read the smallest relevant project AGENTS.md, CLAUDE.md, current authority, and existing worktree convention. Repository policy may require or forbid isolation and owns any approved in-repo location; do not discover that policy after creating the checkout.

Step 1: Necessity Decision

Create at most one task-owned worktree only when one of these is true:

  • another branch must remain checked out while this task proceeds;
  • unrelated dirty state prevents a safe checkout in the current workspace;
  • explicit user or current repository authority requires it.

Task complexity, planning, TDD, use of subagents, or a main/master branch name is not sufficient. Same-task subagents share one workspace; do not create per-subagent or nested worktrees. If independent history is unnecessary, do not create a branch either.

Record: reason, branch, exact path, creating coordinator, and expected cleanup event. If the owner or cleanup condition is unknown, stop before creation.

Step 2: Safe Placement

Use an existing repository convention only when the target directory is already ignored (git check-ignore). Never edit or commit .gitignore solely to host a worktree. If no safe in-repo convention exists, use a task-specific external user-level temporary directory outside the repository. Resolve and verify the exact path before creation; do not target a broad home, workspace, or repo root.

Step 3: Create the Minimum Checkout

Prefer reusing an existing branch carrying the same goal. Create a branch only when the approved Git lifecycle requires independent history.

# Existing branch
git worktree add <exact-path> <branch>

# New independently justified branch
git worktree add -b <branch> <exact-path> <start-point>

Read back git worktree list --porcelain, the new worktree's HEAD/branch, and its status. Do not use force flags.

Step 4: Authority-Led Setup and Baseline

Read the project's install docs, lockfiles, and existing setup scripts. Run only setup the project explicitly requires. Do not infer npm install, cargo build, pip install, poetry install, or dependency downloads merely from manifest presence.

Run the smallest relevant baseline verification. If setup or tests fail, report the exact failure and preserve the worktree; do not hide it by mutating unrelated files.

Step 5: Handoff and Cleanup Ownership

Report the exact path, branch, start HEAD, baseline result, owner, and cleanup trigger. The creating coordinator remains responsible until it proves cleanup or explicitly hands ownership off.

Use finishing-a-development-branch after the task commit or integration decision. A worktree may usually be removed while its unmerged branch remains; an open PR does not require a permanent checkout.

Red Flags

Never:

  • create a worktree only because a task modifies code;
  • modify .gitignore merely to make worktree creation possible;
  • install dependencies blindly;
  • create one worktree per subagent;
  • run global prune or force cleanup as routine hygiene;
  • remove dirty, untracked, locked, user-owned, or ownership-unknown resources.

Integration

Called conditionally by planning/execution workflows only after the necessity decision. Pairs with finishing-a-development-branch for evidence-led cleanup.

Alternatives

Compare before choosing

Computed 937

event4u-app/agent-config

using-git-worktrees

Use when starting parallel work in isolation from the current branch — spawn a git worktree with ignore-safety checks and a clean test baseline — even when the user says 'try this on the side'.

Computed 77267,516

obra/superpowers

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

Computed 10043,183

coreyhaines31/marketingskills

ab-testing

When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program

Computed 10023,881

alirezarezvani/claude-skills

app-store-optimization

App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist