/mad-skills:sync --no-stash, --no-cleanup, --no-rebase (optional flags)from mad-skills
Syncs local repository with origin/main: stashes changes, fetches/pulls, restores stash, cleans stale branches, and handles linked git worktrees.
Ships in mad-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
When this skill is invoked, IMMEDIATELY output the banner below before doing anything else.
Pick ONE tagline at random — vary your choice each time.
CRITICAL: Reproduce the banner EXACTLY character-for-character, including the diagonal / glyph before the name.
{tagline}
/$$ /$$$$$$ /$$ /$$ /$$ /$$ /$$$$$$
/$$//$$__ $$| $$ /$$/| $$$ | $$ /$$__ $$
/$$/| $$ \__/ \ $$ /$$/ | $$$$| $$| $$ \__/
/$$/ | $$$$$$ \ $$$$/ | $$ $$ $$| $$
/$$/ \____ $$ \ $$/ | $$ $$$$| $$
/$$/ /$$ \ $$ | $$ | $$\ $$$| $$ $$
/$$/ | $$$$$$/ | $$ | $$ \ $$| $$$$$$/
|__/ \______/ |__/ |__/ \__/ \______/
Taglines:
After the banner, display parsed input:
┌─ Input ────────────────────────────────────────
│ {Field}: {value}
│ Flags: {parsed flags or "none"}
└────────────────────────────────────────────────
Pre-flight results:
── Pre-flight ───────────────────────────────────
✅ {dep} {version or "found"}
⚠️ {dep} not found → {fallback detail}
❌ {dep} missing → stopping
──────────────────────────────────────────────────
Stage/phase headers: ━━ {N} · {Name} ━━━━━━━━━━━━━━━━━━━━━━━━━
Status icons: ✅ done · ❌ failed · ⚠️ degraded · ⏳ working · ⏭️ skipped
Synchronize local repository with the remote default branch using a deterministic bash script — no LLM subagent needed since all steps are pure git commands.
Parse optional flags from the request:
--no-stash: Don't auto-stash uncommitted changes--no-cleanup: Don't delete stale local branches--no-rebase: Use merge instead of rebase when on a feature branchBefore starting, check all dependencies in this table:
| Dependency | Type | Check | Required | Resolution | Detail |
|---|---|---|---|---|---|
| git | cli | git --version | yes | stop | Install from https://git-scm.com |
For each row, in order:
Before launching the subagent, detect the remote and default branch:
REMOTE=$(git remote | head -1) # usually "origin"
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/$REMOTE/HEAD 2>/dev/null | sed 's|.*/||')
Fallback chain if symbolic-ref fails:
git show-ref --verify refs/heads/main → use maingit show-ref --verify refs/heads/master → use masterPass {REMOTE} and {DEFAULT_BRANCH} into the subagent prompt.
Run the sync script directly — no LLM subagent needed since all steps are deterministic git commands:
# Resolve skill root (plugin install or direct install)
for SKILL_ROOT in \
"${CLAUDE_PLUGIN_ROOT:-}" \
"$HOME/.claude/plugins/marketplaces/slamb2k" \
"$(dirname "$(readlink -f "$0")")/.."
do
[ -f "$SKILL_ROOT/skills/sync/scripts/sync.sh" ] && break
done
bash "$SKILL_ROOT/skills/sync/scripts/sync.sh" \
"{REMOTE}" "{DEFAULT_BRANCH}" {FLAGS}
Parse the output between SYNC_REPORT_BEGIN and SYNC_REPORT_END markers.
Extract key=value pairs for the report fields: status, remote,
default_branch, main_updated_to, current_branch, worktree_mode,
stash, rebase, branches_cleaned, worktrees_skipped, errors. When
worktree_mode=true, three more fields appear right after it:
primary_path (the repo's main checkout), worktree_removed (the removed
worktree's path, skipped (<reason>), or none), and main_sync
(updated, already up to date, or skipped (<reason>) — whether main was
pulled in the primary).
Branch cleanup also tears down associated worktrees: a branch is "finished"
when it's merged, its remote is gone, OR its PR is closed without merging
(pr-first-autonomous-build.md REQ-014) — checked via a bounded gh/az
PR-state lookup, once per live worktree, not once per local branch. A
finished branch's worktree is removed before the branch is deleted (see
references/autonomous-worktree-lifecycle.md, repo root).
A worktree with uncommitted changes is never force-removed — it and its
branch are left intact and reported in worktrees_skipped.
Run from a linked worktree, the script auto-detects this (no flag
needed) and behaves differently: it syncs main in the primary checkout
rather than checking it out locally, then — if this worktree's branch is
finished (merged or its upstream is gone) and the worktree is clean — removes
the worktree and deletes the branch. A dirty finished worktree is left alone
(worktree_removed=skipped (dirty)); an unfinished branch is rebased in
place as usual. --no-cleanup skips the removal but still syncs main.
Branch deletion falls back to git's force delete (-D) only when the
branch's upstream is confirmed gone (the squash-merge case); a
force-deleted branch tip is not lost — it remains reflog-recoverable
(git reflog, git fsck --lost-found) until git's normal reflog expiry.
Session return (worktree mode). If the report shows
worktree_removed=<path> (an actual path, not none or a skipped …
reason), the session's cwd no longer exists — the worktree was just removed.
Before running any further git commands, return to primary_path: use the
native ExitWorktree tool if the session entered this worktree via
EnterWorktree and the tool is available; otherwise, run the next Bash
command with cd "<primary_path>" first.
Exit codes: 0=success, 1=fatal error, 2=partial success (conflict warnings).
Parse the subagent's SYNC_REPORT and present a clean summary:
┌─ Sync · Report ────────────────────────────────
│
│ ✅ Sync complete
│
│ 🌿 Main: {commit} — {message}
│ 🔀 Branch: {current_branch}
│ 📦 Stash: {restored|none|conflict}
│ 🧹 Cleaned: {branches or "none"}
│
└─────────────────────────────────────────────────
If errors occurred:
│ ❌ {error description}
│ {suggested resolution}
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub slamb2k/mad-skills --plugin mad-skills14 skills in this plugin
/braceInitialize any project directory with a standard scaffold for AI-assisted development. Creates specs/ and context/ directories, a project AGENTS.md with development workflow and guardrails (plus a CLAUDE.md that just points at it), .gitignore, and branch protection. Idempotent — safe to run on existing projects. Triggers: "init project", "setup brace", "brace", "initialize", "bootstrap", "scaffold"./buildContext-isolated feature development pipeline. Takes a detailed design/plan as argument and executes the full feature-dev lifecycle (explore, question, architect, implement, review, ship) inside subagents so the primary conversation stays compact. Use when you have a well-defined plan and want autonomous execution with minimal context window consumption./distilGenerate multiple unique web design variations for any website or web application. Accepts site specifications from a file (--spec path) or pasted text block. Creates a Vite + React + TypeScript + Tailwind project with Bun and produces N different creative designs accessible at /1, /2, /3, etc. Use when prototyping or exploring design directions for any web interface./dockGenerate container-based release pipelines that build once and promote immutable artifacts through environments (dev → staging → prod). Detects your stack, interviews for infrastructure choices, then outputs deterministic CI/CD files (Dockerfile, workflows, deployment manifests) that run without an LLM. Use when setting up deployment pipelines, containerizing an app, creating release workflows, or connecting CI to container-friendly infrastructure (Azure Container Apps, AWS Fargate, Google Cloud Run, Kubernetes, Dokku, Coolify, CapRover, etc.)./ferryFerry a session's live state across a context reset — persist a waybill document and arm a one-shot handoff so the next fresh session resumes from it. Use when the user types /ferry, says they want to hand off, checkpoint, wrap up, clear context, or start fresh while preserving state, or asks to carry work into a new session with clean optimised context. Captures task, status, next steps, key files, decisions, gotchas and repo state, writes a waybill (outside the repo by default), arms the handoff, and tells the user to /clear. "/ferry clean" lists and removes leftover waybills this skill created./hoistGenerate secure, low-infrastructure release pipelines that publish artifacts directly — language packages (npm, PyPI, crates, RubyGems, NuGet, Go), GitHub Releases with binaries, static sites/Pages, or serverless functions — without building a container image. OIDC/trusted publishing, provenance, idempotent publish guards, and three trigger models (auto-bump with optional approval, tag, manual). The non-container sibling of /dock. Use when releasing a package or app that doesn't ship as a container.