Cleanup sprint
Open registry of community-contributed AI coding skills (SKILL.md files) — daily-synced to skills-hub.ai. Install across Claude Code, Cursor, Codex CLI, Windsurf, Copilot, and any MCP-compatible tool with one command.
npx -y skills add tinh2/skills-hub-registry --skill cleanup-sprintAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 8 stars8 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Deep codebase cleanup — kills dead code, fixes all lint/format warnings, removes orphaned files, cleans stale TODOs, strips security hazards, tightens TypeScript strict mode, and organizes imports. Triggers on: clean up, dead code, unused imports, lint, technical debt cleanup, spring cleaning, tidy up the codebase, remove dead code, code hygiene, declutter.
SKILL.md
12.4 KB, as published. Nobody here has run it
PARALLEL EXECUTION: Use the Agent tool to spawn cleanup specialists for independent categories.
- Agent A (Dead Code): "Find and remove dead code in this project: unused functions, unreachable code, unused variables, unused imports. Run tests after each removal to verify safety. Return: files modified, lines removed, test results."
- Agent B (Lint & Style): "Fix all lint warnings and style issues in this project. Run the project's linter/formatter. Organize imports. Return: files modified, issues fixed, categories."
- Agent C (Outdated Patterns): "Find and update outdated patterns in this project: deprecated API usage, old syntax, stale TODOs, outdated dependencies. Return: patterns found, updates applied, files modified."
- Wait for all agents to complete.
- Run the full test suite to verify all changes integrate cleanly.
- If tests fail, identify which agent's changes caused the failure and revert those specifically.
You are an autonomous codebase cleanup agent. Do NOT ask questions — detect the stack, clean up everything aggressively, and verify nothing broke.
Phase 0: Stack Detection
Before any cleanup, detect the project's language and tooling:
| Language | Lint Tool | Format Tool | Detection |
|---|---|---|---|
| TypeScript/JS | eslint | prettier | package.json, tsconfig.json |
| Rust | clippy | rustfmt | Cargo.toml |
| Go | golangci-lint | gofmt / goimports | go.mod |
| Python | ruff (preferred), flake8, pylint | ruff format, black | pyproject.toml, setup.py, requirements.txt |
| Ruby | rubocop | rubocop -a | Gemfile, .rubocop.yml |
| Java/Kotlin | checkstyle, ktlint | google-java-format, ktlint -F | pom.xml, build.gradle |
| Dart/Flutter | dart analyze, flutter analyze | dart format | pubspec.yaml |
| C/C++ | clang-tidy | clang-format | CMakeLists.txt, Makefile |
Use whatever tools are already configured in the project. If multiple are available, prefer the one with an existing config file (e.g., .eslintrc, ruff.toml, .clang-format).
Run the project's test suite once before making any changes to establish a green baseline. If tests fail before cleanup, note the failures and do not count them as regressions.
Phase 1: Dead Code Removal
Find and remove code that is never executed:
- Unused exports — functions, classes, constants, and types exported but never imported anywhere in the codebase. Use grep/ripgrep to verify zero import references before removing.
- Unused variables and parameters — that are not part of a public API or interface contract.
- Commented-out code blocks — actual dead code in comments, NOT explanatory comments. If a block is 3+ lines of syntactically valid code inside a comment, remove it.
- Unreachable code — code after unconditional
return,throw,break,continue,sys.exit(),os.Exit(). - Empty files — files with only imports/includes and no exports or side effects.
- Orphaned files — use git history + import analysis to find files not imported by anything:
- Search all source files for import/require/include references to each file.
- Check
git log --diff-filter=M --since="6 months ago" -- <file>— if a file has zero imports AND zero recent modifications, it is dead. - Check for dynamic imports, route configs, and entry points before deleting (some files are used without explicit imports).
Verify after removals: run tests, run build.
Phase 2: Safe Deletions
Find and remove orphaned project artifacts:
- Orphaned migrations — migration files that have already been applied and are superseded by later schema changes. Do NOT delete if the project uses sequential migration runners.
- Stale config files — config files for tools no longer in
devDependenciesor the project (e.g.,.babelrcwhen the project uses SWC, old.travis.ymlwhen using GitHub Actions). - Leftover generated files — build artifacts,
.DS_Store,Thumbs.db,*.pyc,__pycache__/not in.gitignore. - Duplicate type definitions — types/interfaces defined in multiple places that are identical or near-identical. Consolidate to a single source of truth.
- Dead test fixtures/snapshots — test fixtures, snapshots, or mock data files that are no longer referenced by any test.
Add any missing entries to .gitignore for generated file patterns found.
Phase 3: Resolved TODO/FIXME/HACK Cleanup
Scan all source files for TODO, FIXME, HACK, XXX, and WORKAROUND comments:
- For each one, check if the issue it describes has already been resolved in the surrounding code.
- If the TODO references a ticket/issue number, check if the feature/fix is already implemented.
- Remove resolved TODOs. For unresolved ones, leave them but collect them in the report.
- Remove
HACK/WORKAROUNDcomments where the workaround has been replaced with a proper implementation.
Phase 4: Security Cleanup
Scan for and remove security hazards that should not be in production code:
- Debug logging with sensitive data —
console.log,print,log.debugcalls that output tokens, passwords, user data, request bodies, or full error stacks. Remove or replace with sanitized logging. - Debug/test endpoints — routes like
/debug,/test,/admin/reset, or any endpoint guarded only byif (process.env.NODE_ENV !== 'production')that leaks internal state. - Hardcoded credentials — test API keys, passwords like
password123, tokens, or secrets in source files (not.env). Replace with environment variable references. - Overly permissive CORS —
Access-Control-Allow-Origin: *in production config. - Disabled security checks — commented-out auth middleware,
// eslint-disable-next-line,# nosec,@SuppressWarningsfor security rules. - Leftover test/seed data — hardcoded test user emails, phone numbers, or accounts in non-test files.
Do NOT remove legitimate debug tooling that is properly gated behind environment checks.
Phase 5: Lint & Format
Fix all linter warnings and formatting issues using the tools detected in Phase 0:
- Run the project's linter with auto-fix enabled first (e.g.,
eslint --fix,ruff check --fix,clippy --fix,rubocop -a,dart fix --apply). - Manually fix remaining warnings that auto-fix could not resolve.
- Run the formatter (e.g.,
prettier --write,ruff format,rustfmt,gofmt,dart format,clang-format). - For warnings that are intentionally suppressed with inline comments, leave them if there is an explanatory comment. Remove bare suppression comments with no explanation.
Phase 6: TypeScript Strict Mode (TypeScript projects only)
If the project uses TypeScript, check tsconfig.json for strict mode gaps:
- If
strictis nottrue, enable individual strict flags incrementally:noImplicitAny— add explicit types whereanyis inferred.strictNullChecks— add null guards and optional chaining.noUnusedLocalsandnoUnusedParameters— remove unused code or prefix with_.strictPropertyInitialization— add definite assignment assertions or initialize in constructor.
- Fix all resulting type errors. Do NOT use
as anyor@ts-ignoreas fixes — those defeat the purpose. - If enabling full
strict: truewould require 50+ changes, enable the flags one at a time and fix each batch. Report which flags were enabled and which remain.
Phase 7: Import Organization
Clean up imports across all files:
- Remove unused imports.
- Sort imports by convention: stdlib/builtin first, then external packages, then internal modules. Match existing project conventions if an import order is already established.
- Consolidate duplicate imports from the same module.
- Replace wildcard/star imports with named imports where the wildcard pulls in fewer than 10 names.
- For Go: run
goimports. For Python: useisortorruff's import sorting. For Dart: useimport_sorteror manual alphabetical ordering.
Phase 8: Dependency Cleanup
- Check for unused dependencies in the package manifest (
package.json,Cargo.toml,pyproject.toml,Gemfile,pubspec.yaml,go.mod). - Check for duplicate dependencies (different versions of the same package, or packages that provide identical functionality).
- Remove dev dependencies that are not referenced in any script, test, or config file.
- Do NOT auto-update versions — that is out of scope for cleanup.
Phase 9: Final Verification
Run the full verification suite:
- All tests pass (compare against Phase 0 baseline — no new failures).
- Build succeeds.
- Linter reports zero warnings (or fewer than baseline).
- No behavior changes — only cleanup.
If any test fails that passed in the baseline, revert the change that caused it and note it in the report.
Commit Strategy
Commit in focused, atomic batches with tagged prefixes:
chore(dead-code): remove N unused exports and orphaned fileschore(safe-delete): remove stale configs and orphaned fixtureschore(todo): remove N resolved TODO/FIXME commentschore(security): strip debug logging and hardcoded credentialschore(lint): fix N lint warnings and format all fileschore(types): enable strictNullChecks and fix type errorschore(imports): organize and deduplicate importschore(deps): remove N unused dependencies
Each commit must independently pass tests. Do not batch unrelated changes.
============================================================ SELF-HEALING VALIDATION (max 3 iterations)
After completing all phases, validate the combined output:
- Re-run the specific checks that originally found issues to confirm fixes.
- Run the project's test suite to verify fixes didn't introduce regressions.
- Run build/compile to confirm no breakage.
- If new issues surfaced from fixes, add them to the fix queue.
- Repeat the fix-validate cycle up to 3 iterations total.
STOP when:
- Zero Critical/High issues remain
- Build and tests pass
- No new issues introduced by fixes
IF STILL FAILING after 3 iterations:
- Document remaining issues with full context
- Classify as requiring manual intervention or architectural changes
Output
Cleanup Sprint Report
=====================
Stack: <language> | Lint: <tool> | Format: <tool>
Dead Code:
- Files removed: <N>
- Unused exports removed: <N>
- Commented code blocks removed: <N>
- Unreachable code blocks removed: <N>
Safe Deletions:
- Orphaned files removed: <N>
- Stale config files removed: <N>
- Dead test fixtures/snapshots removed: <N>
TODOs:
- Resolved TODOs removed: <N>
- Unresolved TODOs remaining: <N> (see list below)
Security:
- Debug logging stripped: <N>
- Hardcoded credentials removed: <N>
- Other security fixes: <N>
Lint & Format:
- Warnings fixed: <N>
- Remaining: <N> (with reasons)
TypeScript Strict Mode:
- Flags enabled: <list>
- Type errors fixed: <N>
- Flags deferred: <list> (with reasons)
Imports:
- Files cleaned: <N>
- Unused imports removed: <N>
Dependencies:
- Unused removed: <N>
Verification: Tests <pass/fail> | Build <pass/fail> | Lint <pass/fail>
Lines removed: <N> net
Commits created: <N>
Unresolved TODOs:
- <file>:<line> — <TODO text>
- ...
============================================================ SELF-EVOLUTION TELEMETRY
After producing output, record execution metadata for the /evolve pipeline.
Check if a project memory directory exists:
- Look for the project path in
~/.claude/projects/ - If found, append to
skill-telemetry.mdin that memory directory
Entry format:
### /cleanup-sprint — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}
Only log if the memory directory exists. Skip silently if not found. Keep entries concise — /evolve will parse these for skill improvement signals.