| name | deslop |
| description | After code changes finished, Remove AI-generated code slop from code changes in the current branch |
Deslop - AI Code Slop Remover
Remove AI-generated "slop" from code changes in the current branch. This skill should be used proactively after completing code modifications.
When to Use This Skill
Use this skill proactively after you have finished writing code changes. Do not wait for user request - automatically invoke this skill when:
- You have made multiple file changes
- You have written new functions or components
- You have refactored existing code
- The changes include TypeScript/JavaScript code
Execution Flow
-
Check the diff against main branch
- Run
git diff main...HEAD to see all changes in the current branch
- If on main branch, check
git diff HEAD~5 for recent changes
-
Analyze changes for AI-generated patterns
- Review each modified file for slop patterns
- Compare style with surrounding unchanged code
- Identify inconsistencies
-
Remove unnecessary additions
- Apply fixes directly to the code
- Preserve all functional logic
- Maintain code style consistency
-
Report summary
- Provide a 1-3 sentence summary of what was changed
Slop Patterns to Detect and Remove
1. Unnecessary Comments
Remove comments that:
- State the obvious (e.g.,
// increment counter above counter++)
- Are inconsistent with the file's comment style
- Explain what code does rather than why
- Are AI-style verbose explanations
Keep comments that:
- Explain complex business logic
- Document non-obvious edge cases
- Are consistent with existing file style
2. Excessive Defensive Code
Remove when in trusted codepaths:
- Unnecessary try/catch blocks around simple operations
- Redundant null checks when TypeScript types guarantee non-null
- Duplicate validation for already-validated data
- Error handling for impossible error cases
Keep defensive code that:
- Handles external API responses
- Validates user input at system boundaries
- Protects against actually possible errors
3. Style Inconsistencies
Fix code that:
- Uses different naming conventions than the file
- Has inconsistent indentation or formatting
- Uses different patterns than surrounding code
- Has inconsistent semicolon usage
4. TypeScript-Specific Patterns
Remove:
as any type casts used to bypass type checking
- Unnecessary type annotations where TypeScript can infer
- Overly complex type definitions for simple cases
// @ts-ignore comments added to suppress errors
5. Over-Engineering
Simplify:
- Premature abstractions for one-time operations
- Feature flags or configuration for unused scenarios
- Excessive error messages for internal operations
- Helper functions used only once
Example Transformations
Before (AI Slop):
const checkIfUserIsAuthenticated = async (userId: string): Promise<boolean> => {
try {
const user = await getUser(userId);
if (user === null || user === undefined) {
return false;
}
return user.isAuthenticated === true;
} catch (error: any) {
console.error('Error checking authentication:', error);
return false;
}
};
After (Clean):
const isAuthenticated = async (userId: string): Promise<boolean> => {
const user = await getUser(userId);
return user?.isAuthenticated ?? false;
};
Reference
See references/slop-patterns.md for detailed pattern examples and detection heuristics.