$npx -y skills add vibeeval/vibecosystem --skill ai-slop-cleanerPost-implementation cleanup that removes AI-generated bloat while preserving functionality. Runs pass-by-pass with test verification after each pass. Activate after kraken/spark complete a feature, or when a codebase needs hygiene work.
| 1 | # AI Slop Cleaner |
| 2 | |
| 3 | AI code generation produces working code. It also produces unnecessary code alongside it. This skill removes the unnecessary parts while keeping everything that matters. |
| 4 | |
| 5 | ## What Is "AI Slop"? |
| 6 | |
| 7 | AI slop is code that: |
| 8 | - Works, but shouldn't exist |
| 9 | - Adds complexity without adding value |
| 10 | - Was clearly generated to pad a response rather than solve a problem |
| 11 | - Suggests the author wasn't thinking, just generating |
| 12 | |
| 13 | Common slop categories and their signals: |
| 14 | |
| 15 | | Category | Signal | |
| 16 | |----------|--------| |
| 17 | | Dead imports | Imported but never referenced in the file | |
| 18 | | Unused variables | Declared, never read | |
| 19 | | Commented-out code | Blocks of `// old code` or `/* removed */` | |
| 20 | | Debug remnants | `console.log`, `print()`, `debugger`, `fmt.Println` | |
| 21 | | Obvious comments | `// increment counter` above `count++` | |
| 22 | | Redundant JSDoc | `@param name - the name` above `name: string` | |
| 23 | | Premature abstractions | A factory that creates exactly one thing | |
| 24 | | One-use helpers | Private function called exactly once, trivially inlinable | |
| 25 | | Overly generic types | `<T extends object>` when `T` is always `User` | |
| 26 | | Over-parameterized | `fn(a, b, c, d, e)` where 4 params never vary | |
| 27 | | Unreachable branches | `if (false)` or `if (isLoggedIn && !isLoggedIn)` | |
| 28 | | Speculative features | Code paths for requirements that don't exist | |
| 29 | | Copy-paste duplication | Two blocks identical except one variable name | |
| 30 | | Placeholder remnants | `TODO: implement`, lorem ipsum, example data in prod | |
| 31 | |
| 32 | ## The Prime Directive |
| 33 | |
| 34 | **Tests are sacred. Never clean test files.** |
| 35 | |
| 36 | Tests exist to protect behavior. Any cleanup that breaks a test reveals that the "slop" was actually load-bearing. That is good information. The test wins. |
| 37 | |
| 38 | ## Regression-Safe Workflow (Non-Negotiable) |
| 39 | |
| 40 | ``` |
| 41 | BEFORE ANYTHING: Run full test suite → all tests must pass (baseline) |
| 42 | |
| 43 | FOR EACH PASS: |
| 44 | 1. Identify targets for this pass category |
| 45 | 2. Apply cleanup |
| 46 | 3. Run tests |
| 47 | 4. If tests pass: keep cleanup, continue |
| 48 | 5. If tests fail: git checkout -- . (revert), skip this pass category |
| 49 | 6. Log what was reverted and why |
| 50 | |
| 51 | AFTER ALL PASSES: Run full test suite → confirm all tests still pass |
| 52 | Report: lines removed, files touched, passes skipped, reason for each skip |
| 53 | ``` |
| 54 | |
| 55 | Never batch multiple pass categories together. If combined changes break a test, you cannot know which change caused it. |
| 56 | |
| 57 | ## The 7 Cleaning Passes |
| 58 | |
| 59 | ### Pass 1: Dead Imports and Unused Variables |
| 60 | |
| 61 | **Risk: Very Low** |
| 62 | |
| 63 | What to remove: |
| 64 | - Import statements where the imported name never appears in the file body |
| 65 | - Variables declared with `let`/`const`/`var` that are never read after assignment |
| 66 | - Function parameters that are never referenced inside the function body (TypeScript: prefix with `_`) |
| 67 | |
| 68 | Before: |
| 69 | ```typescript |
| 70 | import { useState, useEffect, useCallback, useMemo } from 'react' |
| 71 | import { formatDate } from '@/lib/utils' |
| 72 | import { ApiClient } from '@/lib/api' |
| 73 | |
| 74 | export function UserCard({ user }) { |
| 75 | const [count, setCount] = useState(0) |
| 76 | const formatted = formatDate(user.createdAt) |
| 77 | |
| 78 | return <div>{user.name}</div> |
| 79 | } |
| 80 | ``` |
| 81 | |
| 82 | After: |
| 83 | ```typescript |
| 84 | import { useState } from 'react' |
| 85 | import { formatDate } from '@/lib/utils' |
| 86 | |
| 87 | export function UserCard({ user }) { |
| 88 | const [count, setCount] = useState(0) |
| 89 | const formatted = formatDate(user.createdAt) |
| 90 | |
| 91 | return <div>{user.name}</div> |
| 92 | } |
| 93 | ``` |
| 94 | |
| 95 | Note: `count`, `setCount`, and `formatted` are still present because they may be used elsewhere in a larger component. Pass 1 only removes imports. |
| 96 | |
| 97 | ### Pass 2: Commented-Out Code and Debug Statements |
| 98 | |
| 99 | **Risk: Very Low** |
| 100 | |
| 101 | What to remove: |
| 102 | - Any block of commented-out code that is not an active TODO or architectural note |
| 103 | - `console.log`, `console.debug`, `console.warn` (unless it is a legitimate error logger) |
| 104 | - `debugger` statements |
| 105 | - `print()` in Python when not serving as actual program output |
| 106 | - `fmt.Println` in Go debug instrumentation |
| 107 | |
| 108 | Before: |
| 109 | ```typescript |
| 110 | async function processOrder(orderId: string) { |
| 111 | console.log('processing order', orderId) |
| 112 | const order = await db.orders.findById(orderId) |
| 113 | // const cached = await cache.get(orderId) |
| 114 | // if (cached) return cached |
| 115 | console.log('order fetched:', order) |
| 116 | |
| 117 | const result = await payments.charge(order) |
| 118 | // TODO: add retry logic here |
| 119 | // console.log('charge result', result) |
| 120 | |
| 121 | return result |
| 122 | } |
| 123 | ``` |
| 124 | |
| 125 | After: |
| 126 | ```typescript |
| 127 | async function processOrder(orderId: string) { |
| 128 | const order = await db.orders.findById(orderId) |
| 129 | |
| 130 | const result = await payments.charge(order) |
| 131 | // TODO: add retry logic here |
| 132 | |
| 133 | return result |
| 134 | } |
| 135 | ``` |
| 136 | |
| 137 | Rule: `// TODO:` comments are preserved. They are documentation of known gaps, not slop. |
| 138 | |
| 139 | ### Pass 3: Obvious Comments and Redundant Documentation |
| 140 | |
| 141 | **Risk: Low** |
| 142 | |
| 143 | What to remove: |
| 144 | - Comments that restate the code i |