Skip to main content
command CX Codex

deslop — Claude Code command: removes AI-generated code slop

The /deslop command cleans the current branch of unnecessary code added by AI: obvious comments, defensive try/catch blocks, one-off abstractions, and docstrings on unchanged functions.

MIT ★ 2,966 updated 2026-09-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add rohitg00/pro-workflow
/plugin install pro-workflow@pro-workflow
Open on GitHub

What deslop does

The command diffs the branch against main, scans for common slop patterns — obvious comments, any casts to bypass type issues, deep nesting instead of early returns, backwards-compatibility hacks (_vars, re-exports), features beyond what was requested — and removes them with minimal edits. After cleaning, it runs tests on changed files to verify behavior is intact.

Three similar lines beat a premature abstraction. The command does not rewrite code broadly; it strips the unnecessary, leaving logic untouched. Run it before committing or when code feels bloated after working with AI.

What it helps with

  • remove unnecessary comments and defensive blocks added by AI
  • strip any casts and one-off abstractions
  • delete docstrings and type annotations from unchanged code
  • verify behavior unchanged after cleaning

Example prompts for the agent

  • Clean the branch with /pro-workflow:deslop
  • Remove slop from the current branch before committing
  • Strip unnecessary code added by AI

How to install deslop

1Plugin marketplace

/plugin marketplace add rohitg00/pro-workflow
/plugin install pro-workflow@pro-workflow

2Manually: put the files in place

.claude/commands/deslop.md

Call it with /deslop. For all projects use ~/.claude/commands/

Questions about deslop

How to install deslop in Claude Code?

First /plugin marketplace add rohitg00/pro-workflow, then /plugin install pro-workflow@pro-workflow. The command lands in .claude/commands/deslop.md.

What does the deslop command do?

It scans the branch for common AI slop patterns — unnecessary comments, defensive blocks, one-off abstractions — and removes them while preserving behavior. After edits, it runs tests to confirm nothing broke.

When to run deslop?

Before committing, after AI-heavy sessions, or when code feels bloated. The command strips the unnecessary without rewriting logic.

Source text

deslop.md · MIT
---
description: Remove unnecessary AI-generated code while preserving behavior.
---

# /deslop - Remove AI Code Slop

Strip AI-generated slop from the current branch.

## Process

1. **Diff the branch against main:**
   ```bash
   git fetch origin main
   git diff origin/main...HEAD --stat
   git diff origin/main...HEAD
   ```

2. **Scan for slop patterns:**
   - Comments that state the obvious or don't match local style
   - Defensive try/catch blocks on trusted internal code paths
   - Casts to `any` used only to bypass type issues
   - Over-engineered abstractions for one-time operations
   - Deeply nested code that should use early returns
   - Backwards-compatibility hacks (renamed `_vars`, re-exports, `// removed` comments)
   - Features or "improvements" beyond what was requested
   - Docstrings and type annotations added to unchanged code
   - Error handling for scenarios that can't happen

3. **Apply minimal edits** to remove each slop instance.

4. **Verify behavior unchanged:**
   ```bash
   git diff origin/main...HEAD
   npm test -- --changed --passWithNoTests 2>&1 | tail -10
   ```

5. **Report** what was cleaned (1-3 sentences).

## Guardrails

- Keep behavior unchanged unless fixing a clear bug.
- Prefer minimal edits over broad rewrites.
- Three similar lines is better than a premature abstraction.
- Verify something is truly unused before removing it.

---

**Trigger:** Use when code feels bloated, before committing, after AI-heavy sessions, or when someone says "clean this up".

© Rohit Ghumare · MIT · rohitg00/pro-workflow

Similar slash commands

All slash commands for Code review and refactoring →

From the same set83

The whole set →
context-discipline The context-discipline rule sets limits for file reads, tool calls, and test-driven edits. It helps keep Claude Code from reopening unchanged files or polishing code after tests pass. CX Codex +1 ★ 2,966repo stars communication-style communication-style sets how Claude replies: short, no openers or praise, code before prose. Useful when agent answers drown in politeness. CX Codex +1 ★ 2,966repo stars search Runs full-text keyword searches across the pro-workflow learnings database. Helps recall previous mistakes and project rules while coding. CX Codex +1 ★ 2,966repo stars sprint-status sprint-status is a Claude Code command that summarizes active sessions and branches. Run it to resume work or check parallel sessions. CX Codex +1 ★ 2,966repo stars learn-rule learn-rule extracts session mistakes into one-line rules and saves them to your project memory after explicit confirmation. CX Codex +1 ★ 2,966repo stars wrap-up The wrap-up skill audits code changes, runs quality checks, and records what to pick up next. Use it when you are about to end a coding session. CX Codex +1 ★ 2,966repo stars incremental-verify incremental-verify keeps the agent on one failing test at a time: the smallest change that passes it, then a commit, before the next behavior starts. CX Codex +1 ★ 2,966repo stars token-efficiency token-efficiency cuts token burn in Claude Code by removing conversational filler, enforcing read-before-write, and stopping unwanted refactoring loops. CX Codex +1 ★ 2,966repo stars

Project sponsors

Companies that keep this analytics open