Loading...
Loading...
Compare original and translation side by side
| Use this skill when... | Use standard workflow instead when... |
|---|---|
| Starting implementation on any issue | Reading code or researching (no changes) |
| Working on a feature or fix | Quick single-line edit (typo, config value) |
| Processing multiple issues in parallel | Interactive debugging session |
| Delegating work to subagents | Already inside a worktree |
| 适合使用该工作流的场景 | 适合使用标准工作流的场景 |
|---|---|
| 启动任意问题的开发工作 | 仅阅读代码或进行调研(无代码变更) |
| 进行功能开发或Bug修复 | 快速单行修改(如拼写错误、配置值调整) |
| 并行处理多个任务 | 交互式调试会话 |
| 将工作委派给子Agent | 已处于Worktree目录中 |
main.gitmaingit branch --show-current 2>/dev/nullgit worktree list --porcelain 2>/dev/nullgit status --porcelain 2>/dev/nullgit symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/nullgit branch --show-current 2>/dev/nullgit worktree list --porcelain 2>/dev/nullgit status --porcelain 2>/dev/nullgit symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/nullgit fetch origin --prune
git status --porcelaingit fetch origin --prune
git status --porcelainundefinedundefined
**Naming conventions**:
| Task type | Worktree path | Branch name |
|-----------|---------------|-------------|
| Issue | `./worktrees/issue-{N}` | `wt/issue-{N}` |
| Feature | `./worktrees/feat-{name}` | `wt/feat-{name}` |
| Fix | `./worktrees/fix-{name}` | `wt/fix-{name}` |
**Why `./worktrees/`**: Inside the project directory so agents already have file permissions. The `/worktrees/` entry in `.gitignore` prevents tracking worktree contents.
**命名规范**:
| 任务类型 | Worktree路径 | 分支名称 |
|-----------|---------------|-------------|
| 问题修复 | `./worktrees/issue-{N}` | `wt/issue-{N}` |
| 功能开发 | `./worktrees/feat-{name}` | `wt/feat-{name}` |
| Bug修复 | `./worktrees/fix-{name}` | `wt/fix-{name}` |
**为什么选择`./worktrees/`**:位于项目目录内,Agent已拥有文件权限。`.gitignore`中的`/worktrees/`条目可避免追踪Worktree内容。undefinedundefined
**Subagent** — pass the absolute path:
**子Agent** —— 传递绝对路径:
**Multiple issues in parallel** — create one worktree per issue, launch agents simultaneously:
```bash
mkdir -p worktrees
git worktree add ./worktrees/issue-47 -b wt/issue-47 origin/main
git worktree add ./worktrees/issue-49 -b wt/issue-49 origin/main
git worktree add ./worktrees/issue-50 -b wt/issue-50 origin/main
**多任务并行处理** —— 为每个任务创建一个Worktree,同时启动多个Agent:
```bash
mkdir -p worktrees
git worktree add ./worktrees/issue-47 -b wt/issue-47 origin/main
git worktree add ./worktrees/issue-49 -b wt/issue-49 origin/main
git worktree add ./worktrees/issue-50 -b wt/issue-50 origin/mainundefinedundefined
**Verification checklist**:
- [ ] Commit references the correct issue number
- [ ] Tests pass in the worktree
- [ ] Changes are focused on the single task
- [ ] No unrelated modifications
**验证清单**:
- [ ] 提交信息关联正确的问题编号
- [ ] Worktree内测试通过
- [ ] 变更仅聚焦于当前任务
- [ ] 无无关修改undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinednode_modulesvendorundefinednode_modulesvendorundefined
Shared lockfiles ensure consistent versions across worktrees.
共享的锁文件可确保所有Worktree使用一致的依赖版本。Orchestrator (main repo, on main branch)
|
+--- Step 1: git fetch, confirm clean
|
+--- Step 2: Create worktrees
| +-- ./worktrees/issue-47
| +-- ./worktrees/issue-49
|
+--- Step 3: Launch agents IN PARALLEL
| |
| +---> Agent 1 -> ./worktrees/issue-47
| | +-- Implements, tests, commits
| |
| +---> Agent 2 -> ./worktrees/issue-49
| +-- Implements, tests, commits
|
+--- Step 4: Verify each worktree
|
+--- Step 5: Push + create PRs (sequential)
|
+--- Step 6: Cleanup协调Agent(主仓库,位于main分支)
|
+--- 步骤1: 拉取最新代码,确认主目录干净
|
+--- 步骤2: 创建Worktree
| +-- ./worktrees/issue-47
| +-- ./worktrees/issue-49
|
+--- 步骤3: 并行启动子Agent
| |
| +---> Agent 1 -> ./worktrees/issue-47
| | +-- 开发、测试、提交
| |
| +---> Agent 2 -> ./worktrees/issue-49
| +-- 开发、测试、提交
|
+--- 步骤4: 验证每个Worktree的成果
|
+--- 步骤5: 推送分支并创建PR(按顺序)
|
+--- 步骤6: 清理环境| Context | Command |
|---|---|
| List worktrees | |
| Create worktree | |
| Remove worktree | |
| Check worktree status | |
| Worktree log | |
| Worktree diff | |
| Push worktree branch | |
| Run tests in worktree | |
| Prune stale | |
| 场景 | 命令 |
|---|---|
| 列出所有Worktree | |
| 创建Worktree | |
| 删除Worktree | |
| 检查Worktree状态 | |
| 查看Worktree提交日志 | |
| 查看Worktree差异 | |
| 推送Worktree分支 | |
| 在Worktree中运行测试 | |
| 清理过期引用 | |
| Operation | Command |
|---|---|
| Add worktree | |
| List worktrees | |
| Remove worktree | |
| Prune stale | |
| Lock worktree | |
| Unlock worktree | |
| Move worktree | |
| 操作 | 命令 |
|---|---|
| 添加Worktree | |
| 列出Worktree | |
| 删除Worktree | |
| 清理过期引用 | |
| 锁定Worktree | |
| 解锁Worktree | |
| 移动Worktree | |