bug-fix
Bug-fixing workflow that coordinates diagnosis, test-driven reproduction, root-cause analysis, and targeted fixes. Use when the user wants to fix a bug with…
Mechanical git repo hygiene. Prunes stale remote-tracking refs, deletes merged local branches (with confirmation), and reports stashes, untracked files, and unpushed work. Never touches remote state. Safe by default — destructive operations require explicit operator approval.
$ npx -y skills add chrisallenlane/claude-swe-workflows --skill tidy-git --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/tidy-gitContext preview
The summary Claude sees to decide when to auto-load this skill.
Mechanical git repo hygiene. Prunes stale remote-tracking refs, deletes merged local branches (with confirmation), and reports stashes, untracked files, and unpushed work. Never touches remote state. Safe by default — destructive operations require explicit operator approval.
name: tidy-git description: Mechanical git repo hygiene. Prunes stale remote-tracking refs, deletes merged local branches (with confirmation), and reports stashes, untracked files, and unpushed work. Never touches remote state. Safe by default — destructive operations require explicit operator approval. model: opus
Cleans up local git state that accumulates over time: remote-tracking refs for branches that no longer exist upstream, local branches that have already been merged, stale worktree references. Surfaces (without acting on) other state worth knowing about: stashes, untracked files, branches with no upstream, branches ahead of upstream, local-only tags.
**Scope of action:** local repo only. The skill never pushes, never force-pushes, never deletes anything on the remote. It also never deletes unmerged work, never deletes the current branch, never deletes the main branch.
**Reversibility note:** branches deleted by this skill can be recovered from `git reflog` for ~90 days. Tags and stashes are not deleted by this skill (the user makes those calls).
**Tidy, not review.** The user invoked `/tidy-git` because they want cleanup, not analysis. The skill defaults to *doing* the safe operations rather than presenting findings for approval. Operator approval is required only for the borderline-safe operations (merged-branch deletion) where a preview is genuinely useful.
**Find→fix seam stays small.** This skill exists in the `/tidy-*` namespace because the seam between "detect a stale ref" and "delete it" is essentially zero. Adding a review-and-approve step for every mechanical operation would turn a 5-second cleanup into a 5-minute interactive session.
**Boundary respected: local only.** Repo hygiene that touches the remote (e.g., deleting remote branches, force-pushing to clean up history) is out of scope. Those operations have non-local effects and warrant explicit per-action operator decisions, not bundled into a "tidy" workflow.
┌──────────────────────────────────────────────────────┐ │ TIDY-GIT │ ├──────────────────────────────────────────────────────┤ │ 1. Detect repo context (main branch, current │ │ branch, remote) │ │ 2. Run zero-risk auto-operations │ │ ├─ Prune remote-tracking refs │ │ └─ Prune stale worktree refs │ │ 3. Inventory borderline-safe operations │ │ └─ Merged local branches (excluding main + │ │ current) │ │ 4. Inventory informational state │ │ ├─ Stashes (with age) │ │ ├─ Branches with no upstream │ │ ├─ Branches ahead of upstream │ │ ├─ Local-only tags │ │ └─ Untracked files │ │ 5. Present preview + confirm for branch deletion │ │ 6. Execute approved deletions │ │ 7. Final summary │ └──────────────────────────────────────────────────────┘
Run the following checks before any cleanup:
Record the main branch and current branch for safety checks in later steps. These two branches are never deleted by this skill.
These operations remove only *references* — they never delete commits, objects, or files. Run without operator confirmation; they cannot lose work.
**2a. Prune remote-tracking refs.**
git remote prune origin
Removes local refs under `refs/remotes/origin/` for branches that no longer exist on the remote. Record the count removed.
If the project has multiple remotes, prune each one in turn.
**2b. Prune stale worktree refs.**
git worktree prune
Removes references to worktrees whose directories have already been deleted from disk. Does not touch worktrees that still exist. Record the count removed.
Identify local branches that have been fully merged into the main branch:
git branch --merged <main-branch>
**Exclude from the list:**
For each remaining branch, also record:
**Caveat to surface in the preview:** `git branch --merged` only detects branches whose tip commit is reachable from the main branch. Branches that were merged via *squash-merge* or *rebase-merge* will NOT show up here — their tip commit is different from anything on main. Those branches will surface in step 4's "branches ahead of upstream" category, where the user can decide.
These are reported but never modified by the skill.
**4a. Stashes.** `git stash list --date=relative`. Record count and the list. Stashes are never deleted by this skill — the user decides if they want to drop or apply.
**4b. Branches with no upstream.** `git for-each-ref --format='%(refname:short) %(upstream)' refs/heads/` and filter for em
A system of composable software engineering workflows for Claude Code. Plan projects, implement tickets, and run quality passes — from a single ticket to a multi-batch project, using the same layered architecture.
Repo: chrisallenlane/claude-swe-workflows
Bug-fixing workflow that coordinates diagnosis, test-driven reproduction, root-cause analysis, and targeted fixes. Use when the user wants to fix a bug with…
Proactive bug-hunting workflow. Assesses codebase risk through complexity, coverage, and structural analysis, then spawns focused investigators that write…
Multi-ticket batch workflow. Takes a batch of tickets, plans execution order, implements each via /implement in autonomous mode, runs cross-cutting quality…
Full-lifecycle project workflow. Takes batched tickets, implements via /implement-batch, runs smoke tests, then executes a comprehensive quality pipeline…
Iterative development workflow that coordinates implementation, refactoring, QA, and documentation agents to complete features systematically. Use when the…
Autonomous bug-elimination loop. Iteratively invokes /bug-hunt and /implement-batch until findings converge below an operator-specified severity floor. At…