clean

Removes stale deployments, merged branches, worktrees, logs, and build output from a repository.

1|Updated May 6, 2026
One-click install
npx skills add https://github.com/diy-accounting-uk/submit.diyaccounting.co.uk --skill clean-diy-accounting-uk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clean
Source: https://github.com/diy-accounting-uk/submit.diyaccounting.co.uk/tree/main/.claude/skills/clean
Command: npx skills add https://github.com/diy-accounting-uk/submit.diyaccounting.co.uk --skill clean-diy-accounting-uk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Repositories accumulate clutter over time: stale AWS CloudFormation deployment stacks, merged git branches, abandoned worktrees, test logs, and build output. This Skill finds all five categories of leftover artifacts, presents them in one table, and removes only what the operator approves in a single pass. ## Core Features & Use Cases - Stale deployment detection: Queries AWS CloudFormation stacks across ci and prod profiles, compares them against last-known-good SSM parameters, and destroys stale sets via GitHub workflow runs. - Branch and worktree cleanup: Identifies merged or content-on-main branches (local and remote), protects branches with open PRs or unique commits, and removes worktrees of merged branches while keeping ones with uncommitted work. - Artifact and build output removal: Deletes logs, Playwright reports, test results, target/, cdk.out/, node_modules/, and the bundled JS file, then runs npm ci and npm run bundle to restore a working state. - Use Case: After a sprint of feature work, say "clean up" and the Skill gathers every stale deployment, merged branch, orphaned worktree, and build artifact, shows them in one table, and removes only the categories you approve before returning the checkout to an up-to-date main branch. ## Quick Start Tell the assistant to clean up the repository and approve the categories of stale deployments, branches, worktrees, logs, and build output you want removed.

Frequently Asked Questions about clean

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up stale AWS CloudFormation deployment stacks?▼

List stacks with aws cloudformation list-stacks filtered by status, compare deployment names against the last-known-good value stored in SSM parameters, then destroy stale sets via gh workflow run destroy-ci.yml or destroy-prod.yml. The Skill automates this gather-and-destroy flow.

How to delete merged git branches locally and on remote?▼

Run git fetch --prune, then check each branch with git rev-list --count main..branch and git diff against main. Branches that are merged or whose content already exists on main can be deleted with git branch -D and git push origin --delete, while branches with open PRs or unique commits are kept.

Can I remove a git worktree that has uncommitted changes?▼

You can force removal with git worktree remove --force, but uncommitted tracked changes would be lost. This Skill checks git status inside each candidate worktree first and keeps any worktree holding uncommitted work, reporting it instead of deleting it.

Is it safe to delete node_modules and build output directories?▼

Yes, when the content is fully regenerable. This Skill removes target/, cdk.out/, node_modules/, and the bundled JS file, then immediately runs npm ci and npm run bundle so the next build or test run finds everything it needs.

What happens if a cleanup command is denied by permissions?▼

When git worktree remove, git branch -D, or git push --delete is denied by session permission settings, the Skill prints the entire remaining command block for that category in a fenced block so the operator can run it manually, then continues with the next category.