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.
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.
/plugin marketplace add mei28/claude-code/plugin install mei28-deslop-deslop@mei28/claude-codeIdentifies "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 review