Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/leodorareluctant259/superpowers-zh/using-git-worktreesnpx skills add Leodorareluctant259/superpowers-zh --skill using-git-worktreesgit clone --depth 1 https://github.com/Leodorareluctant259/superpowers-zhWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/leodorareluctant259/superpowers-zh/using-git-worktrees)<a href="https://agentmods.dev/skills/leodorareluctant259/superpowers-zh/using-git-worktrees"><img src="https://agentmods.dev/badge/skills/leodorareluctant259/superpowers-zh/using-git-worktrees.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00039 | $0.01590 |
| Opus 5 | $0.00019 | $0.00795 |
| Sonnet 5 | $0.00008 | $0.00318 |
| Haiku 4.5 | $0.00004 | $0.00159 |
Grade A, and why
using-git-worktrees scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
100% identical to using-git-worktrees — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 219 lines — stays where its author put it; the contents beside it link to each section on GitHub.
使用 Git 工作树
概述
Git 工作树创建共享同一仓库的隔离工作区,允许同时在多个分支上工作而无需切换。
核心原则: 系统化的目录选择 + 安全验证 = 可靠的隔离。
开始时宣布: "我正在使用 using-git-worktrees 技能来建立一个隔离的工作区。"
目录选择流程
按以下优先顺序执行:
1. 检查现有目录
# 按优先顺序检查
ls -d .worktrees 2>/dev/null # 首选(隐藏目录)
ls -d worktrees 2>/dev/null # 备选
如果找到: 使用该目录。如果两者都存在,.worktrees 优先。
2. 检查 CLAUDE.md
grep -i "worktree.*director" CLAUDE.md 2>/dev/null
如果指定了偏好: 直接使用,无需询问。
3. 询问用户
如果没有现有目录且 CLAUDE.md 中无偏好设置:
未找到工作树目录。我应该在哪里创建工作树?
1. .worktrees/(项目本地,隐藏目录)
2. ~/.config/superpowers/worktrees/<project-name>/(全局位置)
你倾向哪个?
安全验证
项目本地目录(.worktrees 或 worktrees)
创建工作树前必须验证目录已被忽略:
# 检查目录是否被忽略(遵循本地、全局和系统 gitignore)
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
如果未被忽略:
根据 Jesse 的规则"立即修复坏掉的东西":
- 在 .gitignore 中添加相应条目
- 提交更改
- 继续创建工作树
为什么这很关键: 防止意外将工作树内容提交到仓库。
全局目录(~/.config/superpowers/worktrees)
无需 .gitignore 验证——完全在项目之外。
创建步骤
1. 检测项目名称
project=$(basename "$(git rev-parse --show-toplevel)")
2. 创建工作树
# 确定完整路径
case $LOCATION in
.worktrees|worktrees)
path="$LOCATION/$BRANCH_NAME"
;;
~/.config/superpowers/worktrees/*)
path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
;;
esac
# 创建带有新分支的工作树
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"
3. 运行项目设置
自动检测并运行相应的设置命令:
# Node.js
if [ -f package.json ]; then npm install; fi
# Rust
if [ -f Cargo.toml ]; then cargo build; fi
# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
# Go
if [ -f go.mod ]; then go mod download; fi
4. 验证基线正常
运行测试确保工作树初始状态干净:
# 示例 - 使用项目对应的命令
npm test
cargo test
pytest
go test ./...
如果测试失败: 报告失败情况,询问是否继续或排查。
如果测试通过: 报告就绪。
5. 报告位置
工作树已就绪:<full-path>
测试通过(<N> 个测试,0 个失败)
准备实现 <feature-name>
快速参考
| 情况 | 操作 |
|---|---|
.worktrees/ 存在 |
使用它(验证已忽略) |
worktrees/ 存在 |
使用它(验证已忽略) |
| 两者都存在 | 使用 .worktrees/ |
| 都不存在 | 检查 CLAUDE.md → 询问用户 |
| 目录未被忽略 | 添加到 .gitignore + 提交 |
| 基线测试失败 | 报告失败 + 询问 |
| 无 package.json/Cargo.toml | 跳过依赖安装 |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 219 lines · 39 tokens per session scan A 505f81d180b8
using-git-worktrees is a skill published in the GitHub repository Leodorareluctant259/superpowers-zh (5 stars, last pushed today), licensed MIT. It adds 39 tokens to every session and 1,590 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to using-git-worktrees, differing in 0 lines, and is treated as a copy.
Other skills, from other repositories
tui-screen
Create TUI screens, components, and views for the agents-in-a-box terminal UI. Use when building new ratatui components, adding panels, creating list views, or styling any terminal interface element. Provides color palette, component patterns, and quality checklist.
ship-it
End-to-end ship loop: atomic commits, PR, tiered review (lite|heavy), fix every finding, re-review until zero remain, then merge-commit. lite runs a single /review pass; heavy spins up a dynamic Workflow with diff-aware review personas plus a Codex cross-model peer. Use when Stevie says "/ship-it", "ship it", "ship…
tmux-ui-tripwire
Write or debug tmux-driven end-to-end TUI tests ("tripwires") for the ainb terminal app. Use when the user asks to "write a tmux test", "add a tripwire", "verify the TUI in tmux", "test feature X by pressing key Y", "validate plugin Z renders", or when editing any file under crates/ainb-core/tests/tripwire.rs.…
tmux-verify
The outer "is this TUI feature ACTUALLY done?" proof loop for the ainb terminal app. Use when the user asks to "verify the TUI is actually done", "prove this TUI feature works", "validate per tmux-verify", "vhs verify each journey", "frame-truth check the UI", "is the diff actually shown correctly", or to define the…
ainb-fleet:daemons
Runtime-health view of the four fleet daemons — phone bridge, notifyd, ATC, and the fleet auto-continue daemon — in one table. Each row reports state (running / stopped / unknown), pid, uptime, last activity, error count, and a HEALTH reason that distinguishes a clean stop from a crash (stale heartbeat) or a…
ainb-fleet:bridge
Native phone bridge — relay messages two-way between a chat channel (Telegram, Slack, and/or Discord) and your ainb sessions. Inbound chat messages route to a target session (by name: prefix, else a conductor- first default) and are delivered via tmux send-keys; the session's reply is captured from its JSONL…