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
/plugin marketplace add rohitg00/pro-workflow
/plugin install pro-workflow@pro-workflowWhat 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
anycasts 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-workflow2Manually: put the files in place
.claude/commands/deslop.mdCall it with /deslop. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/deslop.mdCall it with /prompts:deslop. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/deslop.prompt.mdManually: put the files in place
.gemini/commands/deslop.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
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