agentleFS
satoshikawatosatoshikawato/gbdraw/.claude/skills/gbdraw-worktree/SKILL.md

gbdraw-worktree

Skill162 starsChanged 15 days agoMITView on GitHub

Set up, use, and remove a gbdraw git worktree for one task - create it from origin/dev, keep temporary files and logs outside the repository, run tests against the worktree's own package without reinstalling, push finished branches, and clean up after the PR merges. Use when starting work that needs its own branch or worktree, and when finishing it.

  • Installs packages
  • Commits and pushes

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep logs, probes, screenshots, and virtual environments out of .worktrees/.

    line 27
  2. Distinctive:

    Do not run git stash. Every worktree of the clone shares one stash list.

    line 28
  3. Very specific:

    Do not run pip install from a worktree, editable or not.

    line 32
  4. Distinctive:

    Use the port range assigned to the task for local Web servers and Playwright, so parallel tasks do not collide.

    line 41
  5. Very specific:

    Run long suites through .claude/scripts/run_quiet.py so the full log stays in a file.

    line 43
  6. Very specific:

    After the PR merges (GitHub deletes the remote branch), run git status in the worktree, then git worktree remove <path> and git branch -D …

    line 51
  7. Distinctive:

    Remove only worktrees you created.

    line 53
  8. Distinctive:

    When the task ends, delete its remaining worktrees, local branches, virtual environments, caches, and backups.

    line 54

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “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

gbdraw worktree lifecycle

This skill covers mechanics only. It does not decide what the task includes.

The concrete paths for this machine come from the local instructions (CLAUDE.local.md or ~/.claude/CLAUDE.md). The steps below name them:

  • $WORK_ROOT: the repository clone that holds .worktrees/.
  • $TASK_DIR: the task's folder outside the repository, for logs, evidence, scripts, screenshots, and STATE.md.

Create

git -C "$WORK_ROOT" fetch origin
git -C "$WORK_ROOT" worktree add --detach ".worktrees/<name>" origin/dev
cd "$WORK_ROOT/.worktrees/<name>"
git switch --no-track -c <prefix>/<topic> origin/dev   # fix, feat, refactor, docs, test
export TMPDIR="$TASK_DIR/tmp"; mkdir -p "$TMPDIR"
  • Keep logs, probes, screenshots, and virtual environments out of .worktrees/.
  • Do not run git stash. Every worktree of the clone shares one stash list.

Run code from the worktree

  • Do not run pip install from a worktree, editable or not. The Python environment is shared by every session, and an editable install that points at a worktree breaks once the worktree is removed.
  • python -m pytest run from the worktree root imports the worktree's gbdraw. For other Python entry points, set PYTHONPATH="$PWD".
  • Tests that call the gbdraw command need the worktree's CLI first on PATH: a shim script named gbdraw that runs PYTHONPATH="$GBDRAW_SRC" python -c 'from gbdraw.cli import main; main()' "$@", with GBDRAW_SRC set to the worktree root.
  • Use the port range assigned to the task for local Web servers and Playwright, so parallel tasks do not collide.
  • Run long suites through .claude/scripts/run_quiet.py so the full log stays in a file.

Push and finish

  • Push each verified commit at once: git push -u origin <branch>; after a rebase, --force-with-lease. A push to a work branch starts no CI and is the off-machine backup. "Do not open the PR yet" never means "do not push".
  • After the PR merges (GitHub deletes the remote branch), run git status in the worktree, then git worktree remove <path> and git branch -D <branch>. Remove only worktrees you created; ask the owner of any other one first.
  • When the task ends, delete its remaining worktrees, local branches, virtual environments, caches, and backups. Keep the report and the handoff files.

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.

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.