一键导入
git-worktrees
Use when starting feature work that needs isolation from current workspace — creates isolated git worktrees with safety verification
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when starting feature work that needs isolation from current workspace — creates isolated git worktrees with safety verification
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Perform a strict, full-coverage pull-request review against its issue, repository architecture, tests, security, and current target branch; supports an operator-authorized CI-free source-review profile.
Audit and clean up Git worktrees first, then safely tidy branches using required Hephaestus automation. Uses Athena's canonical dependency-resolution contract and fails if ~/.agent_brain/automation cannot be prepared. Worktree mutation always needs separate per-gate approval.
Investigate root cause before fixing bugs or unexpected behavior. Requires the Mnemosyne knowledge backend through advise and fails closed when it cannot be prepared.
Use when implementing any feature or bugfix, before writing implementation code — enforces RED-GREEN-REFACTOR cycle
Perform a full-coverage, strict repository evaluation. Supports quick and default report detail; default is the comprehensive strict review.
Search the required Mnemosyne knowledge repository before planning or implementation. Uses Athena's canonical dependency-resolution contract and fails if the backend cannot be prepared at ~/.agent_brain/knowledge.
| name | git-worktrees |
| description | Use when starting feature work that needs isolation from current workspace — creates isolated git worktrees with safety verification |
| argument-hint | <branch-name or feature description> |
| allowed-tools | ["Bash","Read"] |
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
Core principle: Systematic directory selection + safety verification = reliable isolation.
When NOT to use this skill manually: The myrmidon-swarm skill owns worktree creation for its
background subagents. Use this skill for manual development work, not to duplicate swarm setup.
Follow this priority order:
The tested scripts/prepare_worktree.py helper checks .worktrees and then worktrees. If both
exist, .worktrees wins.
Read AGENTS.md and its referenced repository guidance. If a preference is specified, pass it to
the helper with --directory DIRECTORY.
When no repository preference exists, use the host's temporary directory from
tempfile.gettempdir() with <project>-<branch>. This is commonly /tmp on Unix-like hosts and
avoids polluting the project directory.
The helper computes the project name from the repository root.
MUST verify directory is ignored before creating worktree. The helper fails closed when its project-local directory is not ignored.
If NOT ignored:
.worktrees/ to .gitignoreWhy critical: Prevents accidentally committing worktree contents to repository.
No .gitignore verification needed — outside the project entirely.
scripts/prepare_worktree.py
against this installed skill directory and invoke that absolute helper path with
BRANCH_NAME --start-point BASE_SHA --dry-run. For a contract requiring a distinct branch and
path, also pass exact --path and --path-root values.--dry-run, optionally supplying the documented
repository preference through --directory. Never replace the recorded SHA with ambient HEAD.If tests fail: Report failures, ask whether to proceed or investigate.
If tests pass: Report ready.
When work is done, invoke tidy for branch inspection and rebasing. Use the separately approved
audit and removal flow in tidy (Phase 1) for worktrees; do not improvise deletion commands.
Preserve the worktree by default. Delivery, merge, abandonment, or a general cleanup request does
not authorize removal; tidy must re-audit it and obtain per-path Gate C approval.
| Situation | Action |
|---|---|
.worktrees/ exists + ignored | Use it |
| Neither exists | Use the host temporary directory with <project>-<branch> |
| Directory not ignored | Add to .gitignore + commit first |
| Tests fail at baseline | Report failures + ask before proceeding |
Pairs with:
tidy for worktree audit and removal (its first phase) and branch inspection.Adapted from obra/superpowers under the MIT License. Copyright (c) 2025 Jesse Vincent.