From deslop
Detects and removes unnecessary additions in AI-generated code, improving codebase consistency. Use when reviewing AI-generated code for over-engineering, excessive comments, or style inconsistencies.
How this command is triggered — by the user, by Claude, or both
Slash command
/deslop:deslopThe summary Claude sees in its command listing — used to decide when to auto-load this command
# Deslop - AI Code Cleanup Tool ## Purpose Identifies "unnecessary additions" in AI-generated code and improves it to match existing codebase style. ## Detection & Removal Targets ### 1. Excessive Comments - Redundant comments explaining obvious code - Line-by-line explanatory comments - Repetition of what the code clearly shows **Example**: ### 2. Over-Defensive Error Handling - Catching exceptions that cannot occur - Excessive validation - Unnecessary try-except blocks **Example**: ### 3. Unnecessary Abstractions - Helper functions used only once - Over-application of design pat...
Identifies "unnecessary additions" in AI-generated code and improves it to match existing codebase style.
Example:
# Get the user's name
name = user.get_name() # Call get_name method to retrieve username
# Check if name exists
if name: # Verify name is not empty
# Display the name
print(name) # Output name to console
Example:
try:
# Internal function with extremely low chance of exception
result = calculate_sum(a, b)
except Exception as e:
logger.error(f"Unexpected error: {e}")
return None
First, understand existing codebase patterns:
# Read key files to understand existing style
Read src/main.py
Read src/utils.py
Load the file to review:
Read src/new_feature.py
Analyze code from these perspectives:
Point out specific improvements and provide revised version:
## Improvement Points
### 1. Remove Excessive Comments
- Lines: 15-20
- Reason: Code is self-evident, comments unnecessary
- Fix: Remove comments, clarify function name if needed
### 2. Simplify Error Handling
- Lines: 45-52
- Reason: This function cannot throw exceptions
- Fix: Remove try-except block
### 3. Unify Naming Convention
- Variable: `userName` → `user_name`
- Reason: Existing code uses snake_case
Apply improvements based on suggestions.
graph TD
A[Read Existing Code] --> B[Read AI-Generated Code]
B --> C[Identify Style Differences]
C --> D[Detect Unnecessary Additions]
D --> E[Present Improvements]
E --> F[User Approval]
F --> G[Apply Fixes]
Analysis results presented in this format:
## Deslop Analysis Report
### Summary
- File Analyzed: src/new_feature.py
- Issues Detected: 5
- Recommended Changes: 3
### Details
#### 1. Excessive Comments (Priority: High)
- **Location**: Lines 15-25
- **Issue**: Each line has comments explaining code behavior
- **Reason**: Code itself is clear, comments are redundant
- **Fix**: Remove comments, rename function from `process_user_data` to `validate_and_save_user`
#### 2. Unnecessary Error Handling (Priority: Medium)
- **Location**: Lines 45-52
- **Issue**: Blanket try-except for internal function call
- **Reason**: This function is guaranteed not to throw exceptions
- **Fix**: Remove try-except block
### Improved Code
[Present revised code]
/review: General code review/security-review: Security-focused reviewnpx claudepluginhub mei28/claude-code --plugin deslop/deslopStrips AI-generated code slop from current branch: diffs against main, scans for patterns like obvious comments and over-engineering, applies minimal edits, verifies tests pass, reports changes.
/ai-hygiene-auditAudits codebase for AI-generated code issues: git patterns, duplication bloat, test deficits, doc slop. Outputs hygiene score and report; supports focus areas, thresholds, JSON.