git-workspace-init
為隔離開發初始化 Git Worktree
並行管理多個分支和功能是一項挑戰。此技能使用傳統的分支命名方式自動建立隔離的 git worktree,實現無需 stash 或切換分支的乾淨並行開發。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“git-workspace-init”。 /init-workspace feat user-authentication
预期结果:
- Branch name: feat/user-authentication
- Creating worktree at: /path/to/project/.worktrees/feat-user-authentication
- Workspace initialized!
- Branch: feat/user-authentication
- Path: /path/to/project/.worktrees/feat-user-authentication
- To start working: cd /path/to/project/.worktrees/feat-user-authentication
正在使用“git-workspace-init”。 /init-workspace fix login-validation-error
预期结果:
- Branch name: fix/login-validation-error
- Creating worktree at: /path/to/project/.worktrees/fix-login-validation-error
- Workspace initialized!
- Branch: fix/login-validation-error
- Path: /path/to/project/.worktrees/fix-login-validation-error
- To start working: cd /path/to/project/.worktrees/fix-login-validation-error
安全审计
安全This is a documentation-only skill containing workflow definitions and example code blocks. All subprocess examples use hardcoded command arrays with no user input injection risk. The 'C2 keywords' and 'weak crypto' static findings are false positives triggered by benign words in documentation text. No network calls, no file access beyond user's git repository, no external dependencies.
风险因素
⚙️ 外部命令 (3)
📁 文件系统访问 (2)
质量评分
你能构建什么
並行功能開發
同時處理多個功能,無需 stash 變更或反覆切換分支。
快速錯誤修正隔離
為生產環境熱修復建立隔離的工作空間,不打擾當前的開發狀態。
文件更新
使用專用分支在程式碼變更和文件更新之間保持清晰的分離。
试试这些提示
/init-workspace feat user-authentication
/init-workspace fix login-validation-error
/init-workspace docs api-reference
/init-workspace hotfix security-patch
最佳实践
- 使用明確的任務描述清楚表明正在進行的工作
- 選擇適當的任務類型(feat、fix、hotfix 等)以進行正確的分支分類
- 合併 PR 後使用提供的清理命令清理 worktree
避免
- 在分支描述中使用空格或大寫字母會破壞命名慣例
- 建立 worktree 而不推送到遠端會失去分支追蹤的好處
- 讓未使用的 worktree 在 .worktrees 目錄中累積