Create, manage, scan, update, and clean up git worktrees for parallel development with protected branch safeguards. Use when working on multiple branches simultaneously, isolating experiments, updating protected branches (main/develop), or when user mentions "worktree", "parallel branches", "feature isolation", "branch cleanup", "worktree status", or "update main/develop".
/plugin marketplace add randlee/synaptic-canvas/plugin install sc-git-worktree@synaptic-canvasThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Use this skill to manage worktrees with a standard structure and tracking. Use the /sc-git-worktree command to invoke this skill.
This skill delegates to specialized agents via the Task tool:
| Operation | Agent | Returns |
|---|---|---|
| Create | sc-worktree-create | JSON: success, path, branch, tracking_row |
| Scan | sc-worktree-scan | JSON: success, worktrees list, recommendations |
| Cleanup | sc-worktree-cleanup | JSON: success, branch_deleted, tracking_update |
| Abort | sc-worktree-abort | JSON: success, worktree_removed, tracking_update |
| Update | sc-worktree-update | JSON: success, commits_pulled, conflicts (if any) |
To invoke an agent, use the Task tool with:
.claude/agents/<agent-name>.md../{{REPO_NAME}}-worktrees.<worktree_base>/<branch>.<worktree_base>/worktree-tracking.md must be updated on create/scan/cleanup/abandon. Allow a toggle to disable tracking for repos that don't use it.Protected branches (main, develop, master, etc.) require special handling to prevent accidental deletion:
# Configuration (typically in repo .claude/config or passed to agents)
git_flow:
enabled: true # boolean: whether git-flow workflow is used
main_branch: "main" # or "master" - the primary production branch
develop_branch: "develop" # only if git_flow.enabled = true
protected_branches:
- "main"
- "develop"
- "master"
# Can include additional patterns: "release/*", "hotfix/*"
Protected Branch Rules:
git_flow.enabled: false → protect only main_branchgit_flow.enabled: true → protect main_branch + develop_branchprotected_branches array--update to safely pull changes for protected branches in worktrees<worktree_base>. If missing, create it.--branch <name>, --base <master|develop|...>, optional --path.git fetch --all --prune.<worktree_base>/<branch> (or override).git worktree add -b <branch> <path> <base>.git worktree add <path> <branch>.sc-worktree-create agent; it returns structured JSON (tracking row, status).git worktree list --porcelain.git -C <path> status --shortgit -C <path> fetchgit branch --remotes --contains <branch> to see if merged.sc-worktree-scan agent; it returns structured JSON.git status is not clean, stop and request explicit approval/coordination.git worktree remove <path> (use --force only with approval).git branch -d <branch>) and remotely (git push origin --delete <branch>) by default; only skip if the user explicitly opts out. If the remote branch is already absent, continue without error. If not merged, only delete with explicit approval.sc-worktree-cleanup agent; it returns structured JSON.git status is not clean, stop and request explicit approval/coordination.git worktree remove <path> (force only with approval).git branch -D <branch>) and remotely (git push origin --delete <branch>).sc-worktree-abort agent; it returns structured JSON.git status is not clean, stop and report dirty state.git fetch origin <branch> then git pull origin <branch>.git diff --name-only --diff-filter=Usc-worktree-update agent; it returns structured JSON with success or conflict details.This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.