agentleFS
elfrostelfrost/ai-patchlab/.agents/skills/cleanup/SKILL.md

cleanup

Skill1 starsChanged 2 months agoMITView on GitHub

Identify dead code, unused files, and clutter via import-graph tracing from entry points. Writes a report and asks before deleting anything.

  • Reads credentials

29 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use eval, worktree and 6 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.
  • qtzx06Skill

    eval

    Evaluate trained YOLO model accuracy with mAP metrics and per-class error analysis. Identifies failure cases for targeted improvement. Use after training.

    Also in 3 projects that use this

  • MicrosoftSkill

    worktree

    Create, reuse or clean up a dedicated git worktree for working on a pull request or a private branch. Use from any PR-scoped workflow that needs an isolated checkout to keep current code and build output untouched.

    Also in 3 projects that use this

  • BlockSkill

    plan

    Draft a TDD, PRD, or lightweight plan in the conversation without committing it.

    Also in 5 projects that use this

  • DockerSkill

    research

    Research a documentation topic — locate affected files, understand the problem, identify what to change. Use when investigating an issue, a question, or a topic before writing a fix. Triggers on: "research issue 1234", "investigate what needs changing for #500", "what files are affected by #200", "where is X documented", "is our docs page about Y accurate", "look into how we document Z".

    Also in 7 projects that use this

  • AWSSkill

    writing-for-agents

    Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.

    Also in 3 projects that use this

  • AWSSkill

    ship

    Finalize dev work on an issue branch — update docs, push, and open a PR.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 23 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read CLAUDE.md to understand the project

    line 9
  2. Distinctive:

    NEVER delete without confirmation

    line 53
  3. Distinctive:

    Write the report BEFORE deleting anything

    line 54
  4. Distinctive:

    If unsure, mark ASK USER

    line 55

“Common” is measured: kept by at least 6 in 10 of the 23 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

Phase 1: Find entry points

  1. Read CLAUDE.md to understand the project
  2. Identify all entry points:
    • if __name__ == "__main__" in .py files
    • Scripts referenced in CLAUDE.md / README
    • Anything in Makefile, docker-compose, scripts/

Phase 2: Build the dependency graph

For each entry point, trace imports recursively. Mark every reachable file ALIVE. Mark unreachable ones DEAD.

Phase 3: Classify dead files

For each DEAD file, categorize:

  • Orphan script — has __main__, never called by main flow (could be a utility)
  • Abandoned module — imported before, no longer is
  • Duplicate / superseded — does the same as an alive file
  • Config / data file — used at runtime but not imported (templates, configs)
  • Test file — may still be relevant even outside main path

Phase 4: Other clutter

  • Empty __init__.py that serves nothing
  • .pyc / __pycache__ directories
  • Old output / log / temp files
  • Backup files (*_v2.py, *_old.py, *_backup.py)
  • Stale TODO / notes files

Phase 5: Report

Write CLEANUP_REPORT.md with:

  • Summary counts (alive / dead / clutter)
  • Entry points list
  • Alive files table (file -> imported by)
  • Dead files table (file -> type -> reason -> recommendation: DELETE / ARCHIVE / ASK USER)
  • Clutter items
  • Recommended actions (Safe / Moderate / Aggressive levels)

Phase 6: Confirm + act

Ask the user: "Quel niveau de cleanup tu veux?

  1. Safe only — clutter évident
  2. Moderate — clutter + dead code évident
  3. Aggressive — tout le dead code, projet lean
  4. Laisse-moi reviser le rapport d'abord"

Apply only what is approved. Move ambiguous items to archive/ instead of deleting.

Rules

  • NEVER delete without confirmation
  • Write the report BEFORE deleting anything
  • If unsure, mark ASK USER
  • Config / .env / data files are NOT dead even if not imported
  • Suggest a git commit before deletion to keep recovery easy

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.