skills/branch-worktree-guardian/SKILL.md
Branch Worktree Guardian - Git 分支和 Worktree 管理工具。Use for: (1) 新開發需求時建立隔離分支, (2) 使用 worktree 機制避免分支衝突, (3) 驗證當前工作分支正確性, (4) 預防在錯誤分支上開發
npx skillsauth add tarrragon/claude branch-worktree-guardianInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Git 分支和 Worktree 管理工具,用於預防在錯誤分支上開發的問題。
在多 AI Agent 同時開發或複雜的分支管理場景中,容易發生以下問題:
# 標準流程
1. 確認 main 分支為最新
2. 創建 feature 分支
3. 創建 worktree 到獨立目錄
4. 切換到 worktree 目錄開發
保護分支列表:
mainmasterdeveloprelease/*在這些分支上嘗試編輯時,Hook 會詢問是否繼續或建立新分支。
格式:{project-name}-{branch-short-name}
範例:
book_overview_app-5w1h-skillbook_overview_app-branch-worktreebook_overview_app-ui-unification# 1. 確保 main 是最新的
git checkout main
git pull origin main
# 2. 創建 feature 分支
git checkout -b feat/your-feature-name
# 3. 創建 worktree(在專案同級目錄)
git worktree add ../project-name-feature-name feat/your-feature-name
# 4. 切換到 worktree 目錄
cd ../project-name-feature-name
# 5. 確認分支正確
git branch --show-current
git worktree list
# 移除 worktree(保留分支)
git worktree remove /path/to/worktree
# 移除 worktree 並刪除分支(謹慎使用)
git worktree remove /path/to/worktree
git branch -d branch-name
# 使用 SKILL 腳本
python .claude/skills/branch-worktree-guardian/scripts/verify_branch.py
# 手動檢查
git branch --show-current
git worktree list | grep $(pwd)
創建新的 feature 分支和對應的 worktree。
# 基本用法
python .claude/skills/branch-worktree-guardian/scripts/create_feature_worktree.py \
--branch feat/new-feature \
--worktree ../project-new-feature
# 從特定基礎分支創建
python .claude/skills/branch-worktree-guardian/scripts/create_feature_worktree.py \
--branch feat/new-feature \
--worktree ../project-new-feature \
--base develop
驗證當前分支是否適合編輯。
# 檢查當前目錄
python .claude/skills/branch-worktree-guardian/scripts/verify_branch.py
# 檢查指定目錄
python .claude/skills/branch-worktree-guardian/scripts/verify_branch.py --path /path/to/project
在 Edit 或 Write 工具執行前自動檢查:
Session 啟動時提醒:
常見的分支管理和 worktree 操作場景包括:
詳見:常見情境處理 (common-scenarios.md)
Hook 整合和分支保護規則的配置說明:
詳見:配置說明 (configuration.md)
Last Updated: 2026-03-18 Version: 1.0.0
重要:本 skill 透過
uv tool install安裝為獨立 CLI,source(本目錄)與 installed(~/.local/share/uv/tools/<package>/)是兩份獨立 Python package。修改 source 後若未 reinstall,CLI 仍使用 stale installed 版本,新增的函式會 AttributeError 或被 hasattr 包裝靜默吞掉(W11-037 根因)。
修復指令:
cd .claude/skills/<本 skill 目錄> && uv tool install . --force --reinstall
自動偵測:每次 SessionStart 由 uv-tool-staleness-check-hook 比對 source vs installed SHA256,偵測 stale 時提示修復指令。對應 ticket-skill 本身另有 ticket-reinstall-hook 自動 reinstall。
development
Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
development
Claude Code release notes 框架影響評估工具。比對 last-reviewed 版本篩出新版本,逐項分類(對框架有幫助 / 需評估 / 無影響 / 不適用),對採用項引導建 ANA + WRAP + spawn 落地。Use when: 執行 /release-notes 看到新版本、定期檢查 CC 更新、評估新功能對專案框架的影響時。Triggers: release notes, release-notes, CC 更新, claude code 更新, 版本更新評估, 新功能評估, 框架影響評估。
development
Assertion design judgment framework for flaky and design-quality issues. Use when writing tests, reviewing assertions, diagnosing flaky tests, or deciding if a timing/float/cache assertion is appropriate. Do NOT use for API syntax or refactoring.
tools
Chrome Extension 實機測試與 debug 工作流,以 chrome-devtools-mcp 為核心工具。Use when: (1) 完成功能後實機驗證 / manual test / 試看看 / 跑看看 / verify feature, (2) extension debug / popup 不作動 / content script 不注入 / service worker 報錯 / background 出問題, (3) 安裝 unpacked extension / load unpacked / 載入未封裝, (4) 看 console / 看 network / 看 log / view console / inspect requests, (5) 功能更新後重新載入 extension / rebuild reload / reload extension。涵蓋 Manifest V3 service worker / content script / popup / options page 的 chrome-devtools-mcp 工具呼叫流程。不取代 Puppeteer / Playwright 自動化 E2E(CI 用),定位為開發期手動驗證與 LLM-assisted debug。