From sc-refactor
Scans a codebase for AI session artifacts — debug statements, duplicate code, naming inconsistencies, and test gaps — then produces a prioritized cleanup report.
How this command is triggered — by the user, by Claude, or both
Slash command
/sc-refactor:sc-cleanup [target-directory]This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
Clean up the codebase at $ARGUMENTS (or current directory if not specified) after an AI coding session. ## Purpose AI coding sessions often leave behind artifacts: - Debug statements (`console.log`, `print()`, `debugger`, `binding.pry`) - Duplicate implementations (AI wrote new code instead of finding existing) - Inconsistent naming (AI used different conventions than the codebase) - Orphaned tests or missing test coverage - TODO/FIXME comments that should be resolved This command finds these issues so you can clean them up before committing. ## Phase 1: Launch Analysis Agents Launch 4...
Clean up the codebase at $ARGUMENTS (or current directory if not specified) after an AI coding session.
AI coding sessions often leave behind artifacts:
console.log, print(), debugger, binding.pry)This command finds these issues so you can clean them up before committing.
Launch 4 agents in parallel with run_in_background: true:
Task(subagent_type: "sc-refactor:sc-dead-code-detector", run_in_background: true,
prompt: "Analyze [target] for dead code and debug artifacts. Focus on:
- Debug statements (console.log, print, debugger, binding.pry, byebug)
- Stale TODO/FIXME/HACK/XXX comments
- Commented-out code blocks
- Unused imports")
Task(subagent_type: "sc-refactor:sc-duplication-hunter", run_in_background: true,
prompt: "Analyze [target] for code duplication. Focus on:
- Duplicate function implementations
- Copy-pasted code blocks
- Reimplemented utility functions")
Task(subagent_type: "sc-refactor:sc-naming-auditor", run_in_background: true,
prompt: "Analyze [target] for naming inconsistencies. Focus on:
- Convention violations vs established patterns
- Inconsistent casing or prefixes
- Names that don't match the domain language")
Task(subagent_type: "sc-refactor:sc-test-organizer", run_in_background: true,
prompt: "Analyze [target] test organization. Focus on:
- Missing tests for new code
- Orphaned test files
- Test/implementation file mismatches")
Wait for all agents to complete via task-notification messages. You MUST use the results delivered in task-notifications directly — do NOT call TaskOutput on completed background agents, as the task registry purges completed entries and TaskOutput will fail with "No task found".
Categorize findings:
# Post-Session Cleanup Report
## Immediate Fixes (before committing)
[Debug statements, obvious duplicates, broken tests]
## Should Address
[Naming inconsistencies, missing tests]
## Consider Later
[Minor duplication, stylistic issues]
## Findings Summary
- Dead code/debug: [count] issues
- Duplication: [count] issues
- Naming: [count] issues
- Test organization: [count] issues
Use AskUserQuestion:
| Option | Label | Description |
|---|---|---|
| auto-fix | Auto-fix immediate issues | Remove debug statements, delete dead code (max 15 changes) |
| fix-plan | Generate fix plan | Step-by-step instructions for each issue |
| report-only | Just the report | Output report and stop |
For each issue: File, Problem, Fix steps, Verification.
Output the report. Done.
npx claudepluginhub kylesnowschwartz/simpleclaude --plugin sc-refactor/ai-hygiene-auditAudits a codebase for AI-generated code quality issues including vibe coding, tab-completion bloat, and documentation slop. Produces a hygiene score and optional report file.
/codebase-healthRuns 6 parallel analysis agents to assess codebase health across structural, duplication, abstraction, naming, dead code, and test dimensions, producing a consolidated report with quick wins and recommendations.
/cleanupScans code for AI-typical patterns (curly quotes, em-dashes, emojis, AI phrases) and fixes them using configurable dogma rules or defaults.
/alRuns AgentLint diagnostic across all projects, checking six core dimensions (findability, instruction quality, workability, continuity, safety, harness) and optionally deep analysis to diagnose and fix issues.
/sc-cleanupAnalyzes and cleans up code, imports, and project structure with dead code detection, import optimization, and safety validation. Supports --type, --safe, --aggressive, and --interactive flags.