git-worktree

Auto-create git worktrees for workflows. Isolate changes, merge on success, discard on failure.

Best use case

git-worktree is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Auto-create git worktrees for workflows. Isolate changes, merge on success, discard on failure.

Teams using git-worktree should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/git-worktree/SKILL.md --create-dirs "https://raw.githubusercontent.com/nguyenthienthanh/aura-frog/main/aura-frog/skills/git-worktree/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/git-worktree/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How git-worktree Compares

Feature / Agentgit-worktreeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Auto-create git worktrees for workflows. Isolate changes, merge on success, discard on failure.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

> **AI-consumed reference.** Optimized for Claude to read during execution.
> Human-readable explanation: see [docs/architecture/HIERARCHICAL_PLANNING.md](../../../docs/architecture/HIERARCHICAL_PLANNING.md)
> or [docs/getting-started/](../../../docs/getting-started/) depending on topic.


# Git Worktree Integration

Auto-create git worktree when starting a workflow. All changes on isolated branch. Discard on failure -- zero damage to main.

---

## When to Use

- **Auto:** `/run` when `AF_WORKTREE=true`
- **Manual:** User says "use a worktree"
- **Skip:** Quick fixes, config changes, single-file edits

---

## Lifecycle

```toon
worktree_lifecycle[5]{event,action}:
  run:start,"git worktree add .worktrees/[id] -b af/[id]"
  Phase 1 approved,All edits in worktree directory
  Phase 5 complete,"Offer: merge / create PR / keep branch / discard"
  run:cancel,"git worktree remove .worktrees/[id]"
  run failed,Discard worktree — main untouched
```

---

## Configuration

```bash
export AF_WORKTREE=true
export AF_WORKTREE_DIR=".worktrees"  # default
```

Add `.worktrees/` to `.gitignore`.

---

## Safety

```toon
safety[4]{rule,reason}:
  Never force-delete with uncommitted changes,User may lose work
  Always offer merge/PR/keep/discard,User decides
  Auto-discard only on explicit cancel/failure,Don't assume
  Checkpoint commits before discarding,Last chance to recover
```

Works with `phase-checkpoint.cjs` -- checkpoints are commits on worktree branch, main never affected until explicit merge.

---

Related Skills

We are still matching the closest adjacent skills for this page. In the meantime, continue through the full directory.