/tidy-board:tidy-boardfrom tidy-board
Safely cleans up git branches, worktrees and stashes through a local panel. Each candidate shows proof it's already merged; only user-approved items are deleted, with backups for unique work.
Ships in tidy-board. 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.
This skill turns "there are too many branches" into a safe cleanup. scan reads git (read-only). Each candidate becomes a card with the proof that it is already merged. The user decides Delete / Keep / Later (pt-BR Apagar / Manter / Depois). apply re-verifies each item at the moment it deletes. Nothing is deleted without approval, and anything that exists in one place only gets a backup first. It needs python3 (stdlib) and git. gh is optional (it proves merged PRs).
Deleting the wrong thing costs more than leaving clutter: when in doubt, the item stays.
Reply to the user in the user's language. The panel and the cards that scan writes exist in English (the default) and in pt-BR: run scan --lang pt-BR when the user writes in Portuguese, and scan (or --lang en) otherwise. The user can also switch the panel's own text with the EN/PT toggle in its header; the cards, and the button wording the batch carries in labels (Delete/Keep/Later), stay in the language of the scan's --lang, not of the toggle. Every line the tool prints follows the same language (check, apply and restore read it from scan.json; --lang overrides it on every command). Never edit batch.json or scan.json to translate them. The literals below are written in English first, with the pt-BR wording next to them.
Use this skill when the user wants to clean local branches, worktrees or stashes.
Do not use it to delete one specific branch the user already named (a plain git branch -d is enough). Do not use it on a repository the user does not want touched.
It cleans one repository at a time, and only local refs: origin is never touched.
| Level | Criterion | How the card behaves |
|---|---|---|
| P1 | The tip is an ancestor of the base. | Safe. Goes into the group card. |
| P2 | gh shows a merged PR with the same tip. | Safe. Goes into the group card. |
| P3 | The same patch is already in the base (cherry-pick, rebase or squash). | Heuristic: asks for a second A to confirm and creates a backup. |
| P4 | Unique work: it exists only there. | Warning, second A and a backup. Stashes are always P4. |
"Upstream gone" alone proves nothing: a remote can be deleted without a merge.
Never offered: the base, the current branch, branches in use by a worktree, and worktrees with changes or untracked files. They appear under Do not touch (pt-BR Não tocar) on the first card, with the reason. The scan also prints them as NAO TOCAR: lines.
A clean worktree that holds git-ignored files (.env, node_modules/) is offered, but with a second A and outside the group: deleting the folder deletes those files, with no backup.
The scripts ship with this skill: ${CLAUDE_SKILL_DIR}/scripts/tidy_board.py (the tool) and ${CLAUDE_SKILL_DIR}/scripts/capy_board.py (the panel, a copy of the ar-board engine). Use them directly, always with python3 -I.
test -f "${CLAUDE_SKILL_DIR}/scripts/tidy_board.py" && test -f "${CLAUDE_SKILL_DIR}/scripts/capy_board.py" && echo OK || echo FALTA
OK means both scripts exist. FALTA means "missing".
If ${CLAUDE_SKILL_DIR} shows up unexpanded, use the path shown as "Base directory for this skill" when the skill was loaded, written out in full in every command.
In the commands below, <pasta> ("folder") is the batch folder printed after TIDY-BOARD DIR: by the scan.
python3 -I "${CLAUDE_SKILL_DIR}/scripts/tidy_board.py" scan [REPO] [--base REF] [--gh off] [--lang en|pt-BR]
scan does not fetch anything from the network and does not change the repository. --lang (default: CAPYBARA_LANG, then en) is the language of the cards and of every line the tool prints; the summary line ends with language <lang> (pt-BR idioma <lang>).
The base comes from --base. Otherwise it comes from origin/HEAD. Otherwise it is the first that exists among main, master, base, trunk.
The output contains:
TIDY-BOARD DIR: <folder>: by default .tidy-board/<batch>/ inside the repository. Suggest adding .tidy-board/ to .gitignore.DO NOT TOUCH: lines (pt-BR NAO TOCAR:): what is never offered, and why.If the output says TIDY-BOARD: nothing to clean up (pt-BR TIDY-BOARD: nada para limpar), stop and tell the user so.
Show the user the summary: how many items, how many per level, and what was left out.
python3 -I "${CLAUDE_SKILL_DIR}/scripts/capy_board.py" check <pasta>
python3 -I "${CLAUDE_SKILL_DIR}/scripts/tidy_board.py" check <pasta>
The first validates the panel batch. The second validates the pair batch.json + scan.json.
Above 40 items check prints a warning (warning: ..., pt-BR aviso: ...). If it does, propose cleaning in two rounds.
Run it in the background (Bash run_in_background):
python3 -I "${CLAUDE_SKILL_DIR}/scripts/capy_board.py" serve <pasta> --open
Give the user the URL that serve prints on the line AR-BOARD URL: http://127.0.0.1:PORTA/?t=TOKEN (PORTA is the port number, TOKEN is a private token; use the real values from the output) and explain, in a few lines:
Concluir e avisar o agente) and tells you done (pt-BR terminei). Accept either, or a clear equivalent ("finished"), but only when it clearly says the panel is finished. Anything vaguer ("ok", "go on") is not the signal: ask the user to finish the panel. The panel itself says Finished. Go back to Claude Code and say "done" (pt-BR Concluído. Volte ao Claude Code e diga "terminei"). If items are left without a decision (normal when the group card is used), the panel asks Undecided items: N. Finish anyway? (pt-BR Itens sem decisão: N. Concluir mesmo assim?). The user only has to confirm.The panel works only with the local server. Without access to localhost, tidy-board does not apply (apply reads the panel's decisions.json).
After the finish signal (done / terminei), always simulate first and show the user the dry-run list. The panel's counter counts the group card as one item, and the items it covers appear as undecided (pt-BR sem decisão). Only --dry-run shows what will really be deleted:
python3 -I "${CLAUDE_SKILL_DIR}/scripts/tidy_board.py" apply <pasta> --dry-run
If the user agrees with the list, run:
python3 -I "${CLAUDE_SKILL_DIR}/scripts/tidy_board.py" apply <pasta>
apply refuses to act if the panel was not finished, or if the decisions belong to another batch or round (exit code 2).
For each approved item, apply re-verifies the current state:
gh (once per run; without gh, the item is skipped).Whatever fails is skipped with the reason (exit code 1) and never forced. The results go to applied.json.
Summarize in one line per item: deleted, skipped (and why), and which ones got a backup.
If something was deleted by mistake, run:
python3 -I "${CLAUDE_SKILL_DIR}/scripts/tidy_board.py" restore <pasta> <ID>
restore works only for items with a backup (P3, P4, stashes, worktrees with no branch (detached HEAD)). It recreates the branch or the stash from the backup ref and releases the backup ref (deletes it).
P1/P2 items have no backup (their commits are in the base). For them restore refuses and prints the git branch <name> <sha> command to run by hand.
A removed worktree is never recreated: the command prints how to do it (git worktree add).
Backups live under refs/tidy-board/backup/... and accumulate. Tell the user about this. Delete them (git update-ref -d) only if the user asks.
git branch -D, git worktree remove, git stash drop or anything similar on your own. Only apply deletes, because only it re-verifies.origin. If a branch has a remote counterpart, the card says so. Removing the remote is the user's manual decision.git reads that repository's local configuration (hooks, the file-system monitor and external diff are ignored; the rest is not).| Command | What it does | Exit code |
|---|---|---|
scan [REPO] [--base REF] [--gh auto|off] [--out DIR] [--lang en|pt-BR] | reads git and writes batch.json + scan.json in that language (default en) | 0 ok |
check DIR | validates the pair | 0 ok, 1 invalid |
apply DIR [--dry-run] | re-verifies and deletes the approved items | 0 all done, 1 something skipped, 2 refused |
restore DIR ID | recreates a deleted item that has a backup | 0 ok, 2 error |
Every command takes --lang en|pt-BR. Without it, check, apply and restore speak the language the scan recorded; scan uses CAPYBARA_LANG, then English. The tags TIDY-BOARD DIR:, TIDY-BOARD ITENS:, APPLY: and RESTORE: and the action words deleted, skipped and would-delete are the same in both languages; errors start with error: (pt-BR erro:).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub dvwinck/capybara-toolbox --plugin tidy-boardOther plugins' skills for the same job