agentleFS
roundpilotroundpilot/superpowers-antigravity/skills/using-git-worktrees/SKILL.md

using-git-worktrees

Skill80 starsChanged 7 days agoMITView on GitHub

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

  • Installs packages

189 other projects use a version of this, 130 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 9 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.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • frankxaiSkill

    defense-in-depth

    Use when invalid data causes failures deep in execution, requiring validation at multiple system layers - validates at every layer data passes through to make bugs structurally impossible

    Also in 4 projects that use this

  • xfstudioSkill

    test-fixing

    Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.

    Also in 3 projects that use this

  • kntismSkill

    condition-based-waiting

    Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses

    Also in 3 projects that use this

  • xfstudioSkill

    context-driven-development

    Use this skill when working with Conductor's context-driven

    Also in 3 projects that use this

  • +3 more from Leodorareluctant259

The file

We split this skill into the rules it gives an agent

11 rules. 1 is common, 5 are distinctive, and 5 are very specific to this project.

  • 1

    Common

    Most of the 182 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ensure work happens in an isolated workspace using Antigravity 2.0's native workspace isolation.

    line 10
  2. Very specific:

    Verify Git Repository Existence: run git rev-parse --is-inside-work-tree.

    line 20
  3. Very specific:

    For parent orchestrator feature branches: Use git checkout -b <branch> directly.

    line 41
  4. Common:

    Run tests to ensure workspace starts clean:

    line 57
  5. Very specific:

    If agents write code at the same time → branch

    line 88
  6. Very specific:

    If one agent at a time writes, or agents only read → inherit

    line 89
  7. Very specific:

    Use git worktree add — use Workspace: "branch" for concurrent writers instead

    line 94
  8. Distinctive:

    Create a worktree when Step 0 detects existing isolation

    line 95
  9. Distinctive:

    Run Step 0 detection first

    line 100
  10. Distinctive:

    Use native workspace isolation

    line 101
  11. Distinctive:

    Verify clean test baseline

    line 103

“Common” is measured: kept by at least 6 in 10 of the 182 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

Using Git Worktrees

Overview

Ensure work happens in an isolated workspace using Antigravity 2.0's native workspace isolation.

Core principle: Detect existing isolation first. Then isolate the session on a feature branch; give Workspace: "branch" only to subagents that write alongside other writers. Never use manual git worktree add.

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.

Verify Git Repository Existence: run git rev-parse --is-inside-work-tree. It prints true inside a repository. Anything else means you are not in one — you cannot use worktrees; check whether you need to run git init first.

Then run each of these on its own and note what it prints:

git rev-parse --path-format=absolute --git-dir --git-common-dir
git branch --show-current

The first prints GIT_DIR, then GIT_COMMON; the two differ in a linked worktree. The second prints BRANCH, or nothing on a detached HEAD. (Git older than 2.31 lacks --path-format: resolve each printed path to an absolute one before comparing.)

Submodule guard: GIT_DIR != GIT_COMMON is also true inside git submodules. Verify with git rev-parse --show-superproject-working-tree: it prints a path inside a submodule, and nothing otherwise.

If GIT_DIR != GIT_COMMON (and not a submodule): Already isolated. Skip to Step 2.

If GIT_DIR == GIT_COMMON (or in a submodule): Normal repo. Proceed to Step 1.

Step 1: Create Isolated Workspace

For subagents that write concurrently (parallel agents editing overlapping files): Workspace: "branch" on invoke_subagent. The platform handles directory placement, branch creation, and cleanup. For plan implementers, which run one at a time: Workspace: "inherit" — they commit on your feature branch.

For parent orchestrator feature branches: Use git checkout -b <branch> directly. No worktree needed — the orchestrator works in place on a feature branch. On 2.0, a conversation started in a Project's New Worktree Mode already runs in its own worktree; Step 0 detects it.

Step 2: Project Setup

Auto-detect and run appropriate setup — if the repository root has one of these files, run its command:

FileCommand
package.jsonnpm install
Cargo.tomlcargo build
requirements.txtpip install -r requirements.txt
pyproject.tomlpoetry install
go.modgo mod download

Step 3: Verify Clean Baseline

Run tests to ensure workspace starts clean:

npm test / cargo test / pytest / go test ./...

If tests fail: Report failures, ask whether to proceed or investigate. If tests pass: Report ready.

Quick Reference

SituationAction
Already in linked worktreeSkip creation (Step 0)
In a submoduleTreat as normal repo (Step 0 guard)
Concurrent writing subagentsWorkspace: "branch" on invoke_subagent
Plan implementer (one at a time)Workspace: "inherit" on your feature branch
Parent orchestratorgit checkout -b <branch>
Tests fail during baselineReport failures + ask

Workspace Mode Decision Table

Antigravity 2.0 supports three workspace modes for subagents. Choose based on the agent's role:

ModeSyntaxUse forExample
branchWorkspace: "branch"Agents that write concurrently with other writersParallel fixers on overlapping files
inheritWorkspace: "inherit"Agents that work in your checkout: reviewers, and writers that run one at a timeReviewers, plan implementers
shareWorkspace: "share"Documented only as 'share directory storage'; its path, lifetime and git state are unverified — not recommended—

Rules of thumb:

  • If agents write code at the same time → branch
  • If one agent at a time writes, or agents only read → inherit

Red Flags

Never:

  • Use git worktree add — use Workspace: "branch" for concurrent writers instead
  • Create a worktree when Step 0 detects existing isolation
  • Skip baseline test verification
  • Proceed with failing tests without asking

Always:

  • Run Step 0 detection first
  • Use native workspace isolation
  • Auto-detect and run project setup
  • Verify clean test baseline

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.

Reviews can't be read right now.

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.