agentleFS
NguyenHuy190303NguyenHuy190303/EEP/skills/cleanup/SKILL.md

cleanup

Skill2 starsChanged 19 days agoMITView on GitHub

Use when a port is taken, a dev server/tunnel/tmux/nohup process outlived its work, disk is filling, Docker/OrbStack has piled up containers, images, cache or volumes, or the user asks to tidy the machine.

71 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chips, react-query-best-practices and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • udecodeSkill

    chips

    Run the project's suggested-task ledger, the chips. /chips alone brings this session's open tasks up to date: it applies what the ledger helper says, settles stale and split tasks, cards what can start and reports the board, and /chips all also takes the ship-list tasks and the ones no live session owns, and merges duplicate tasks across the board. Use for /chips, /chips offer, start or drop, \"what chips are open\", \"suggest a task for X\", \"update the chips\", \"clean up the chips\", \"which chips are stale\", \"is this chip still worth doing\", \"merge duplicate chips\", at the last hand-back of a run that offered a task, and whenever pstack would file a tracked issue, a follow-up, a reflect Backlog item or an out-of-band PR.

    Also in 3 projects that use this

  • bibektimilsina00Skill

    react-query-best-practices

    Audit and fix React Query usage in apps/web — enforce query key factories, signal forwarding, staleTime, and proper mutation patterns. Use when reviewing or fixing server-state code.

    Also in 3 projects that use this

  • bibektimilsina00Skill

    you-might-not-need-a-callback

    Analyze and fix useCallback anti-patterns in your code

    Also in 3 projects that use this

  • Scylla23Skill

    redo

    Re-run the last routed task one model tier up (haiku → sonnet → opus → fable). User-invoked escalation when the previous result missed. Pass --dry-run to preview without running.

    Also in 3 projects that use this

  • Aetheria-Labs1Skill

    plan-page

    Plan one storefront page from strategy through final copy, section order, proof, offers, template direction, responsive layout, and production asset requirements. Stops at an approved execution-ready specification.

    Also in 3 projects that use this

  • SocialKit-APISkill

    video-transcripts

    Extract transcripts from social videos through SocialKit across YouTube, TikTok, Instagram, Facebook, X/Twitter, LinkedIn, and direct video file URLs. Use when the user asks to transcribe, get captions or subtitles, pull the spoken text, or read what a video says, including one video or many at once. Returns full text plus timestamped segments. Not for posting, private accounts, or unrelated website scraping.

    Also in 3 projects that use this

  • +3 more from bibektimilsina00

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 61 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    /tmp artifacts that were never persisted: Check the project's durable-storage rule first — an expensive result living only there gets …

    line 66
  2. Very specific:

    Never kill -9 $(lsof -ti:<port>) as a reflex: it skips the question of what that process was doing, and on a supervised process it is a …

    line 77

“Common” is measured: kept by at least 6 in 10 of the 61 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cleanup — local machine only

The reason this exists is not docker system prune — that is one command. It is that the popular cleanup commands delete the wrong things: docker system prune -a --volumes takes the local dev database with it, and kill $(lsof -ti:8777) kills a LaunchAgent that restarts 15 seconds later, so the port looks cleaned and is not.

Remote resources are out of scope: SkyPilot clusters, k8s pods and anything that costs money belong to the cluster-job workflow (e.g. a sky-job skill), which has its own gates. Never sky down --all, never kubectl delete from here.

Always: report first

bash scripts/report.sh

Prints listening ports with the process holding each one, processes still attached to a terminal (the reliable tell for "a shell left this behind" — daemons and app helpers have no controlling terminal), tmux sessions, and the Docker table with containers, volumes and reclaimable sizes. It deletes nothing.

Then present a table: what · how much it frees · tier · the exact command, and wait. Even the safe tier is proposed, not executed, unless the user already said go.

Tiers

Safe — rebuildable from a command, no state inside

ThingCommandNote
Build cachedocker builder prune -fusually the biggest number by far; rebuilds on next build
Dangling images (<none>)docker image prune -funtagged layers from replaced builds
Exited containersdocker rm <name> (name them) or docker container prune -fa container is not state; its volume is
Finished compose projectdocker compose -p <project> down (no -v)stops and removes containers, keeps volumes

Ask — cheap to delete, expensive or impossible to get back

  • Running containers. Something may be mid-write. Name it, say what it belongs to, ask.
  • Images that are slow to rebuild: GPU/ML bases, anything multi-GB or built from a private registry. Freeing 700 MB to spend 10 minutes rebuilding is a bad trade — say the trade out loud.
  • Terminal processes: a dev server (npm run dev, uvicorn --reload), an SSH tunnel, a training run. Show PID, elapsed time and the full command; the user decides. SIGTERM first (kill <pid>), SIGKILL (kill -9) only after it refuses.
  • tmux sessions: tmux attach -t <name> and look before tmux kill-session. A session holding a half-finished run is not junk.

Never automatically

  • Docker volumes. They are the only place local state lives — dev databases, MinIO buckets, Redis dumps. LINKS=0 means no container references it right now, not that it is junk: a compose down leaves its data volume at 0 links and compose up expects it back. Never docker system prune --volumes, never docker volume prune. List them with owner and size; delete only a volume the user names, one at a time.
  • Anything this session did not start, unless the user says whose it is. Another terminal, another person's tunnel, an editor's language server.
  • Processes under launchd. A port that keeps reopening after you kill its PID is usually held by a LaunchAgent with KeepAlive — find its label (launchctl list | grep -i <name>) and launchctl bootout gui/$(id -u)/<label>; killing the bare PID achieves nothing. Same shape for anything else in ~/Library/LaunchAgents.
  • /tmp artifacts that were never persisted. Check the project's durable-storage rule first — an expensive result living only there gets copied out before anything is removed.

Port already in use

lsof -nP -iTCP:<port> -sTCP:LISTEN       # who holds it — read the command, do not kill blind

Then decide by owner: your own dev server → stop it in its terminal; a container → docker stop; a LaunchAgent → launchctl bootout; something you do not recognise → report it, do not kill it. Never kill -9 $(lsof -ti:<port>) as a reflex: it skips the question of what that process was doing, and on a supervised process it is a no-op with extra steps.

Output

The table, the reclaimable total, then the commands actually run and what they freed. Report the real numbers (docker system df before and after), not "cleaned up".

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.