AgentSkillsCN

deslop-code

通过对比主分支的差异来清理 AI 生成的代码更改,去除风格或结构上的痕迹(过度注释、不必要的防御性检查、try/catch 杂音、any-cast、风格不一致)。适用于被要求“去除 AI 代码残渣”、“使更改更人性化”或使分支的编辑与现有代码库规范保持一致时。

SKILL.md
--- frontmatter
name: deslop-code
description: Clean up AI-generated code changes by reviewing diffs against main and removing stylistic or structural artifacts (over-commenting, unnecessary defensive checks, try/catch noise, any-casts, inconsistent style). Use when asked to “remove AI code slop,” “humanize” changes, or align a branch’s edits with existing codebase conventions.

Deslop Code

Overview

Strip AI-generated artifacts from a branch by comparing against main and aligning edits with local conventions and surrounding code style.

Workflow

  1. Establish baseline
  • Use git diff against main to identify AI-introduced changes.
  • Review surrounding context in each file to understand local conventions.
  1. Remove slop patterns
  • Delete comments that read like explanations, narrations, or redundant restatements of code.
  • Remove defensive checks or try/catch blocks that are inconsistent with trusted code paths or nearby style.
  • Replace any-casts or similar type escapes with proper typing or remove them if unnecessary.
  • Normalize style to match the file (naming, ordering, error handling, control flow).
  1. Verify consistency
  • Ensure behavior remains unchanged unless removal requires a small refactor to restore intended behavior.
  • Keep changes minimal and localized; avoid refactors not needed for cleanup.
  1. Report
  • End response with a 1–3 sentence summary of what changed.