Execute codebase cleanup with safety gates — assess, confirm, remove, consolidate, archive, verify
Executes safe codebase cleanup with user approval gates for removing dead code, consolidating duplicates, and archiving stale files.
npx claudepluginhub jugrajsingh/skillgardenThis skill is limited to using the following tools:
Execute codebase cleanup with mandatory safety gates. Zero information loss — archive, never delete.
$ARGUMENTS = scope or path to previous assessment output.
If empty, ask via AskUserQuestion:
If no assessment exists:
tidyup:assessing skill to generate oneIf assessment provided:
Group candidates by action type:
| Action | Applies To |
|---|---|
| Remove | Dead code (unused imports, unreferenced functions, commented-out code) |
| Consolidate | Duplicate code blocks |
| Archive | Stale documentation, obsolete files |
Present each candidate via AskUserQuestion with multiSelect: true.
Format each option as: [severity] action: file:line — description
Example options:
[major] Remove: src/utils.py:45 — unreferenced function parse_legacy()[minor] Remove: src/api.py:3 — unused import os[major] Consolidate: src/a.py:20 + src/b.py:30 — duplicate validation logic[minor] Archive: docs/old-api.md — not modified in 80 commitsCRITICAL: Never auto-execute cleanup. Always get explicit user approval for every item.
For each approved removal, execute in order:
from x import a, b, c), remove only the unused nameAfter each removal:
# Sanity check — search for broken references
grep -r "removed_name" --include="*.py" --include="*.ts" --include="*.js" .
If references found, revert the change and report to user.
For each approved consolidation:
Decision criteria:
After each consolidation:
# Verify all references resolve
grep -rn "function_name" --include="*.py" --include="*.ts" --include="*.js" .
CRITICAL: Never delete files. Always archive.
mkdir -p .archive
If .archive is not in .gitignore, warn the user and suggest adding it.
For each approved archive:
Create the mirrored directory structure:
mkdir -p .archive/{original-directory-path}
Move the file:
git mv {original-path} .archive/{original-path}
If not git-tracked, use regular mv.
Update references:
After all archives, create or update .archive/MANIFEST.md:
# Archive Manifest
| Original Path | Archived Date | Reason |
|---------------|---------------|--------|
| docs/old-api.md | {DATE} | Stale — not modified in 80 commits |
Detect the test runner from project configuration:
| File | Runner | Command |
|---|---|---|
| pytest.ini / pyproject.toml (pytest) | pytest | pytest |
| package.json | npm/yarn | npm test |
| Cargo.toml | cargo | cargo test |
| go.mod | go | go test ./... |
| Makefile (test target) | make | make test |
Run the detected test suite:
{TEST_COMMAND}
If tests fail after a change:
Identify which cleanup action caused the failure
Revert that specific change (re-read file from git):
git checkout -- {FILE}
Report the failure to user with details
Continue with remaining cleanup items
Use the template from templates/cleanup-report.md as the structure.
Fill in all sections:
## Cleanup Report: {SCOPE}
### Actions Taken
| Action | File | Type | Details |
|--------|------|------|---------|
| Removed | path:line | dead code | {description} |
| Consolidated | pathA + pathB | duplication | {description} |
| Archived | path -> .archive/path | stale | {description} |
### Metrics
- Lines removed: {N}
- Files archived: {N}
- Duplicates consolidated: {N}
### Test Results
- Suite: {runner}
- Status: {pass/fail}
- Tests: {passed}/{total}
### Verification
- All references intact
- Tests passing
- No information lost (archived, not deleted)
If any verification item fails, mark it and explain.
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.