removing-ai-slop
在清理分支上人工智能生成的代码时使用 - 识别并删除不必要的注释、防御性检查、类型转换以及与代码库不匹配的样式不一致
📖 中文导读:在清理分支上人工智能生成的代码时使用 - 识别并删除不必要的注释、防御性检查、类型转换以及与代码库不匹配的样式不一致 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: removing-ai-slop description: Use when cleaning up AI-generated code on a branch - identifies and removes unnecessary comments, defensive checks, type casts, and style inconsistencies that don't match the codebase
Removing AI Code Slop
Overview
Review the diff against main and remove AI-generated patterns that don't match the existing codebase style.
When to Use
- After AI-assisted coding sessions before merging
- When code review reveals "AI smell"
- Before submitting PRs with AI-generated changes
Workflow
Get the diff against main:
git diff main --name-onlyFor each changed file, review the diff and compare against the file's existing style
Remove slop patterns (see below)
Report a 1-3 sentence summary of changes
Slop Patterns to Remove
| Pattern | Example | Fix |
|---|---|---|
| Obvious comments | // increment counter above counter++ |
Delete |
| Defensive null checks | if (x !== null && x !== undefined) in trusted paths |
Remove if callers already validate |
| Redundant try/catch | Wrapping already-safe operations | Remove unless error handling needed |
as any casts |
(value as any).property |
Fix the actual type issue |
| Over-documented params | JSDoc for self-explanatory args | Delete or match file style |
| Unnecessary else | if (x) return; else { ... } |
Remove else, dedent |
| Verbose conditionals | if (condition === true) |
Simplify to if (condition) |
Style Consistency Checks
Before removing anything, check the file's existing patterns:
- Does this file use JSDoc? Match that level
- Does this file have defensive checks elsewhere? Match that style
- What's the comment density in unchanged code?
Rule: Match the file, not your preferences.
Common Mistakes
| Mistake | Why It's Wrong |
|---|---|
| Removing all comments | Some files have thorough documentation |
| Removing all error handling | Some codebases are defensive by design |
| Adding new slop while removing old | Stay focused on removal only |
Output Format
End with a brief summary:
Removed 3 redundant comments, 2 unnecessary null checks, and 1
as anycast insrc/utils.ts.