Help us improve
Share bugs, ideas, or general feedback.
From shavakan-commands
Comprehensive repository audit and cleanup (dead code, comments, docs, architecture, deps)
npx claudepluginhub shavakan/claude-marketplace --plugin shavakan-commandsHow this command is triggered — by the user, by Claude, or both
Slash command
/shavakan-commands:cleanupThe summary Claude sees in its command listing — used to decide when to auto-load this command
# Repository Cleanup Audit Scan the codebase for cleanup opportunities across all categories. Generate comprehensive report, then execute improvements based on user priorities. ## Prerequisites **Safety requirements:** 1. Git repository with clean working tree 2. All tests passing before cleanup 3. Backup branch created automatically 4. Test validation after each cleanup operation **Run prerequisite check:** This exports: `TEST_CMD`, `BACKUP_BRANCH`, `LOG_FILE` --- ## Additional Instructions $ARGUMENTS --- ## Objective Perform comprehensive audit of codebase for cleanup opportu...
/pruneDeep-cleans codebase by pruning dead code, redundancies, inefficiencies, and orphaned assets; trims CLAUDE.md files. Uses parallel agents for analysis, user approval per category, applies changes on new git branch, runs tests for regressions. Optional scope path.
/cleanupCleans up code and project structure by removing dead code, optimizing imports/files, with analysis, safe execution, validation, and summary report. Supports target path and --type, --safe, --interactive flags.
/sc-cleanupCleans up specified target: removes dead code, optimizes imports/structure. Supports --type code|imports|files|all, --safe|--aggressive|--interactive flags, produces summary report.
/cleanupDetects and safely removes dead code, unused imports/exports, unreachable branches, and dependencies in JS/TS, Python, Go, Rust. Outputs categorized findings with confidence; runs tests post-removal.
/cleanupCleans .a5c/runs and .a5c/processes: aggregates insights from old completed/failed runs into docs/run-history-insights.md and removes them plus orphans. Supports --dry-run and --keep-days N flags.
/cleanupRemoves temporary design lab files from .claude-design/ directory and Next.js/Vite preview routes after user confirmation. Reports deletions.
Share bugs, ideas, or general feedback.
Scan the codebase for cleanup opportunities across all categories. Generate comprehensive report, then execute improvements based on user priorities.
Safety requirements:
Run prerequisite check:
PLUGIN_ROOT="$HOME/.claude/plugins/marketplaces/shavakan"
if [[ ! "$PLUGIN_ROOT" =~ ^"$HOME"/.* ]]; then
echo "ERROR: Invalid plugin root path"
exit 1
fi
PREREQ_SCRIPT="$PLUGIN_ROOT/commands/cleanup/scripts/check-prerequisites.sh"
if [[ ! -f "$PREREQ_SCRIPT" ]]; then
echo "ERROR: Prerequisites script not found"
exit 1
fi
PREREQ_OUTPUT=$(mktemp)
if "$PREREQ_SCRIPT" > "$PREREQ_OUTPUT" 2>&1; then
source "$PREREQ_OUTPUT"
rm "$PREREQ_OUTPUT"
else
cat "$PREREQ_OUTPUT"
rm "$PREREQ_OUTPUT"
exit 1
fi
This exports: TEST_CMD, BACKUP_BRANCH, LOG_FILE
$ARGUMENTS
Perform comprehensive audit of codebase for cleanup opportunities across all categories, then execute selected improvements systematically.
Scan entire codebase for cleanup opportunities across all categories. For each category, identify issues with location, severity, and estimated impact.
Present audit findings grouped by category with counts. Include priority assessment:
Gate: User must review full audit before proceeding.
Present cleanup options with impact assessment:
Execute cleanup operations?
□ Critical only - Security fixes + blocking issues
□ Safe cleanups - Dead code + unused imports + obvious comments
□ Structural - Architecture + dead code + duplication
□ Full cleanup - All categories (comprehensive)
□ Custom - Select specific categories
□ Cancel
Gate: Get user approval on which categories to clean.
IMPORTANT: This command orchestrates by invoking specialized subcommands. Do not implement cleanup logic directly - use the subcommands:
/shavakan-commands:cleanup-deps/shavakan-commands:cleanup-architecture/shavakan-commands:cleanup-dead-code/shavakan-commands:cleanup-comments/shavakan-commands:cleanup-duplication/shavakan-commands:cleanup-docsExecution order: Security first, then structural improvements, then code quality, then documentation/maintenance.
Between each subcommand: Verify tests pass. If passing, proceed to next. If failing, rollback and report issue. User can cancel at any point.
Gate: Tests must pass after each subcommand before proceeding.
Summarize metrics (lines reduced, files removed, issues resolved), what was cleaned (by category with counts), impact analysis (code coverage maintained, build size reduced, maintainability improved).
Delete the backup branch after successful completion:
git branch -D "$BACKUP_BRANCH"
Note: All commits granular and revertable.
For safe automated fixes, execute:
Each fix tested independently. Rollback on any test failure. Commit each fix type separately.
CRITICAL:
Error handling: If cleanup fails, report which categories completed successfully (with commits), which category failed (with error), and offer options: skip failed category and continue, stop to investigate, or rollback all changes.
Review with code-reviewer agent before pushing:
Use shavakan-agents:code-reviewer to verify all changes.
Final verification: Run full test suite, check build succeeds, review commits, update CHANGELOG if significant changes.
/shavakan-commands:cleanup-dead-code - Remove unused code/shavakan-commands:cleanup-deps - Manage dependencies/shavakan-commands:cleanup-comments - Clean up comments/shavakan-commands:cleanup-docs - Fix documentation/shavakan-commands:cleanup-architecture - Refactor structure/shavakan-commands:cleanup-duplication - Remove duplication