Skip to content
Agentmart
Submit a tool

git-clean

Git cleanup with backup, item by item.

Skill by stage2dev

IndexedMIT
Write a review

Chalk Labs

Need help deploying git-clean?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/stage2dev-git-clean

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Git cleanup with backup, item by item. Use on: git is a mess, clean branches, old PRs, worktrees, stash; limpa as branches, git bagunçado, PRs velhas. Deletes only after the owner's ok.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/git-clean

Tools it pre-approves 4

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Bash(sh
  • "${CLAUDE_PLUGIN_ROOT}/scripts/py"
  • scripts/guarda.py
  • info)

What's inside

Skill name
git-clean
Description
Git cleanup with backup, item by item. Use on: git is a mess, clean branches, old PRs, worktrees, stash; limpa as branches, git bagunçado, PRs velhas. Deletes only after the owner's ok.
License
MIT
Allowed tools
Bash(sh, "${CLAUDE_PLUGIN_ROOT}/scripts/py", scripts/guarda.py, info)
Instructions
56 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Git clean

Repository: $ARGUMENTS (empty = the current one)

## Context (injected)

Context: !`sh "${CLAUDE_PLUGIN_ROOT}/scripts/py" scripts/guarda.py info`

Fields: `language`, `owner`, `reply_style`, `names{}`, `models{}`, `forbidden_subagent_models` (default `["fable"]`), `profile_path`, `plans_dir`, `setup_done`, `tools`, `plugin_source`, `catalog_path`. Write every reply and document in `language`. Never hardcode marker or document names: use the values in `names` (keys such as `need_you`, `progress`, `part_closed`). Call the user `owner`. If the JSON did not load, run the command once with Bash.

Short final reply. Nothing is deleted without the owner's "ok", item by item.

## Step 1 - LIVE numbers

Run now; never use a number from memory or from a summary.

```bash
git fetch --prune
echo "remote: $(git branch -r | wc -l)"; echo "local: $(git branch | wc -l)"
gh pr list --state open --json number,title,headRefName --limit 100
git worktree list
git stash list
git status --short | wc -l
```

## Step 2 - Classify

- **Merged**: PR `MERGED`, or `git cherry origin/<main> <branch>` with no `+` line (by content, since squash changes the hash).
- **Open**: PR is open. Do not touch.
- **Orphan**: no PR and commits outside main. May be another session's work: show `git log --oneline origin/<main>..<branch>` first.
- **Worktree**: tied to a merged branch, or with dirty files? Show its `git status`.
- **Stash**: show the content (`git stash show -p stash@{n} | head`) before any suggestion. Never `stash drop` without checking.
- Untracked files and existing changes: preserve; list, do not delete.

## Step 3 - Backup before any removal

- For each candidate branch: `git tag backup/<name>-YYYYMMDD <branch>` or `git bundle create <scratchpad>/backup-YYYYMMDD.bundle --all`.
- Confirm the backup exists (`git tag -l 'backup/*'` or `git bundle verify`).

## Step 4 - Propose the order

Give the owner a numbered list: item, class, reason, exact command, how to undo. End by asking which numbers to delete ("give me the order"). Recommended first (start with merged branches that have a backup).

## Step 5 - Execute only what was ordered

- Local: `git branch -d` (use `-D` only if `git cherry` proved the content is already on main and the owner ordered it). Remote: `git push origin --delete <branch>` only for merged branches.
- Worktree: `git worktree remove` (no `--force` if dirty).
- Recheck the live numbers and show before/after.

## Rules

- Never `git stash -u`, `git reset --hard`, `git clean -f` or `push --force`.
- A branch checked out in another worktree is not deleted.
- Doubt about a branch: do not delete; mark "ask".

From stage2dev/tune-up, MIT.

More from stage2dev/tune-up

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 20, 2026 (10 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from stage2dev

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get git-clean running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying git-clean?

CallGet help
Cite this page

git-clean skill. Agent Mart. https://agentmart.dev/skills/stage2dev-git-clean (last updated 2026-10-24)