Remove AI-generated code slop from current branch
Removes AI-generated code slop from your branch diff. Cleans up over-commenting, redundant checks, type casts, and style inconsistencies to match existing code patterns.
/plugin marketplace add benshapyro/cadre-devkit-claude/plugin install benshapyro-cadre-devkit-claude@benshapyro/cadre-devkit-claudeCheck the diff against main and remove all AI-generated slop introduced in this branch.
AI-generated code often has tells that make it look unnatural:
// BAD: AI slop
// Get the user from the database
const user = await db.getUser(id); // Fetch user by ID
// GOOD: Self-documenting, no comment needed
const user = await db.getUser(id);
// BAD: Unnecessary defensive checks
function processUser(user: User) {
if (!user) {
throw new Error('User is required');
}
if (!user.id) {
throw new Error('User must have an id');
}
// ... when caller already validates
}
// GOOD: Trust internal callers
function processUser(user: User) {
// Just do the work - caller handles validation
}
// BAD: Casting to escape type issues
const data = response as any;
const items = (result as unknown as Item[]);
// GOOD: Fix the actual type
const data: ResponseType = response;
// BAD: Wrapping things that don't throw
try {
const x = a + b;
return x;
} catch (error) {
console.error('Failed to add numbers', error);
throw error;
}
// GOOD: Just do it
return a + b;
// BAD: Logging everything
console.log('Starting process...');
console.log('User ID:', userId);
console.log('Processing...');
console.log('Done!');
// GOOD: Log meaningful events only (or nothing for simple ops)
git diff main...HEAD
Identify all files changed in this branch.
Look for code that:
any or type assertionsRemove or adjust:
Use Edit tool to make changes.
End with a 1-3 sentence summary only:
Removed 4 unnecessary comments, 2 redundant null checks, and fixed
1 `any` cast in UserService.ts. Deleted try/catch wrapper in
processPayment() since the caller handles errors.
Before (AI slop):
/**
* Fetches user data from the database
* @param userId - The ID of the user to fetch
* @returns The user object or null if not found
*/
async function getUser(userId: string): Promise<User | null> {
// Validate the user ID
if (!userId) {
throw new Error('userId is required');
}
try {
// Fetch the user from database
const user = await db.users.findOne({ id: userId });
// Return the user
return user as any as User;
} catch (error) {
// Log the error
console.error('Failed to fetch user:', error);
throw error;
}
}
After (cleaned):
async function getUser(userId: string): Promise<User | null> {
return db.users.findOne({ id: userId });
}
Report: "Removed JSDoc (file doesn't use it), deleted redundant userId validation (TypeScript enforces it), removed try/catch (caller handles errors), fixed any cast by using proper return type."