Automated summary
Manages Git worktrees for parallel development with protective safeguards for protected branches.
Strengths
- Automates creation, updating, and cleanup of worktrees.
- Safeguards protected branches (main, develop) from accidental deletion.
- Optional tracking document for worktree status and metadata.
- Delegates operations to specialized agents for modularity.
Limitations
- Requires a specific directory structure (../synaptic-canvas-worktrees by default).
- Tracking may be overkill for simple repositories.
- Depends on git worktree command and availability of associated agents.
Use this skill when working on multiple branches simultaneously and need safe isolation of changes.
Avoid it for single-branch work or when your workflow does not require Git worktrees.
Security analysis
SafeThe skill solely describes a structured workflow for managing Git worktrees using standard git commands, with explicit safeguards to protect critical branches. It does not instruct any destructive, exfiltrating, or obfuscated actions.
No concerns found
How this analysis is madeExamples
Create a new worktree for feature 'user-auth' based on develop with tracking enabled.Scan all current worktrees and show their status and branch information.Clean up the worktree for branch 'user-auth' after it has been merged into develop.name: sc-managing-worktrees description: > 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". version: 0.8.0
Managing Git Worktrees
Use this skill to manage worktrees with a standard structure and tracking. Use the /sc-git-worktree command to invoke this skill.
Agent Delegation
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:
- Prompt file:
.claude/agents/<agent-name>.md - Parameters as documented in each agent's Inputs section
Standards and paths
- Repo root: current directory.
- Default worktree base:
../synaptic-canvas-worktrees. - Worktrees live in
<worktree_base>/<branch>. - Tracking document (if used):
<worktree_base>/worktree-tracking.mdmust be updated on create/scan/cleanup/abandon. Allow a toggle to disable tracking for repos that don't use it. - Naming: worktree directory = branch name; branch naming follows repo policy (e.g., master release; develop/DevBranch integration; feature from integration; hotfix from master; release branches as needed).
- Branch protections/hooks: no direct commits to protected branches; ensure hooks/branch protections are respected across worktrees.
- Cleanliness: worktrees must be removed and tracking updated when work is complete or branch is merged.
Protected Branch Configuration
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:
- If
git_flow.enabled: false→ protect onlymain_branch - If
git_flow.enabled: true→ protectmain_branch+develop_branch - Additional branches can be added to
protected_branchesarray - Cleanup/abort agents NEVER delete protected branches (local or remote)
- Protected branches can only be removed from worktrees, never deleted
- Use
--updateto safely pull changes for protected branches in worktrees
Workflows
Scaffolding (if missing)
- Ensure base path exists:
<worktree_base>. If missing, create it. - If tracking is enabled, ensure tracking doc exists with headers.
Create worktree (and branch)
- Inputs:
--branch <name>,--base <master|develop|...>, optional--path. - Ensure scaffolding/tracking doc exists (if enabled); fetch all:
git fetch --all --prune. - Confirm base branch exists and is up to date.
- Determine path: default
<worktree_base>/<branch>(or override). - Create branch/worktree:
- If branch does not yet exist:
git worktree add -b <branch> <path> <base>. - If branch exists:
git worktree add <path> <branch>.
- If branch does not yet exist:
- In the new worktree, ensure hooks apply and verify status is clean.
- If tracking enabled, add/refresh entry in tracking doc (branch, path, base, purpose, owner, created date, status).
- Agent option: delegate to
sc-worktree-createagent; it returns structured JSON (tracking row, status).
Scan/verify worktrees
- List worktrees:
git worktree list --porcelain. - Cross-check tracking doc (if enabled); flag missing/stale entries or extra rows.
- For each worktree, check status and merge state:
git -C <path> status --shortgit -C <path> fetchgit branch --remotes --contains <branch>to see if merged.
- Identify issues: untracked changes, diverged branches, merged-but-not-cleaned worktrees, missing tracking entries.
- Update tracking doc with current state and issues (if enabled); propose cleanup where appropriate.
- Agent option: delegate to
sc-worktree-scanagent; it returns structured JSON.
Clean-up worktree (post-merge or finished work)
- Check if branch is protected: If branch is in protected_branches list, ONLY remove worktree, NEVER delete the branch.
- If
git statusis not clean, stop and request explicit approval/coordination. - Ensure all work is committed/pushed or explicitly confirmed to discard.
- Confirm target branch merged or otherwise approved for removal.
- Remove worktree:
git worktree remove <path>(use--forceonly with approval). - For non-protected branches: If merged and no unique commits, delete the branch locally (
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. - For protected branches: Only remove worktree, preserve branch locally and remotely. Update tracking to note "worktree removed, branch preserved (protected)".
- If tracking enabled, update tracking doc to remove/mark cleaned with merge SHA/date.
- Agent option: delegate to
sc-worktree-cleanupagent; it returns structured JSON.
Abandon worktree (discard work)
- Check if branch is protected: If branch is in protected_branches list, ONLY remove worktree, NEVER delete the branch.
- If
git statusis not clean, stop and request explicit approval/coordination. - Confirm user approval to discard local changes and optionally delete the branch.
- Remove worktree:
git worktree remove <path>(force only with approval). - For non-protected branches: If instructed, delete the branch locally (
git branch -D <branch>) and remotely (git push origin --delete <branch>). - For protected branches: Only remove worktree, preserve branch locally and remotely. Require confirmation: "Branch is protected. Remove worktree but preserve branch?"
- If tracking enabled, update tracking doc to remove the entry and note abandonment.
- Agent option: delegate to
sc-worktree-abortagent; it returns structured JSON.
Update protected branch (pull latest changes)
- Verify branch is protected: Only operates on branches in protected_branches list. If no branch is specified, update all protected branches that have worktrees.
- Check if worktree exists at expected path; error if missing.
- If
git statusis not clean, stop and report dirty state. - Fetch and pull:
git fetch origin <branch>thengit pull origin <branch>. - If merge conflicts occur:
- Collect conflicted files:
git diff --name-only --diff-filter=U - Return control to main agent with conflict details
- Main agent coordinates with user to resolve conflicts
- After resolution, user commits and continues
- Collect conflicted files:
- If clean pull: Update tracking with last_checked timestamp and commits pulled count.
- Agent option: delegate to
sc-worktree-updateagent; it returns structured JSON with success or conflict details.
Safety and reminders
- NEVER delete protected branches (main, develop, master) under any circumstances.
- Protected branches can only be removed from worktrees; the branch itself must always be preserved.
- Never delete branches or force-remove worktrees without explicit approval.
- Never clean/abandon a worktree with uncommitted changes unless explicitly approved.
- Keep tracking doc in sync on every operation when enabled.
- Respect branch protections and hooks; no direct commits to protected branches.
- Use background agents for long scans/cleanups; keep the main context focused on decisions and summaries.
- When updating protected branches in worktrees, handle merge conflicts by returning control to main agent for user coordination.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/managing-git-worktrees-mm5t8a1q/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/managing-git-worktrees-mm5t8a1q' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/managing-git-worktrees-mm5t8a1q/download' --output '.skill-downloads/managing-git-worktrees-mm5t8a1q/SKILL.md.part' && mv '.skill-downloads/managing-git-worktrees-mm5t8a1q/SKILL.md.part' '.skill-downloads/managing-git-worktrees-mm5t8a1q/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/managing-git-worktrees-mm5t8a1q/SKILL.md' && test -s '.skill-downloads/managing-git-worktrees-mm5t8a1q/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/sc-managing-worktrees' && cp -R '.skill-downloads/managing-git-worktrees-mm5t8a1q' '.claude/skills/sc-managing-worktrees'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/managing-git-worktrees-mm5t8a1q'openskills read 'managing-git-worktrees-mm5t8a1q'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/managing-git-worktrees-mm5t8a1q/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.