{"data":{"slug":"discovered-e3652aa691c078a3b0b3579b62eb4b9d3f12c9a2a37cb5bb","title":"Repo Clean","summary":"Clean a repository of unused files and folders with evidence and owner approval, delivering a numbered list of candidates for deletion and the owner's selected deletions.","url":"https:\/\/skillshunter.net\/skills\/discovered-e3652aa691c078a3b0b3579b62eb4b9d3f12c9a2a37cb5bb","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-e3652aa691c078a3b0b3579b62eb4b9d3f12c9a2a37cb5bb","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-e3652aa691c078a3b0b3579b62eb4b9d3f12c9a2a37cb5bb.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-e3652aa691c078a3b0b3579b62eb4b9d3f12c9a2a37cb5bb\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"A git repository is required. Read the repository's instruction files (e.g., `AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING`, the README) for its checks, CI commands, and rules on what belongs in the repository. A rule there, such as \"plans are not committed,\" can move an unlinked document from NEEDS-DECISION to REMOVE. The session authorizes the deletion, which needs the owner's pick of numbers.","instructions":"---\nname: andino-repo-clean\ndescription: Use when asked to clean a repository of leftover whole files or folders (test output, coverage and build leftovers, caches, old plans, specs, trial notes, temporary reports), or to find which files nothing uses and are safe to delete. Operates under Andino Workflow governance.\n---\n\n# Clean a repository of files nothing uses, with proof and the owner's pick\n\nInternal method ID: `andino-repo-clean` (alias: `repo-clean`).\n\n> **Andino Workflow Member Skill**\n> Operates under Andino Workflow: proportional investigation, evidence-based\n> decisions, one durable checkpoint and clean handoff. Do not invoke the workflow\n> recursively. Loading this resource changes neither tools nor permissions.\n\n## Purpose\n\nRepositories collect files nobody reads any more: test and coverage output, caches, build\nleftovers, old plans and specs, trial notes, one-off reports. Removing them is easy; removing\nonly them is not. A filename search misses a template read through a path built at runtime, a\ndata file shipped by a package manifest and a page that only the docs-site nav links, and it\ncalls a folder \"in use\" when a test names it but never opens it. This skill works on whole files\nand folders. It finds what uses each candidate, shows the owner a numbered list with the evidence\nfor every row, deletes exactly the numbers the owner picks, and reports in chat. The deliverable\nis that list, the owner's pick, those deletions, and nothing new in the repository.\n\nBreaking the letter of a rule here is breaking its spirit. \"I kept the intent\" is not a way\naround any rule below.\n\n## Trigger and non-trigger\n\nUse when:\n\n- someone asks to clean a repository of leftovers: test or coverage output, build artifacts,\n  caches, logs, old plans, specs, trial notes, temporary reports;\n- someone asks which files are unused, stale or safe to delete;\n- someone gives you a list of paths to delete from the working tree.\n\nDo not select for:\n\n- Merged branches, stale worktrees or other Git refs: `git-skills`.\n- Dead code, unused functions or imports inside files: `code-simplification`.\n- Retiring an API, a feature, a dependency or a file that people outside the repository read:\n  `deprecation-and-migration`.\n- Freeing disk space outside the repository (global caches, container images): not this skill.\n\n## Select a resource, not a second lifecycle\n\nLoad only the resource the current step names. It runs inside this procedure and current\nauthority; it starts no second plan.\n\n| Current need | Resource | Skip when |\n| :--- | :--- | :--- |\n| Status commands, consumer mechanisms, the trial removal, file-open tracing, evidence levels, regenerability | [evidence](resources\/evidence.md) | Never before step 2 |\n| The list format, the question, applying the pick, the report and commit text | [list and apply](resources\/list-and-apply.md) | Never before step 5 |\n| One cleanup end to end | [worked example](resources\/worked-example.md) | The steps are already clear |\n\n## Prerequisites\n\n- A git repository. Without one, nothing can be recovered after a deletion: stop and say so.\n- Read the repository's instruction files (`AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING`, the README)\n  for its checks, its CI and its own rules on what belongs in the repository. A rule there, such\n  as \"plans are not committed\", can move an unlinked document from NEEDS-DECISION to REMOVE.\n- Note what the session authorizes. A deletion needs the owner's pick of numbers; a commit or a\n  push needs its own approval.\n\n## Procedure\n\nSeven steps, in order. Each ends with a **Done when** line.\n\n1. **Set the scope and the exclusions.** Find the repository root, its checks and the commands CI\n   runs. Build the exclusion set before you look at candidates: `.env*` files, anything that looks\n   like a credential or a key, tracked files with uncommitted changes, a submodule or any folder\n   with its own `.git`, symlinks, and paths outside the repository. Excluded paths are never\n   listed, moved or deleted. When the user names paths, those are the only candidates: skip\n   discovery, but still apply the exclusions, check each path by behaviour where step 4 can, and\n   re-check in step 6. Done when the root, the checks, the CI commands, the repository's own rules\n   and the exclusion set are written down.\n2. **Take the inventory.** Run `git ls-files`, `git status --porcelain --ignored` and\n   `git clean -ndX` (a dry run that only lists); the [status commands](resources\/evidence.md#status-commands)\n   cover the rest. Give each candidate a status: tracked, untracked and ignored, or untracked and\n   not ignored. For a path that is ignored and tracked at once, `git ls-files` wins: it is tracked.\n   Add the file count and size. Done when every candidate has a status, a file count and a size.\n3. **Search for consumers by mechanism.** For each candidate, search every mechanism in\n   [evidence](resources\/evidence.md#consumer-mechanisms): CI configuration, package manifests,\n   paths built at runtime, globs, tool configuration, entry-document links and the docs-site nav.\n   A grep for the filename is one search, not proof: it cannot see a glob or an assembled path.\n   Apply the official documentation rule: a document linked from an entry document (README,\n   `AGENTS.md`, `CLAUDE.md`, CONTEXT, CONTRIBUTING, a docs index) or the docs-site nav, a standard\n   governance file (LICENSE, NOTICE, SECURITY, CHANGELOG, CODEOWNERS, ADRs) or a file shipped in\n   the package is official and stays. An unlinked document goes to NEEDS-DECISION unless the\n   repository's own rule says that kind of file does not belong. Use knip or vulture when they are\n   already installed; never install them. Done when each candidate lists the mechanisms searched\n   and every consumer found, with its file and line.\n4. **Check by behaviour.** For tracked candidates, run a trial removal in a throwaway worktree\n   outside the repository: remove the candidates there, run the repository's checks and\n   the commands CI runs that can run locally, then remove the worktree ([recipe](resources\/evidence.md#trial-removal)).\n   If a check fails, split the batch until you find the file it needs; that file is KEEP, and you\n   never edit a check to make a removal pass. Where a trace is cheap, record which files the\n   checks open. Give each tracked candidate one evidence level: \"trial removal green with\n   <checks>\", \"never opened in a trace\", or \"static search only\". A passing trial removal never\n   proves non-use alone: a consumer by mechanism (a package manifest, the docs-site nav, readers\n   outside the repository) keeps the file whatever the trial says. An untracked candidate is not\n   in a fresh worktree, so its evidence is regenerability: it comes back only when a named command\n   in the repository produces it (a build script, a test runner option in its config); without one\n   it is personal data and not recoverable. Done when every tracked candidate has an evidence\n   level, every untracked one has its named command or \"no named command\", and the throwaway\n   worktree is gone.\n5. **Try to refute, then show the list.** For every row you would mark REMOVE, look once more for\n   the consumer a trial cannot see, and move the row when you find one. Then print the numbered\n   list in the [list and apply](resources\/list-and-apply.md#the-list) format, add `.gitignore`\n   proposals only for paths a named command regenerates, and ask one question: \"Which numbers\n   should I delete?\" Stop there. Done when the list is shown, nothing is deleted or moved, and the\n   question is asked.\n6. **Delete only the picked numbers.** Re-check each picked path right before deleting it: its\n   status, uncommitted changes, and any consumer added since the list. Skip a path that changed\n   and say why. Delete tracked paths with `git rm` and untracked paths with a plain delete. Never\n   move, copy, compress or back up a candidate. Done when exactly the picked paths are gone,\n   apart from skipped ones with their reason.\n7. **Verify and report in chat.** Rerun the checks. Run `git status --porcelain --ignored`, look\n   at the parent folder, and confirm you created no file in either. Report in chat what was\n   deleted, how each path comes back (a tracked path from git history; an untracked path from its\n   named command, or not recoverable), what was skipped and the check results. Offer the note for\n   the team as commit-message or pull-request text. Done when the report is in chat, the checks\n   ran after the deletion, and nothing was committed or pushed without approval.\n\n## Rules for every cleanup\n\n### Ask before deleting\n\nNothing is deleted until its number is picked. A request that names no paths (\"just delete it\",\n\"no need to ask\") is a request for a fast list, not approval: show the list sooner, then ask. A\nrequest that names paths approves those paths and no others. When the same request also asks\nthat nothing be lost for good, and a named path is untracked with no named command that\nregenerates it, those two instructions conflict: delete the other named paths, say which ones\ncannot come back, and ask before deleting those.\n\n### Delete, never archive\n\nAlways delete, never archive. Tracked files come back from git history; untracked files the owner\npicked are approved as gone. No cleanup report, note, state file or archive goes into the\nrepository or next to it: no `docs\/archive\/`, no cleanup summary, no tarball beside the\nrepository, no copy in a temp folder. The note for the team goes in chat, or into commit or\npull-request text the owner approves. Two excuses fail here every time:\na backup next to the repository is an archive, and an uncommitted note is still a report.\n\n### Untracked files\n\nAn untracked file that is not ignored gets one row per path and is marked not recoverable unless a\nnamed command regenerates it. Ignored caches that a named command regenerates (`__pycache__\/`,\n`.pytest_cache\/`, `node_modules\/`) may share one row per pattern. \"Can be regenerated\" without a\nnamed command that the repository's config confirms is a guess.\n\n### Never listed\n\n`.env*` files, credentials and keys, tracked files with uncommitted changes, and a submodule or\nnested repository are never listed and never touched, whatever the request says.\n\n### Evidence, not names\n\nA filename, a folder name, a date or \"looks unused\" is not evidence. Every row carries the\nmechanisms searched and its evidence. A test that names a path may never open it: read what the\ntest does with the path.\n\n### Stay in scope\n\nWhole files and folders only. Never edit code inside a file, never touch branches or worktrees\nother than your own throwaway one, never install tools, and never commit or push without the\nowner's approval.\n\n## Shortcuts that break a cleanup\n\n| Shortcut | What to do instead |\n| --- | --- |\n| \"The owner said just delete it, no questions.\" | The request names no paths. Show the list fast and ask which numbers. |\n| \"Without a backup the untracked files are lost for good, so I made one.\" | A backup next to the repository is an archive. If the owner also asked that nothing be lost, ask about those paths; otherwise they picked them as gone, so say so in the report. |\n| \"The project wants notes in the PR, so I left the note uncommitted in the repository.\" | An uncommitted note is still a report. Put it in chat or in the PR text. |\n| \"It can be regenerated by running the tests.\" | Name the command and check that the repository's config makes it produce that path. |\n| \"The test names this folder, so it is used.\" | Read whether the test opens it. A name in a list is not a read. |\n| \"Grep finds no reference, so it is unused.\" | A grep cannot see a glob, an assembled path, a manifest or the docs nav. Search by mechanism. |\n| \"The checks pass without it.\" | A passing trial removal never proves non-use alone. Check packaging, the docs nav and outside readers. |\n| \"These untracked files are all output; one yes covers the group.\" | One row per path for untracked files that are not ignored. |\n| \"The check only fails on a hard-coded path; I'll update the check.\" | Never edit a check to make a removal pass. The file is KEEP. |\n| \"I'll commit the cleanup while I'm at it.\" | A commit needs its own approval. Offer the commit text. |\n\n## Red flags\n\n- A delete, move or `git rm` before the owner picked numbers.\n- A tar, zip, copy or \"backup\" of a candidate anywhere.\n- A new file in the repository or its parent folder after the cleanup.\n- A row without evidence, or one whose only evidence is its name or age.\n- \"Can be regenerated\" with no named command.\n- A check edited during the trial removal.\n- `.env*`, a credential, a file with uncommitted changes or a submodule in the list.\n- A commit or push the owner did not approve.\n\n## Ownership and permission boundary\n\nAndino coordinates selection, shared progress and final status from evidence; this skill owns its\nprocedure, resources and checks, which coordinator brevity never truncates. Loading it grants no\nauthority: it deletes only the paths the owner picked, creates no file in the repository, and\nauthorizes no commit, push, merge, installation or external message. Branches and worktrees\nbelong to `git-skills`, code inside files to `code-simplification`, and public APIs and features\nto `deprecation-and-migration`.\n\n## Output\n\nBefore the pick: the list in the [list and apply](resources\/list-and-apply.md) format and one\nquestion. After the deletion, this report in chat:\n\n```text\nDeleted: <path> (tracked, back from git history); <path> (untracked, regenerated by <command>); <path> (untracked, not recoverable)\nSkipped: <path - what changed>, or \"none\"\nChecks after deletion: <command - result>\nKept: <path - the consumer or failing check that keeps it>, or \"as in the list\"\nProposed .gitignore lines: <pattern - the command that regenerates it>, or \"none\"\nTeam note: <commit-message or PR text, offered, not committed>\n```\n\n## Verification\n\nBefore you call the cleanup done, confirm:\n\n- [ ] the exclusion set was built before the list, and nothing in it was listed or touched;\n- [ ] every row names the mechanisms searched;\n- [ ] every tracked row has one evidence level, and only rows with a trial removal or a trace are\n      REMOVE;\n- [ ] every untracked row is its own row with its named command or \"not recoverable\", or an\n      ignored cache with a named command;\n- [ ] nothing was deleted before the owner picked numbers, and only those paths were deleted;\n- [ ] each picked path was re-checked right before its deletion;\n- [ ] no new file exists in the repository or its parent folder;\n- [ ] the checks ran after the deletion and the report is in chat;\n- [ ] nothing was committed or pushed without approval.\n\nThese checks are properties of one cleanup. How a given model follows this skill needs a real\nrun to show.\n\n## Worked example and anti-pattern\n\n[The worked example](resources\/worked-example.md) cleans a small Node service: a build folder\nregenerated by `npm run build`, coverage output, a committed load-test note, fixtures read through\na directory listing and a page that only the docs sidebar links, with the list, a pick of two\nnumbers, the re-check and the report.\n\nAnti-pattern: the agent picks files by name (`*PLAN*.md`, `*REPORT*.md`), moves them into\n`docs\/archive\/`, writes a cleanup summary beside them, and reports \"safe, no references found\"\nfrom a filename grep.\n\n## Fallback\n\n- Not a git repository: stop before listing; nothing could be recovered.\n- No checks and no CI commands that run locally: every tracked row is \"static search only\" and\n  goes to NEEDS-DECISION, never REMOVE.\n- The host cannot create a worktree or run the checks without installing something: install\n  nothing, say which evidence is missing, and mark those rows \"static search only\".\n- The owner cannot be reached: show the list and stop; delete nothing.\n\n## Local resources\n\n- [Evidence](resources\/evidence.md)\n- [List and apply](resources\/list-and-apply.md)\n- [Worked example](resources\/worked-example.md)\n- Notices and credits: [references\/license.md](references\/license.md).\n\n## Operational example (offline)\n\nThis fixture checks the order of decisions for one row: exclusions first, then consumers, then\nthe untracked rules, then the evidence level. It does not measure how well an agent searches.\n\n```python andino-operational-example\nimport os\n\nCREDENTIAL_HINTS = (\"credential\", \"secret\", \"token\", \"id_rsa\", \".pem\", \".key\")\n\n\ndef row_kind(path, tracked, dirty, ignored, nested_repo, consumers, evidence, regenerator):\n    name = path.rstrip(\"\/\").rsplit(\"\/\", 1)[-1].lower()\n    if name.startswith(\".env\") or any(hint in name for hint in CREDENTIAL_HINTS):\n        return \"exclude\"\n    if dirty or nested_repo:\n        return \"exclude\"\n    if consumers:\n        return \"keep\"\n    if not tracked:\n        return \"group\" if ignored and regenerator else \"decide\"\n    if evidence == \"static search only\":\n        return \"decide\"\n    return \"remove\"\n\n\nif __name__ == \"__main__\":\n    cases = {\n        \"env_file\": ((\".env.local\", False, False, True, False, [], \"\", None), \"exclude\"),\n        \"dirty\": ((\"CHANGES-draft.md\", True, True, False, False, [], \"trial\", None), \"exclude\"),\n        \"nested_repo\": ((\"vendor\/lib\/\", True, False, False, True, [], \"\", None), \"exclude\"),\n        \"packaged\": ((\"data\/rates.csv\", True, False, False, False, [\"MANIFEST.in:2\"], \"trial\", None), \"keep\"),\n        \"cache\": ((\".pytest_cache\/\", False, False, True, False, [], \"\", \"pytest\"), \"group\"),\n        \"notes\": ((\"my-notes.md\", False, False, False, False, [], \"\", None), \"decide\"),\n        \"no_checks\": ((\"docs\/old-plan.md\", True, False, False, False, [], \"static search only\", None), \"decide\"),\n        \"stale_plan\": ((\"docs\/old-plan.md\", True, False, False, False, [], \"trial\", None), \"remove\"),\n    }\n    for case, (args, expected) in cases.items():\n        assert row_kind(*args) == expected, case\n    raise SystemExit(1 if os.environ.get(\"ANDINO_NEGATIVE\") == \"1\" else 0)\n```\n\n## Provenance\n\nAdapted from buildwithclaude's `cleanup` skill (davepoon\/buildwithclaude\n`plugins\/all-skills\/skills\/cleanup`, commit b3c5e88) under the MIT license: one read-only scan,\nnumbered REMOVE, NEEDS-DECISION and KEEP groups, a single confirmation, deleting only the picked\nrows, and re-checking each row just before acting. Ideas, not text, come from Qwen Code's\n`find-simplifications` (QwenLM\/qwen-code, commit 2312b90, Apache-2.0): name every consumer by its\nmechanism, a search blind to that mechanism proves nothing, and survey from a throwaway worktree;\nand from Trail of Bits' `git-cleanup` (trailofbits\/skills, commit 123037e, CC-BY-SA-4.0): try to\ndisprove each delete recommendation, and \"looks stale\" is not evidence. Cortex's `repo-cleanup`\n(NickCrew\/claude-cortex, commit 46a6ada, MIT) is the counter-example: candidates chosen by\nfilename, moved into an archive folder, with a summary written into the repository. The evidence\nlevels, per-path approval for untracked files, the rule against any artifact in or beside the\nrepository, the official-documentation rule and the excuse table, drawn from a 2026-11-29\nbaseline run, are Andino additions. Notices and credits are in\n[references\/license.md](references\/license.md).\n","use_cases":["Cleaning a repository of test output, coverage reports, and build leftovers","Finding unused files and folders safe for deletion","Processing a list of paths provided by the user for deletion from the working tree"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/andinoferdi\/andino-skills\/blob\/639c62b294a835b77a167cc4af1aa1f306d0cc45\/skills\/andino-workflow\/skills\/repo-clean\/SKILL.md","source_commit":"639c62b294a835b77a167cc4af1aa1f306d0cc45","license":null,"version":null,"listing_approved_at":"2026-11-30","created_at":"2026-11-29T10:50:52.000000Z","updated_at":"2026-11-30T06:51:23.000000Z","seo_title":"Repo Clean - Remove Unused Files with Evidence and Owner Approval","seo_description":"Clean a repository of leftover files and folders with evidence-based decisions and owner approval. Operates under Andino Workflow governance.","seo_keywords":["repo clean","repository cleanup","delete unused files","evidence-based deletion","Andino Workflow"]}}