Deslop code by shrinking interfaces, deleting cruft, and clarifying comments without changing behavior.
Step 1: Classify the slop to remove
Choose one or more categories before editing:
| Category | Typical signals | Reference |
|---|---|---|
| Interface bloat | Too many exports, broad parameter objects, weak contracts | ${CLAUDE_SKILL_ROOT}/references/interface-simplicity.md |
| Structural cruft | Dead code, stale flags, redundant adapters/helpers | ${CLAUDE_SKILL_ROOT}/references/cruft-removal.md |
| Comment slop | Comments restate code, stale comments, inconsistent terms | ${CLAUDE_SKILL_ROOT}/references/comment-clarity.md |
If multiple categories apply, read only those references.
Step 2: Lock invariants
Before making changes, state and preserve these invariants:
- Runtime behavior and externally visible outputs stay equivalent unless the user explicitly requests behavior changes.
- Public interfaces get smaller or clearer, never broader without a concrete requirement.
- New abstractions must prove reuse value; otherwise prefer direct composition.
Step 3: Apply hard guardrails
- Remove dead code when usage is absent or obsolete by contract.
- Collapse redundant wrappers/adapters that add indirection without value.
- Reduce exported surface area and tighten types/contracts at the consumer boundary.
- Replace dense cleverness with explicit control flow when readability improves.
- Delete or rewrite comments that narrate obvious code; keep comments that explain intent, constraints, and non-obvious tradeoffs.
- Keep terminology consistent across APIs, types, and comments.
Step 4: Verify behavior safety
- Run targeted tests for touched areas.
- Run typecheck or static checks relevant to the changes.
- If behavior might have shifted, call it out explicitly and stop for user confirmation before widening scope.
Step 5: Report anti-slop delta
Return a concise summary with these sections:
Interface reductions— removed/renamed exports, narrowed contracts.Cruft removals— dead code and obsolete indirection deleted.Comment cleanups— what was removed or rewritten and why.Behavior-safety checks— tests/checks run and outcome.Residual risks— any uncertainty or follow-up checks.
Exit Criteria
- Public surface area is smaller or clearer for the touched scope.
- Confirmed dead code in scope is removed.
- Remaining comments add non-obvious value.
- Verification evidence is provided.