skills/code-quality/cleanup-slop/SKILL.md
Strip AI slop, narration comments, restated-code comments, in-motion notes, and stub markers. Preserves comments that explain WHY (workarounds, invariants, surprising behavior). Comment-only changes — never touches code logic. Use when the user asks to remove AI slop, clean up comments, strip narration, or remove unhelpful comments.
npx skillsauth add raintree-technology/claude-starter cleanup-slopInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Surgically remove unhelpful comments without touching code. The good comments — workarounds, invariants, citations, non-obvious WHYs — stay. The bad ones — restating code, narrating in-motion edits, AI-generated platitudes — go.
Core rule: a useful comment tells a future reader something they couldn't get by reading the code itself. Everything else is noise.
Use grep + heuristics. There's no perfect tool — this is mostly pattern matching.
A. Restated-code comments — comment says what the code already says.
# Look for comments immediately above a line where the comment is essentially the function/variable name in English
grep -rn --include="*.ts" --include="*.tsx" --include="*.py" --include="*.js" \
-B0 -A1 -E "^\s*(//|#) (Returns|Sets|Gets|Creates|Updates|Deletes|Removes|Adds|Imports|Exports|Initializes|Initialize|Render|Renders) " . > /tmp/restated.txt
B. In-motion narration — comments describing the edit, not the code.
grep -rn --include="*.ts" --include="*.tsx" --include="*.py" --include="*.js" --include="*.go" --include="*.rs" \
-E "(// |# )(removed|replaced|new approach|updated to|previously|was using|no longer|TODO\(?from claude|TODO\(?ai\)|generated by claude)" \
--exclude-dir=node_modules . > /tmp/narration.txt
C. Stub markers without TODO
grep -rn --include="*.ts" --include="*.tsx" --include="*.py" --include="*.js" \
-E "^\s*(//|#) (implementation here|your code here|fill in|replace this|placeholder)" . > /tmp/stubs.txt
D. AI platitudes — generic preamble that adds nothing.
grep -rn -E "(// |# )(This (function|class|method) (is|will|does|provides|handles|manages|allows))" \
--include="*.ts" --include="*.tsx" --include="*.py" --include="*.js" \
--exclude-dir=node_modules . > /tmp/platitudes.txt
E. Empty docstrings / pass with no real TODO
grep -rn --include="*.py" -B1 -A2 'pass\s*#\s*TODO\s*$' . > /tmp/empty-todo.txt
grep -rn --include="*.py" '"""\s*"""' . > /tmp/empty-docstring.txt
Even if they look formulaic, keep:
// see #1234, // fixes JIRA-456)// workaround for Safari bug, see ...)// caller must hold lock, // must run after middleware X)// this MUST stay sync — async breaks ordering)// @ts-expect-error, # type: ignore, // eslint-disable-next-line)Write .claude/cleanup-reports/cleanup-slop-{YYYY-MM-DD}.md:
# Comment Slop Assessment — YYYY-MM-DD
## Summary
- Comments scanned: N
- HIGH (delete): X
- Restated code: x1
- In-motion narration: x2
- Stub markers: x3
- AI platitudes: x4
- Empty docstrings: x5
- MEDIUM (review): Y — stale TODOs >6mo, generic JSDoc on internal funcs
- PRESERVED: Z — comments with citations, invariants, warnings
## Findings
### HIGH — `lib/format.ts:12`
```ts
// Returns the formatted string
function format(s: string): string { ... }
Action: delete the comment line.
services/user.ts:88// removed the old caching logic, now uses redis
async function getUser(id: string) { ... }
Action: delete (in-motion narration; the diff/git log records this).
apps/api/middleware/auth.ts:5// This middleware function handles authentication for incoming requests
Action: delete (AI platitude; the function name auth.ts and signature say it).
lib/parse.ts:34// TODO: handle edge case
Stale 8 months. Either resolve or add detail. Flag for human triage.
apps/api/middleware/auth.ts:42// MUST run before db middleware — db middleware reads c.var.user.
// Past incident: reordering crashed every authenticated request (see RUNBOOK.md).
Citation + invariant + war story. Exemplary comment, keep.
[2-3 paragraphs on the comment culture: heavy AI slop suggests recent AI-assisted code generation that wasn't reviewed. Lots of "removed X" suggests insufficient git-log discipline. Few useful WHY comments suggests engineers aren't capturing tribal knowledge.]
## Apply
**Auto-delete HIGH only. NEVER touch code logic.**
### Confidence rubric
**HIGH (delete the comment line):**
- Pattern A-E above, AND
- The comment is immediately above or beside code (not a section header)
- Removing it doesn't leave a dangling reference (no other comment refers to it)
**MEDIUM (report only):**
- Stale TODO/FIXME with no detail (>6 months by git blame)
- Generic JSDoc/docstring on internal functions (could be deleted but might satisfy a lint rule — let human decide)
- Comments that summarize a complex algorithm — usually useful, but if the algorithm is named (e.g., `quickselect`), summary may be redundant
**PRESERVE always:**
- Citations (issues, PRs, RFCs, specs)
- Invariants and load-bearing constraints
- Workaround explanations with reason
- License/copyright
- Type pragmas / lint disables
- JSDoc on public exports
### Execution
1. Use Edit to delete each HIGH comment line. Preserve indentation of surrounding code.
2. If a comment block is multi-line and ALL lines are slop, delete the whole block.
3. If a comment block has a slop preamble + a useful warning, delete only the slop preamble.
4. Single commit: `chore(cleanup): cleanup-slop — removed N unhelpful comments`.
## Verify
Comment changes can't break logic, but they can break:
- Doc generators (TypeDoc, Sphinx) if a JSDoc/docstring on a public API was removed
- Markdown extraction tools
```bash
# Lint catches some malformed-comment issues
npx @biomejs/biome check . 2>&1 || npx eslint . 2>&1
ruff check . 2>&1
# If docs build script exists, run it
npm run docs 2>/dev/null || true
If anything fails: revert that specific file and downgrade.
// @ts-..., // eslint-..., # type: ignore, # noqa pragmas.development
Whop platform expert for digital products, memberships, and community monetization. Covers memberships API, payments, courses, forums, webhooks, OAuth apps, and checkout integration. Build SaaS, course platforms, and gated communities. Triggers on Whop, memberships, digital products, course platform, community monetization, Whop API, license keys.
development
Token-Oriented Object Notation (TOON) format expert for 30-60% token savings on structured data. Auto-applies to arrays with 5+ items, tables, logs, API responses, database results. Supports tabular, inline, and expanded formats with comma/tab/pipe delimiters. Triggers on large JSON, data optimization, token reduction, structured data, arrays, tables, logs, metrics, TOON.
development
Plaid banking API expert for financial data integration. Covers Plaid Link, Auth (account/routing numbers), Transactions, Identity verification, Balance checking, and webhooks. Build fintech apps with bank connections, ACH transfers, and transaction history. Triggers on Plaid, banking API, Plaid Link, bank connection, ACH, financial data, transaction history.
development
Helius Solana RPC and API expert. High-performance infrastructure for Solana including RPC nodes, DAS API for NFTs/tokens, LaserStream real-time streaming, webhooks, Priority Fee API, Enhanced Transactions, and ZK Compression. Triggers on Helius, Solana RPC, DAS API, Digital Asset Standard, NFT metadata, Solana webhooks, priority fees, LaserStream, ZK compression.