eng-ai-slop-remover
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAI Slop Remover
AI Slop Remover
Remove AI-generated code patterns that are inconsistent with human-written code in the codebase.
移除代码库中与人类编写代码风格不一致的AI生成代码模式。
Workflow
工作流程
- Get the diff against main branch
- For each changed file, analyze patterns to remove
- Make edits to remove identified slop
- Report a 1-3 sentence summary of changes
- 获取与main分支的差异
- 对每个变更文件,分析需要移除的模式
- 进行编辑以移除识别出的冗余内容
- 用1-3句话总结变更内容
Step 1: Get the Diff
步骤1:获取差异
bash
git diff main --name-onlyThen view each changed file to understand existing code style.
bash
git diff main --name-only然后查看每个变更文件以了解现有代码风格。
Step 2: Identify AI Slop Patterns
步骤2:识别AI Slop模式
Comments to remove:
- Obvious or redundant comments explaining what code clearly does
- Comments that don't match the commenting style elsewhere in the file
- Section divider comments when not used elsewhere
Defensive code to remove:
- Try/catch blocks around code that doesn't throw or is already in a trusted path
- Null/undefined checks when callers guarantee valid input
- Type guards that duplicate earlier validation
- Redundant error handling when parent functions already handle it
Type issues to fix:
- Casts to that bypass TypeScript's type system
any - Type assertions that hide real type mismatches
- Overly broad generic types when specific types exist
Style inconsistencies:
- Naming conventions that differ from the file
- Spacing/formatting patterns that differ from the file
- Import organization that differs from the file
需要移除的注释:
- 解释代码明显功能的冗余注释
- 与文件中其他注释风格不符的注释
- 文件中未使用的分段分隔注释
需要移除的防御性代码:
- 围绕不会抛出异常或已在可信路径中的代码的try/catch块
- 当调用者保证输入有效的空值/未定义检查
- 重复早期验证的类型守卫
- 父函数已处理的冗余错误处理
需要修复的类型问题:
- 绕过TypeScript类型系统的转为的强制类型转换
any - 隐藏真实类型不匹配的类型断言
- 已有特定类型时使用的过于宽泛的泛型类型
风格不一致问题:
- 与文件命名约定不符的命名
- 与文件格式/间距模式不符的内容
- 与文件导入组织方式不符的导入
Step 3: Make Edits
步骤3:进行编辑
Remove identified patterns while preserving code functionality. Match the existing file's style.
移除识别出的模式,同时保留代码功能。匹配现有文件的风格。
Step 4: Report
步骤4:报告
End with only a 1-3 sentence summary of what was changed. No lists, no detailed breakdowns.
Example: "Removed 12 redundant comments and 3 unnecessary try/catch blocks across 4 files. Fixed 2 casts to any by using proper interface types."
最后仅用1-3句话总结变更内容。不要列表,不要详细分解。
示例:“在4个文件中移除了12条冗余注释和3个不必要的try/catch块。通过使用正确的接口类型修复了2处转为any的强制类型转换。”