worktree-workflow
Enforces Git worktree isolation for complex tasks, parallel development, or large refactors.
Install
mkdir -p .claude/skills/worktree-workflow && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/9829" && unzip -o skill.zip -d .claude/skills/worktree-workflow && rm skill.zipInstalls to .claude/skills/worktree-workflow
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Git worktree 隔离工作流。写入型 subagent 通过 frontmatter isolation:worktree 自动隔离;主会话需 claude --worktree 启动。触发:多文件或 >50 行修改、新功能开发、架构调整、实验性开发。Key capabilities
- →Automatically create and isolate Git worktrees
- →Manage parallel development environments
- →Cleanup worktrees after task completion
How it works
It uses Git worktrees to isolate changes in separate directories, allowing parallel development and testing before merging back to the main branch.
Inputs & outputs
When to use worktree-workflow
- →Isolating new feature development
- →Refactoring large codebases safely
- →Managing parallel development tasks
About this skill
worktree-workflow — Git 工作区隔离
何时使用
满足任一条件时应走 worktree 路径:
- 新功能开发(非紧急 hotfix)
- 修改超过 50 行代码
- 修改超过 3 个文件
- 数据库迁移
- 架构调整
- 实验性开发
- 多个并行任务需要同时进行
两条隔离路径
路径 A(推荐):使用带 isolation: worktree 的 subagent
本项目 7 个写入型 subagent 已默认启用 worktree 隔离:
build-error-resolver— TypeScript / 构建错误修复database-reviewer— SQL / 数据库 schema 变更e2e-runner— E2E 测试生成与维护go-build-resolver— Go 构建错误修复refactor-cleaner— 死代码清理、重构security-reviewer— 安全漏洞修复tdd-guide— TDD 开发
调用方式:
使用 Agent 工具,subagent_type 设为上述任一名称,
Claude Code 会自动创建 worktree 并在隔离环境中执行。
生命周期:
- Agent 启动 → 自动创建 worktree
- Agent 完成 + 无改动 → 自动删除 worktree
- Agent 完成 + 有改动 → 保留 worktree,返回路径与分支名供
git merge或 review
路径 B:主会话启动 claude --worktree
主会话需要隔离时(例如用户自己要在隔离环境里交互开发):
claude --worktree
注意:官方目前没有 settings.json 全局默认开关。如果希望每次都默认隔离,在 shell 配置里加 alias:
# ~/.bashrc or ~/.zshrc
alias claudew='claude --worktree'
何时不用 worktree(豁免)
- 单文件 ≤10 行的微修复
- 紧急生产 hotfix
- 纯文档改动
- 非 git 项目(工具不可用)
- 配置文件微调
冲突处理
worktree 完成后合并回主工作区:
# 在主工作区执行
git merge <worktree-branch>
# 若有冲突,在主工作区按常规流程解决
# 解决后删除 worktree
git worktree remove <worktree-path>
git branch -d <worktree-branch>
与其他 skill 协作
tddskill:TDD 流程本身涉及多轮修改,建议在 worktree 里做fixskill:Bug 修复 SOP 的 Phase 5(修复)天然适合 worktreespeckit.implement:按任务执行实现时,每个独立任务可用独立 worktree
参考
- Anthropic Claude Code 官方 worktree 特性(v2.1.72+)
git worktree官方文档:https://git-scm.com/docs/git-worktree
When not to use it
- →Non-git projects
- →Single-file micro-fixes
- →Emergency production hotfixes
Prerequisites
Limitations
- →Requires Git environment
- →Not suitable for emergency hotfixes
How it compares
It automates the lifecycle of Git worktrees for isolation, whereas manual worktrees require manual creation and cleanup.
Compared to similar skills
worktree-workflow side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| worktree-workflow (this skill) | 0 | 1mo | Review | Intermediate |
| resolve-conflicts | 81 | 8mo | Review | Intermediate |
| openspec-onboard | 10 | 6mo | Review | Beginner |
| codex-cli-bridge | 9 | 9mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by chenqin231
View all by chenqin231 →You might also like
resolve-conflicts
antinomyhq
Use this skill immediately when the user mentions merge conflicts that need to be resolved. Do not attempt to resolve conflicts directly - invoke this skill first. This skill specializes in providing a structured framework for merging imports, tests, lock files (regeneration), configuration files, and handling deleted-but-modified files with backup and analysis.
openspec-onboard
studyzy
Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.
codex-cli-bridge
alirezarezvani
Bridge between Claude Code and OpenAI Codex CLI - generates AGENTS.md from CLAUDE.md, provides Codex CLI execution helpers, and enables seamless interoperability between both tools
skill-sync
KyleKing
Syncs Claude Skills with other AI coding tools like Cursor, Copilot, and Codeium by creating cross-references and shared knowledge bases. Invoke when user wants to leverage skills across multiple tools or create unified AI context.
github-workflow-automation
ruvnet
Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management
git-advanced-workflows
wshobson
Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.