Standard workflow for all sync operations ('sync branch', 'pull latest', 'get latest changes', 'sync with upstream'): replaces bash-based git fetch/pull/merge workflows—detects fork vs origin, fetches from correct remotes, safely merges with fast-forward checks. Canonical branch synchronization implementation for git-workflows.
/plugin marketplace add cblecker/claude-skills/plugin install git-workflows@claude-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Use this skill for sync requests: "sync my branch", "pull latest", "sync with remote", "update my branch", "get latest from origin/upstream".
Use other skills for: rebasing (rebasing-branch), creating PRs (creating-pull-request), viewing remotes (git commands).
Updates branch with remote changes, auto-detecting fork vs origin scenarios.
Extract from user request: target branch (if specified, else current)
Objective: Determine which branch to sync and switch to it if needed.
Steps:
Determine target branch from user request:
Checkout target branch if specified and different from current:
git checkout <target-branch>
Validation Gate: IF checkout fails:
Continue to Phase 2.
Objective: Perform fork-aware branch synchronization in a single atomic operation.
Plan Mode: Auto-enforced read-only if active
Steps:
Run ../../scripts/sync-branch.sh (optionally pass target-branch parameter if user specified a branch in Phase 1, otherwise omit to sync current branch)
Parse the JSON response and handle results:
IF success: false:
Handle error based on error_type:
not_git_repo:
message and suggested_action from responsebranch_not_found:
message and suggested_action from responseuncommitted_changes:
message from responseuncommitted_files arrayIF creating-commit succeeded: RE-RUN Phase 2 (sync again after commit) Continue to Phase 3
IF creating-commit failed: STOP immediately EXPLAIN: "Cannot sync without committing changes" EXIT workflow
sync_conflict:
message and suggested_action from responsebranch_diverged:
message from responserepo_type_detection_failed:
message and suggested_action from responseOther errors:
IF success: true:
Extract sync results:
{
"success": true,
"branch": "main",
"is_fork": true,
"operations_performed": [
"fetched_all",
"rebased_on_upstream",
"pushed_to_origin"
],
"commits_pulled": 3,
"status": "up_to_date"
}
Continue to Phase 3.
Objective: Confirm sync completed successfully with standardized output.
Steps:
Format status message based on sync results:
branch, commits_pulled, and status from Phase 2 responseis_fork flagoperations_performed arrayReport using standardized template:
✓ Branch Synced Successfully
**Branch:** <branch> \
**Repository Type:** <Fork|Origin-only> \
**Commits Pulled:** <commits_pulled> \
**Status:** <status description> \
**Operations:** <operations_performed as list>
Status descriptions:
up_to_date: "Branch is in sync with remote"no_upstream: "No upstream tracking branch configured"upstream_missing_branch: "Upstream doesn't have this branch"push_failed: "Rebased on upstream but push to origin failed"sync_conflict: "Encountered conflicts during sync"Workflow complete.
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.