agentleFS
sergeeeysergeeey/Claude-cod-top-2026/skills/core/git-worktrees/SKILL.md

git-worktrees

Skill9 starsChanged 6 months agoMITView on GitHub

Rule: worktree = recommendation, not mandate. Regular branch covers 80% of cases. Claude Code has a built-in EnterWorktree tool: - Automatically creates a worktree in a sibling directory - Switches context to the new tree - After completion — merge and cleanup When to use EnterWorktree: 1. Plan contains 5+ steps with high risk of cascading errors 2. User asks to "try it, but keep rollback possible" 3. Parallel task while current one is unfinished

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use verification-before-completion, security-review and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenAISkill

    verification-before-completion

    Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

    Also in 4 projects that use this

  • SentrySkill

    security-review

    Finds exploitable application security vulnerabilities in code changes. Use for Warden security scans, appsec review, OWASP-style checks, authentication or authorization bugs, injection, XSS, SSRF, path traversal, secrets, unsafe crypto, webhook verification, open redirects, or sensitive data exposure.

    Also in 4 projects that use this

  • OpenAISkill

    systematic-debugging

    Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

    Also in 4 projects that use this

  • CloudflareSkill

    receiving-code-review

    Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 4 projects that use this

  • SentrySkill

    skill-creator

    Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.

    Also in 3 projects that use this

  • +3 more from openai

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 24 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    USE when needing isolated workspace for experiments or parallel development.

    line 12
  2. Distinctive:

    After completion — merge and cleanup

    line 82
  3. Distinctive:

    Always git stash before creating worktree if you have uncommitted changes

    line 101

“Common” is measured: kept by at least 6 in 10 of the 24 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- BSV — Brief Skill View | поиск: BSV Скил : git-worktrees TL;DR : Изолированные ветки без переключения контекста Вызов : 'worktree', 'изолируй ветку' НЕ для : Работа в одной ветке -->

name: git-worktrees description: > [STATUS: review] [CONFIDENCE: high] [REVIEWED: 2026-03-13] USE when needing isolated workspace for experiments or parallel development. Triggers: worktree, experiment, parallel branch, isolated copy, isolated branch, parallel work.

Skill: Git Worktrees

When to Load

  • Experiment with uncertain outcome (may require rollback)
  • Parallel work on 2+ tasks
  • Large refactor while needing to keep a working version

Principle

Worktree = isolated working copy. Cheaper than stash/switch, safer than working in one tree.


Decision Matrix: branch vs worktree

SituationBranchWorktreeWhy
Bug fix in 1-2 filesvWorktree overhead not justified
Experiment (may not be needed)vClean rollback = delete the folder
Parallel work (2 tasks)vNo stash/switch needed
Large refactor 5+ filesvMain branch stays working
Regular feature 3-5 filesvWorktree = overkill
CI/CD check on another branchvDoes not interrupt current work

Rule: worktree = recommendation, not mandate. Regular branch covers 80% of cases.


Workflow

1. Create worktree

# EnterWorktree creates a worktree automatically (Claude Code built-in)
# Or manually:
git worktree add ../project-experiment feature/experiment
cd ../project-experiment

2. Work in worktree

  • Worktree = full working copy with a separate HEAD
  • Can work in parallel in main tree and worktree
  • Commits in the worktree go to their own branch

3. Merge result

# From the main tree:
git merge feature/experiment
# Or cherry-pick specific commits:
git cherry-pick <commit-hash>

4. Cleanup

git worktree remove ../project-experiment
# Or if branch is no longer needed:
git worktree remove ../project-experiment
git branch -d feature/experiment

Claude Code Integration

Claude Code has a built-in EnterWorktree tool:

  • Automatically creates a worktree in a sibling directory
  • Switches context to the new tree
  • After completion — merge and cleanup

When to use EnterWorktree:

  1. Plan contains 5+ steps with high risk of cascading errors
  2. User asks to "try it, but keep rollback possible"
  3. Parallel task while current one is unfinished

Anti-patterns

Don't doWhy
Worktree for every minor editOverhead > benefit
Forgetting cleanup after mergeDead directories accumulate
Working in worktree without a branchDetached HEAD = lost commits
Multiple worktrees on one branchGit won't allow it (and rightly so)

Gotchas

  • Always git stash before creating worktree if you have uncommitted changes
  • Worktree cleanup is manual — delete the directory when done

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.