From superpowers
Use when an experiment plan is about to be executed and code changes need git isolation - creates an isolated git worktree with DL environment verification so failed experiments can be cleanly discarded
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers:experiment-worktreeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create an isolated git worktree before making experiment-specific code changes. This ensures failed or inconclusive experiments can be discarded without touching the main branch.
Create an isolated git worktree before making experiment-specific code changes. This ensures failed or inconclusive experiments can be discarded without touching the main branch.
Announce at start: "I'm using the experiment-worktree skill to set up an isolated workspace."
experiment-execution step 2, before any code changes.Run directory setup from the main project root, not from an existing worktree. For this skill:
<project_root> means the original checkout where the user started.<worktree_path> means <project_root>/.worktrees/<topic>..worktrees/<topic>/... path is relative to <project_root> unless the step explicitly says to run inside the worktree..worktrees/ls -d .worktrees 2>/dev/null
If found, use it. If not found, create it.
git check-ignore -q .worktrees
If NOT ignored: add .worktrees/ to .gitignore, commit the change, then proceed.
Default pattern: exp/<YYYY-MM-DD>-<topic>
<topic> comes from the experiment plan filename or the hypothesis summary.experiment-design and experiment-closeout (i.e., YYYY-MM-DD-<topic>).exp/2026-04-11-rotary-embeddingsIf the user provides a branch name, use it as-is.
<project_root>, record pre-worktree state:
git branch --show-current)git rev-parse HEAD)git status --porcelain)<project_root>, create the worktree:
git worktree add .worktrees/<topic> -b exp/<YYYY-MM-DD>-<topic>
<project_root>, create dataset symlinks into <worktree_path> if needed (see below).<worktree_path>.<worktree_path>/.experiment-metadata.json.Auto-detect and run the appropriate setup in priority order:
pyproject.toml with [tool.poetry] -> poetry installpyproject.toml without poetry -> pip install -e .setup.py or setup.cfg -> pip install -e .requirements.txt -> pip install -r requirements.txtenvironment.yml -> conda env updateAfter dependency setup:
python -c "import torch; print(torch.cuda.is_available())" (skip if torch is not installed).Large datasets must never be copied into the worktree. Instead, create symbolic links pointing back to the original project directory so every worktree shares the same data on disk.
Detection — scan the main project root (not the worktree) for data directories in priority order:
.env, config.yaml, *.toml [data] sections, etc.).data/, datasets/, raw_data/, processed_data/.Creation — for every detected data directory <dir>:
# Run from <project_root>, or use absolute paths.
ln -s <resolved_data_path> <worktree_path>/<dir>
<dir> already exists in the worktree (because it is tracked), skip it and warn.<dir> is itself a symlink in the main project, resolve it first (readlink -f) and link to the resolved target.ls <linked_path> > /dev/null.Record — add a "symlinked_data" array to .experiment-metadata.json listing every
path that was symlinked, so finishing-experiment-branch knows not to delete real data
during cleanup.
If no data directories are found, report that no dataset symlinks were created and ask whether the experiment needs data that should be linked manually.
pytest or the project-specific test command if a test suite exists.Write <worktree_path>/.experiment-metadata.json so that a future session can detect and resume:
{
"worktree_path": ".worktrees/<topic>",
"branch_name": "exp/<YYYY-MM-DD>-<topic>",
"base_branch": "main",
"base_commit": "<hash>",
"tree_was_clean": true,
"environment_tool": "pip",
"symlinked_data": ["data/", "datasets/raw"],
"created_at": "<ISO-8601>"
}
Worktree ready at .worktrees/<topic>
Branch: exp/<YYYY-MM-DD>-<topic>
Base commit: <hash>
Environment: <pip/poetry/conda>
CUDA: <available/not available/not checked>
Tests: <N passing / skipped>
.worktrees/ is gitignored.Called by: experiment-execution (step 2)
Pairs with: finishing-experiment-branch (cleanup after experiment)
npx claudepluginhub shunyangliu/superpowers_dlCreates isolated git worktree environments to keep experimental or risky changes separate from the current branch. Handles setup, dependencies, and baseline tests.
Carries out deep learning experiment plans with isolated worktrees, artifact tracking, and reproducibility checks. Use for implementing experiment scaffolding or running research batches.
Creates isolated git worktrees for feature branches needing workspace isolation, with smart directory selection, .gitignore safety checks, auto project setup, and baseline verification.