using-git-worktrees
Skill5 starsChanged 8 months agoMITView on GitHub
当需要开始与当前工作区隔离的功能开发或执行实现计划之前使用——创建具有智能目录选择和安全验证的隔离 git 工作树
- Installs packages
189 other projects use a version of this, 77 of them edited.
Adopted by
Most recently taken up by
- DemonDamon/AgenticXedited, first seen Nov 9, 2026
- chrysogonus/power-agentstheir own version, first seen Nov 8, 2026
- roundpilot/superpowers-antigravitytheir own version, first seen Nov 8, 2026
- REPOZY/superpowers-optimizededited, first seen Nov 8, 2026
- lingyired/status-triotheir own version, first seen Nov 8, 2026
- afawfawffaf/my-skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use diagnosing-superpowers, defense-in-depth and 5 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
obraSkilldiagnosing-superpowers
Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.
Also in 20 projects that use this
frankxaiSkilldefense-in-depth
Use when invalid data causes failures deep in execution, requiring validation at multiple system layers - validates at every layer data passes through to make bugs structurally impossible
Also in 4 projects that use this
xfstudioSkilltest-fixing
Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.
Also in 3 projects that use this
kntismSkillcondition-based-waiting
Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses
Also in 3 projects that use this
xfstudioSkillcontext-driven-development
Use this skill when working with Conductor's context-driven
Also in 3 projects that use this
MicrosoftSkillroot-cause-tracing
Use when errors occur deep in execution and you need to trace back to find the original trigger - systematically traces bugs backward through call stack, adding instrumentation when needed, to identify source of invalid data or incorrect behavior
Also in 4 projects that use this
Other versions189 projects use a version of this.
Word for word · 2
- GEd520/legados★ 75100% same
- xjxj71/ai-token-usage-statistics★ 1100% same
Edited · 77
- jnMetaCode/superpowers-zh★ 8.4k18% same
- DemonDamon/AgenticX★ 1k15% same
- coco-research/coco★ 79714% same
- Ibrahim-3d/conductor-orchestrator-superpowers★ 38114% same
- Ibrahim-3d/orchestrator-supaconductor★ 37814% same
- totvs/engpro-advpl-tlpp-skills★ 16614% same
- REPOZY/superpowers-optimized★ 14617% same
- haojing8312/WorkClaw★ 14114% same
- ARounder-183/HiFiShifter★ 9315% same
- shibit-net/xuanji-community★ 9021% same
67 more not listed
Wrote their own version · 110
- obra/superpowers★ 314ksame name
- openai/plugins★ 7.8ksame name
- farm-fe/farm★ 5.6ksame name
- microsoft/FluidFramework★ 4.9ksame name
- silvertakana/worldwideview★ 1.9ksame name
- lingyired/status-trio★ 1.8ksame name
- GanyuanRan/Aegis★ 1.4ksame name
- pcvelz/superpowers★ 1.3ksame name
- usewhale/DeepSeek-Code-Whale★ 933same name
- usewhale/Whale★ 928same name
100 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- brainstormingSkill
- chinese-code-reviewSkill
- chinese-commit-conventionsSkill
- chinese-documentationSkill
- chinese-git-workflowSkill
- dispatching-parallel-agentsSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- mcp-builderSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- using-superpowersSkill
- verification-before-completionSkill
- workflow-runnerSkill
- writing-plansSkill
- writing-skillsSkill
The file
Files
使用 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; fi4. 验证基线正常
运行测试确保工作树初始状态干净:
# 示例 - 使用项目对应的命令
npm test
cargo test
pytest
go test ./...如果测试失败: 报告失败情况,询问是否继续或排查。
如果测试通过: 报告就绪。
5. 报告位置
工作树已就绪:<full-path>
测试通过(<N> 个测试,0 个失败)
准备实现 <feature-name>快速参考
| 情况 | 操作 |
.worktrees/ 存在 | 使用它(验证已忽略) |
worktrees/ 存在 | 使用它(验证已忽略) |
| 两者都存在 | 使用 .worktrees/ |
| 都不存在 | 检查 CLAUDE.md → 询问用户 |
| 目录未被忽略 | 添加到 .gitignore + 提交 |
| 基线测试失败 | 报告失败 + 询问 |
| 无 package.json/Cargo.toml | 跳过依赖安装 |
常见错误
跳过忽略验证
- 问题: 工作树内容被跟踪,污染 git status
- 修复: 创建项目本地工作树前始终使用
git check-ignore
假设目录位置
- 问题: 造成不一致,违反项目约定
- 修复: 遵循优先级:现有目录 > CLAUDE.md > 询问
带着失败的测试继续
- 问题: 无法区分新 bug 和已有问题
- 修复: 报告失败,获得明确许可后再继续
硬编码设置命令
- 问题: 在使用不同工具的项目上会出错
- 修复: 从项目文件自动检测(package.json 等)
示例工作流
你:我正在使用 using-git-worktrees 技能来建立一个隔离的工作区。
[检查 .worktrees/ - 存在]
[验证已忽略 - git check-ignore 确认 .worktrees/ 已被忽略]
[创建工作树:git worktree add .worktrees/auth -b feature/auth]
[运行 npm install]
[运行 npm test - 47 个通过]
工作树已就绪:/Users/jesse/myproject/.worktrees/auth
测试通过(47 个测试,0 个失败)
准备实现 auth 功能红线
绝不:
- 创建项目本地工作树时不验证是否已忽略
- 跳过基线测试验证
- 不询问就带着失败的测试继续
- 在有歧义时假设目录位置
- 跳过 CLAUDE.md 检查
始终:
- 遵循目录优先级:现有目录 > CLAUDE.md > 询问
- 对项目本地目录验证是否已忽略
- 自动检测并运行项目设置
- 验证测试基线干净
集成
被以下技能调用:
- brainstorming(阶段 4)- 设计通过且需要实现时必需
- subagent-driven-development - 执行任何任务前必需
- executing-plans - 执行任何任务前必需
- 任何需要隔离工作区的技能
配合使用:
- finishing-a-development-branch - 工作完成后清理时必需
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
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.

