Tidy the documents, code, generated artifacts, temporary files, and recovery state affected by this task; supports completion, blockage, or handoff. Ends with zero modifications when checks show no drift; does not expand into repo-wide cleanup.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Cleanup?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ysaa1-cleanup)
---
name: cleanup
description: "Tidy the documents, code, generated artifacts, temporary files, and recovery state affected by this task; supports completion, blockage, or handoff. Ends with zero modifications when checks show no drift; does not expand into repo-wide cleanup."
---
# Knowledge Cleanup
Align this task's records with the actual outcome. Completion, blockage, abandonment, and handoff can all be tidied up; recording unfinished work does not require ready first.
## Process
1. Identify this task/track and its authoritative entry; with no persistent task record, inspect the current diff directly. Multiple independent tracks can be active at the same time; do not modify other tracks to force a single work surface.
2. Check only the README, instructions, interface docs, generated artifacts, and existing recovery records affected by this change. Widen the scope only when evidence shows cross-document drift or the user asks for a full tidy-up.
3. Clean up code leftovers introduced by this task: dead code, unused imports and dependencies, superseded old implementations, orphan scripts, and stale generated artifacts. Deletion is decided by reference evidence; after deleting, run targeted checks to confirm behavior is unchanged. Cleanup that would change behavior routes to the `implement` fix path instead of being treated as pure tidying.
4. When a track closes (complete, abandoned, track switch), **close the track** in one commit: delete this track's row in `.harness/index.md` and its `tracks/<id>.md`, write the non-obvious lessons from this track's plan/Spec into `lessons.md` (none means nothing to write), and delete this track's plan and Spec documents (including unapproved and abandoned ones; git history is the archive, ADRs are kept). Before deleting documents, confirm the changes are committed to the main tree; otherwise git cannot bring them back. While the track stays open (blocked, paused, hand-off), edit only the `Status:`, `Evidence:`, and `Next:` lines of this track's `tracks/<id>.md`; leave `index.md` and other tracks' files alone. Format and rationale are in `../writing-for-agents/references/recovery_surface_policy.md`. When the project has `scripts/harness_lint.py`, run it once before committing and fix every ERROR (if another track still links a deleted document it reports the broken link — repoint it or keep the document). Non-harness backends: flip the tracker's native status to the matching terminal state and skip steps whose artifacts do not exist. Contents of existing archive directories (docs/archive/ and the like) go to the user for a decision; untracked files are not deleted — the outlets are adding a commit or a .gitignore entry.
5. Clean up scratch created by this task that no longer serves a purpose. Keep and explain files of unknown ownership or still in use; do not delete just because they are untracked, dated old, or temporarily named.
6. Generated artifacts are updated through existing generators and rebuilt only when inputs change. With no differences, finish with zero modifications. Newly hit pitfalls this time (environment, process, dependencies) go into the project recovery surface's lessons: filed under the matching topic `##`, each entry "trigger → pitfall → correct practice"; on a harness backend with no `lessons.md`, create it on first write; delete stale entries as encountered.
**Environment improvements** (same step as lessons): first read the repo's existing check entry points (check script, lint/typecheck commands, pre-commit, CI), then ask: if this session's mistake is **mechanical** (a fixed syntactic pattern, a banned API, an import shape, a file-location rule), propose a deterministic check first (a custom rule in the project linter, a pre-commit hook, a CI job, or a check-script assertion) rather than a written rule; only judgement calls go into standards docs or lessons. A check that already exists but sits unwired or broken is itself the finding; do not reinvent it. Also scan five candidate categories: navigation (slow to find files → add a navigation pointer), steering-file bloat (rules in AGENTS.md that belong in standards or checks, rules that change no behavior), tool economy (expensive calls that could be streamlined), information access (missing logs or read-only access), and missing correct test seams (from `diagnose`). Candidates are only listed in the report by severity; landing a check needs the user's authorization, and a hook is installed only when the user explicitly asks. Zero candidates is recorded as "nothing new".
7. Report the task status, modifications/archiving, kept items, and the recovery entry. Must not present cleanup completion as the original task being complete.
## Read on demand
- Stale plans: `references/doc-shelves.md`.
- Temporary-file ownership: `references/entropy-checklist.md`.
- Handoff: `references/handoff-hygiene.md`.
- Domain risks: `../review/references/cross-cutting-anti-patterns.md` (skip this reference when review is not installed; follow this file's process and evidence rules).
## Recommended next skill
- Tidy-up done: end.
- Authorized behavior changes remain: `implement`; unknown failures: `diagnose`.
- User explicitly requests repo-wide Python dead-code cleanup: `remove-deadcode-py`; for other ecosystems use the corresponding tool directly (knip for JS/TS, Go `deadcode`, cargo-machete for Rust).
- User explicitly requests repo-wide reconciliation/inventory/big cleanup, or cross-document drift is found, or the user asks for a full tidy-up: `sweep`.
- New work beyond the task: record as follow-up items; do not execute automatically.