deslop
Remove AI-generated code slop from current branch. Identifies and removes inconsistent comments, over-defensive code patterns, and style mismatches introduced by AI. Use when: cleaning up AI-generated code, before committing AI changes, after code generation session.
When & Why to Use This Skill
The 'deslop' skill is a specialized developer utility designed to sanitize AI-generated code by identifying and removing 'slop'—redundant comments, over-defensive logic, and stylistic inconsistencies. By analyzing diffs against the default branch, it ensures that AI-assisted contributions maintain high code quality, reduce technical debt, and adhere strictly to established project conventions.
Use Cases
- Post-AI Generation Cleanup: Automatically strip away verbose or redundant comments and 'hallucinated' explanations often produced by LLMs after a heavy coding session.
- Pre-commit Quality Assurance: Run a final check before committing changes to ensure that AI-introduced patterns, such as excessive nil checks or unnecessary try-catch blocks, are aligned with the existing codebase's style.
- Refactoring AI Contributions: Standardize code structure by removing defensive programming patterns that are redundant within the context of the project's specific architecture.
- Streamlining Peer Reviews: Use the tool to clean up code before a human review, ensuring the reviewer focuses on logic rather than fixing AI-generated stylistic mismatches.
| name | deslop |
|---|---|
| description | > |
| Use when | cleaning up AI-generated code, before committing AI changes, |
| user-invocable | true |
Remove AI Code Slop
デフォルトブランチとの差分を確認し、このブランチで導入された AI 特有の冗長な記述を削除してください。
削除対象
- ファイル内の他のコードと整合性のないコメント
- コードベースの慣習にそぐわない防衛的コード(既存コードで同様のパターンがガードなしで動作している場合の過剰な nil チェック、不要な try/catch)
- ファイル全体のスタイルと矛盾する記述
手順
- デフォルトブランチを特定:
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'(失敗時は main を使用) git diff <default-branch>...HEADで変更箇所を把握- 各ファイルの既存スタイルを確認し、基準に基づき修正
- 変更内容を1〜3文で要約報告