Superpowers Using Git Worktrees logo

Superpowers Using Git Worktrees

Community
christopherarter
superpowers-using-git-worktrees

Feature work needing an isolated workspace, or executing a plan? Load first.

Overview

Publisherchristopherarter
Repositorysuperpowers-reasonix
Skill namesuperpowers-using-git-worktrees
Stars
101
Forks
7
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by christopherarter on GitHub. Read the source before you install it.

Installation

Install the Superpowers Using Git Worktrees AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/christopherarter/superpowers-reasonix/tree/main/skills/superpowers-using-git-worktrees
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/christopherarter/superpowers-reasonix.git /tmp/superpowers-reasonix
mkdir -p .claude/skills
cp -r /tmp/superpowers-reasonix/skills/superpowers-using-git-worktrees .claude/skills/superpowers-using-git-worktrees
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Superpowers Using Git Worktrees in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Superpowers Using Git Worktrees on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Superpowers Using Git Worktrees is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Using Git Worktrees

Overview

Work in isolated workspace. Prefer native worktree tools; manual git worktrees only when none.

Core principle: Detect existing isolation first. Then native tools. Then git fallback. Never fight harness.

Announce at start: "I'm using the superpowers-using-git-worktrees skill to set up an isolated workspace."

Step 0: Detect Existing Isolation

Before creating anything, check if already in isolated workspace. Via bash:

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 also true inside submodules. Verify not a submodule before concluding "worktree":

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): Already in linked worktree. Skip to Step 3, do NOT create another. Report branch state:

  • On a branch: "Already in isolated workspace at <path> on branch <name>."
  • Detached HEAD: "Already in isolated workspace at <path> (detached HEAD, externally managed). Branch creation needed at finish."

If GIT_DIR == GIT_COMMON (or in a submodule): Normal repo checkout. Preference declared? Honor it, no asking. Else ask consent:

"Would you like me to set up an isolated worktree? It protects your current branch from changes."

Declines: work in place, skip to Step 3 — do NOT start editing feature code on the current branch first.

Step 1: Create Isolated Workspace

1a. Native Worktree Tools (preferred)

Already have a worktree mechanism — a tool named EnterWorktree, WorktreeCreate, a /worktree command, or a --worktree flag? Use it, skip to Step 3.

Native tools handle placement, branch creation, cleanup. Using git worktree add when a native tool exists creates phantom state the harness can't manage. No native tool: proceed to Step 1b.

1b. Git Worktree Fallback

Only use if Step 1a does not apply. Explicit user preference always beats filesystem state.

Directory Selection
  1. Check instructions for declared directory preference. Use it, no asking.
  2. Check for existing project-local worktree directory:
    bash
    ls -d .worktrees 2>/dev/null     # Preferred (hidden)
    ls -d worktrees 2>/dev/null      # Alternative
    Both exist? .worktrees wins.
  3. Check for existing global directory:
    bash
    project=$(basename "$(git rev-parse --show-toplevel)")
    ls -d ~/.config/reasonix/worktrees/$project 2>/dev/null
  4. No other guidance: default to .worktrees/ at project root.
Safety Verification (project-local directories only)

MUST verify directory ignored before creating worktree:

bash
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null

If NOT ignored: add to .gitignore, commit, proceed. Why critical: prevents committing worktree contents. Global directories need no verification.

Create the Worktree
bash
# For project-local: path="$LOCATION/$BRANCH_NAME"
# For global: path="~/.config/reasonix/worktrees/$project/$BRANCH_NAME"
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"

Sandbox fallback: git worktree add fails with permission error (sandbox denial — Reasonix confines writes to [sandbox] workspace_root)? Tell the user the sandbox blocked it, working in the current directory instead. Run setup and baseline tests in place.

Step 3: Project Setup

Auto-detect and run setup, bash:

bash
if [ -f package.json ]; then npm install; fi
if [ -f Cargo.toml ]; then cargo build; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
if [ -f go.mod ]; then go mod download; fi

Step 4: Verify Clean Baseline

Run tests, ensure clean baseline (npm test / cargo test / pytest / go test ./...).

Tests fail: report failures, ask whether to proceed or investigate. Pass: report ready.

Worktree ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready to implement <feature-name>

Quick Reference

SituationAction
Already in linked worktreeSkip creation (Step 0)
In a submoduleTreat as normal repo (Step 0 guard)
Native worktree tool availableUse it (Step 1a)
No native toolGit worktree fallback (Step 1b)
.worktrees/ existsUse it (verify ignored)
Both .worktrees/ and worktrees/ existUse .worktrees/
Neither existsCheck instruction file, then default .worktrees/
Directory not ignoredAdd to .gitignore + commit
Permission error on createSandbox fallback, work in place
Tests fail during baselineReport failures + ask

Red Flags

Never:

  • Create a worktree when Step 0 detects existing isolation
  • Use git worktree add when a native worktree tool exists — #1 mistake
  • Skip Step 1a, jump straight to git commands
  • Create project-local worktree without verifying it's ignored
  • Skip baseline test verification
  • Proceed with failing tests without asking

Always: run Step 0 first; prefer native tools; follow directory priority (existing > global legacy > instruction file > default); verify ignored for project-local; auto-detect and run setup; verify clean test baseline.

Frequently asked questions

What does the Superpowers Using Git Worktrees AI skill do?

Feature work needing an isolated workspace, or executing a plan? Load first.

Why use Superpowers Using Git Worktrees on TypingMind?

Because you install it once and use it with any model. Superpowers Using Git Worktrees is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Superpowers Using Git Worktrees in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/christopherarter/superpowers-reasonix/tree/main/skills/superpowers-using-git-worktrees. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Superpowers Using Git Worktrees?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Superpowers Using Git Worktrees?

As many as you like. As long as a model supports skills, you can use Superpowers Using Git Worktrees with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Superpowers Using Git Worktrees AI skill free?

Yes. It is published on GitHub by christopherarter under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇