git-worktrees
Skill7 starsChanged 5 months agoMITView on GitHub
Set up an isolated workspace for feature work so the current branch and working tree stay untouched, detecting existing isolation first, preferring the platform's native worktree tooling, and falling back to git worktrees only when nothing native exists. Use before starting feature work that needs isolation, or before executing an implementation plan.
- Installs packages
25 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- lost-rob0t/skillstheir own version, first seen Nov 28, 2026
- matt-riley/agent-skillstheir own version, first seen Nov 15, 2026
- jeanqussa/hermes-generic-opstheir own version, first seen Nov 8, 2026
- denormans/claude-code-workflowtheir own version, first seen Nov 8, 2026
- kazemcodes/skill-treeedited, first seen Nov 8, 2026
- Mahesh-Bishnoi/skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use obsidian-bases, verification-before-completion and 5 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.
wangzhuofengSkillobsidian-bases
Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of notes, or when the user mentions Bases, table views, card views, filters, or formulas in Obsidian.
Also in 3 projects that use this
OpenAISkillverification-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 5 projects that use this
SentrySkillsecurity-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
CloudflareSkillreceiving-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
CloudflareSkillsecurity-audit
Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.
Also in 3 projects that use this
GoogleSkillcode-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
Other versions25 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- kazemcodes/skill-tree★ 112% same
Wrote their own version · 24
- heyitsnoah/claudesidian★ 2.6ksame name
- jamesrochabrun/skills★ 209same name
- trailofbits/dropkit★ 130same name
- bostonaholic/rpikit★ 19same name
- CarbeneAI/Forge★ 9same name
- gabrielkoerich/skills★ 9same name
- sergeeey/Claude-cod-top-2026★ 9same name
- tstapler/dotfiles★ 8same name
- matt-riley/agent-skills★ 4same name
- vikisingh23/neuraforge-ai★ 4same name
14 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository89 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- site/llms-full.txtllms.txt
- site/llms.txtllms.txt
- improveSkill
- academic-writingSkill
- benchmark-reportingSkill
- bibtex-managerSkill
- citation-graphSkill
- citation-verifierSkill
- design-science-methodologySkill
- docx-thesisSkill
- experiment-reproducibilitySkill
- latex-toolkitSkill
- literature-searchSkill
- lit-review-synthesisSkill
- paper-readerSkill
- proofread-academicSkill
- research-figuresSkill
- research-methodologySkill
- research-questionSkill
- statistics-advisorSkill
- supervisor-updateSkill
- systematic-reviewSkill
- thesis-proposalSkill
- coolify-image-appSkill
- coolify-vps-baselineSkill
- deploy-verificationSkill
- express-prisma-coolify-imageSkill
- ghcr-coolify-pipelineSkill
- live-domain-cutoverSkill
- nextjs-coolify-imageSkill
- proxy-client-addressSkill
- vps-ops-toolkitSkill
- adr-writingSkill
- openapi-specSkill
- readme-writingSkill
- technical-writingSkill
- adversarial-reviewerSkill
- api-design-reviewSkill
- code-review-responseSkill
- create-agentSkill
- create-commandSkill
- create-hookSkill
- create-skillSkill
- db-migration-safetySkill
- dependency-upgradeSkill
- dockerfile-best-practicesSkill
- error-handling-patternsSkill
- executing-plansSkill
- explain-codebaseSkill
- fix-ciSkill
- github-actions-pipelineSkill
- grill-with-docsSkill
- incident-postmortemSkill
- logging-and-observabilitySkill
- parallel-agentsSkill
- performance-optimizationSkill
- refactoring-recipesSkill
- solid-principlesSkill
- systematic-debuggingSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 25 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Before creating anything, check whether you're already isolated.
- Very specific: line 18
If GIT_DIR != GIT_COMMON, you're likely already in a linked worktree, but the same is true inside a git submodule, so rule that out first:
- Very specific: line 26
If GIT_DIR == GIT_COMMON (or you're in a submodule), you're in a normal checkout.
- Distinctive: line 42
Only if there's no native tool.
- Very specific: line 54
If it isn't ignored, add it to .gitignore and commit that change first.
- Distinctive: line 61
If git worktree add fails on a permission/sandbox error, tell the user the sandbox blocked it and that you're working in the current …
- Distinctive: line 69
Run the project's tests so you know the workspace starts green:
- Distinctive: line 75
If they fail, report the failures and ask whether to proceed or investigate first: a dirty baseline makes it impossible to tell your new …
“Common” is measured: kept by at least 6 in 10 of the 25 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.
Files
Make sure the work happens somewhere isolated, without fighting whatever isolation the environment already provides. The order matters: detect what you're already in, prefer native tooling, and only reach for raw git worktree as a last resort. Creating a worktree on top of an environment that already gave you one produces phantom state the harness can't see or clean up.
Step 0: Detect existing isolation first
Before creating anything, check whether you're already isolated.
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)If GIT_DIR != GIT_COMMON, you're likely already in a linked worktree, but the same is true inside a git submodule, so rule that out first:
git rev-parse --show-superproject-working-tree 2>/dev/nullIf that prints a path, you're in a submodule: treat it as a normal repo. Otherwise, GIT_DIR != GIT_COMMON means you're already in a worktree, skip creation and go straight to setup (Step 3). Report it: "Already in an isolated workspace at <path> on branch <name>" (or note a detached HEAD, which will need a branch created at finish time).
If GIT_DIR == GIT_COMMON (or you're in a submodule), you're in a normal checkout. Unless the user has already stated a worktree preference, ask before creating one:
"Want me to set up an isolated worktree? It keeps your current branch untouched while I work."
Honor an existing stated preference without re-asking. If the user declines, work in place and skip to Step 3.
Step 1: Create the isolated workspace
Two mechanisms, tried in this order.
1a. Native worktree tooling (preferred)
Do you already have a native way to create a worktree: a tool named something like EnterWorktree or WorktreeCreate, a /worktree command, a --worktree flag? If so, use it and skip to Step 3. Native tools handle placement, branch creation, and cleanup themselves; using raw git worktree add alongside them creates state the harness can't track. Only fall through to 1b if no native tool exists.
1b. Git worktree fallback
Only if there's no native tool. Pick the directory by this priority: an explicit user preference always wins over what's on disk:
- A worktree directory the user already specified in their instructions.
- An existing project-local directory:
.worktrees/(preferred), orworktrees/. If both exist,.worktrees/wins. - Otherwise, default to
.worktrees/at the repo root.
For any project-local directory, verify it's git-ignored before creating the worktree: otherwise the worktree's contents get tracked:
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/nullIf it isn't ignored, add it to .gitignore and commit that change first. Then create the worktree on a new branch and move into it:
git worktree add "$path/$BRANCH_NAME" -b "$BRANCH_NAME"
cd "$path/$BRANCH_NAME"If git worktree add fails on a permission/sandbox error, tell the user the sandbox blocked it and that you're working in the current directory instead, then continue in place.
Step 3: Project setup
Auto-detect the stack and install dependencies: for example npm install (or pnpm/yarn) for package.json, cargo build for Cargo.toml, pip install -r requirements.txt / poetry install for Python, go mod download for go.mod. Skip if there's nothing to install.
Step 4: Verify a clean baseline
Run the project's tests so you know the workspace starts green:
# project-appropriate: npm test / cargo test / pytest / go test ./...If they fail, report the failures and ask whether to proceed or investigate first: a dirty baseline makes it impossible to tell your new bugs from pre-existing ones. If they pass, report ready: worktree path, branch, and that the baseline is green.
Common mistakes
- Fighting the harness: running
git worktree addwhen native isolation already exists. Step 0 and Step 1a exist to prevent this; it's the single most common error. - Skipping detection: creating a worktree nested inside one you're already in. Always run Step 0 first.
- Skipping the ignore check: project-local worktree contents end up tracked and pollute
git status. Alwaysgit check-ignorefirst. - Assuming the directory: guess and you violate the project's convention. Follow the priority order.
- Proceeding on a failing baseline: you lose the ability to attribute failures. Report and ask.
Attribution
Adapted from the using-git-worktrees entry of superpowers by Jesse Vincent (MIT). The structure and the core rules are theirs; the wording, the examples, and the integration with this registry's other items are this repository's.
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
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.

