Communitygithub.com

AI Slop Cleaner

以回归安全、优先删除的工作流清理 AI 生成的代码垃圾,可选仅 Reviewer 模式。

AI Slop Cleaner 是什么?

AI Slop Cleaner 是一个专注于清理 AI 生成代码中“垃圾”(Slop)的技能,适用于 Claude Code、Codex 等平台。它能识别并消除代码中的冗余、重复、死代码、过度抽象和边界泄露等问题,同时严格保持原有行为不变。技能采用“先锁定行为、后编写计划、再按类型逐轮清理”的安全工作流,支持以 `--review` 模式进行仅审查(不直接修改)的二次检查,并可与 Ralph 等工具集成,仅在变更文件范围内执行清理。其设计目标是让 AI 生成的、功能正确但“感觉臃肿”的代码变得简洁、可维护且回归安全,避免在清理过程中引入新功能或意外行为变更。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Yeachan-Heo/oh-my-claudecode/tree/main/skills/ai-slop-cleaner

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

AI Slop Cleaner 是做什么的?

使用此技能清理 AI 生成的代码垃圾,同时避免范围漂移或改变预期行为。在 OMC 中,这是针对可工作但感觉臃肿、重复、测试薄弱或过度抽象的代码的限界清理工作流。

何时使用

在以下情况下使用此技能:

  • 用户明确说了 deslop、anti-slop 或 AI slop
  • 请求清理或重构感觉嘈杂、重复或过度抽象的代码
  • 后续实现遗留了重复逻辑、死代码、包装层、边界泄漏或薄弱的回归覆盖
  • 用户希望通过 --review 仅进行反垃圾审查
  • 目标是简化和清理,而非交付新功能

何时不使用

在以下情况下不要使用此技能:

  • 任务主要是构建新功能或产品变更
  • 用户希望进行广泛的重新设计而非增量清理
  • 请求是一般性重构,没有简化或反垃圾意图
  • 行为过于不明确,无法通过测试或具体的验证计划来保护

OMC 执行姿态

  • 除非用户明确要求行为变更,否则保持行为不变。
  • 尽可能首先用聚焦的回归测试锁定行为。
  • 在修改代码前编写清理计划。
  • 优先删除,而非添加。
  • 在引入新内容前,重用现有的工具和模式。
  • 避免新的依赖,除非用户明确要求。
  • 保持差异小、可逆、且针对气味。
  • 保持简洁和证据密集:检查、编辑、验证、报告。
  • 将新的用户指令视为局部范围更新,同时不放弃之前不冲突的约束。

限定文件列表使用

当调用者已经知道安全的清理范围时,此技能可以限定到明确的文件列表或变更文件范围。

  • 好的示例:oh-my-claudecode:ai-slop-cleaner skills/ralph/SKILL.md skills/ai-slop-cleaner/SKILL.md
  • 好的示例:一个 Ralph 会话仅传递该会话中变更的文件
  • 即使范围是短文件列表,也保持相同的回归安全工作流
  • 除非用户明确要求,否则不要将变更文件范围静默扩展为更广泛的清理工作

Ralph 集成

Ralph 可以调用此技能作为限界的审查后清理步骤。

  • 在该工作流中,清理器以标准模式(而非 --review)运行
  • 清理范围仅限于 Ralph 会话的变更文件
  • 清理步骤后,Ralph 在完成前重新运行回归验证
  • --review 仍作为仅审查者的后续模式,而非默认的 Ralph 集成路径

审查模式(--review)

--review 是在清理工作草稿完成后仅审查者的步骤。它的存在是为了在反垃圾工作中保持明确的编写者/审查者分离。

  • 编写者步骤:进行清理变更,并用测试锁定行为。
  • 审查者步骤:检查清理计划、变更文件和验证证据。
  • 同一个步骤不得在没有单独审查步骤的情况下既写入又自我批准高影响的清理。

在审查模式下:

  1. 不要一开始就编辑文件。
  2. 审查清理计划、变更文件和回归覆盖。
  3. 特别检查:
    • 遗留的死代码或未使用的导出
    • 应合并的重复逻辑
    • 仍然模糊边界的无意义包装器或抽象
    • 缺失的测试或薄弱的保持行为验证
    • 似乎无意中改变了行为的清理
  4. 给出审查者裁定,并列出后续需要完成的事项。
  5. 将需要修改的部分交还给单独的编写者步骤,而不是一步到位地修复并批准。

工作流

  1. 首先保护当前行为

    • 确定哪些内容必须保持不变。
    • 在编辑之前,添加或运行最窄范围的回归测试。
    • 如果测试不能先做,在触碰代码前明确记录验证计划。
  2. 在代码之前编写清理计划

    • 将步骤限定到所请求的文件或功能区域。
    • 列出要消除的具体气味。
    • 按照从最安全的删除到风险较高的合并的顺序安排工作。
  3. 在编辑前对垃圾进行分类

    • 重复 — 重复的逻辑、复制粘贴的分支、冗余的辅助函数
    • 死代码 — 未使用的代码、不可达的分支、陈旧标志、调试遗留物
    • 无意义的抽象 — 直通包装器、猜测性的间接层、单次使用的辅助层
    • 边界违规 — 隐藏的耦合、职责错位、错误层的导入或副作用
    • 缺失测试 — 行为未锁定、回归覆盖薄弱、边界情况空白
    • UI/设计默认值 — 使 AI 构建的界面感觉未经审查的通用视觉模式

UI/设计审查清单

将这些作为审查提示,而非绝对禁令。在具有明确理由的情况下,保留有意的品牌、可访问性、产品密度或设计系统选择。

  • 韩文可读性:标记正文字体设置在 11-12px 左右;韩语正文通常需要至少 14px,除非有经过验证的高密度数据例外。
  • 阴影节制:质疑每个表面、标志、背景、卡片或图标上的盒子阴影;仅在阴影用于明确层级或交互时才保留。
  • 内容层级:当标题已经传达了信息时,移除重复的眉题/标题/描述/额外的 <p> 填充;避免通用的表情符号徽章,除非它是产品风格的一部分。
  • 调色板理由:如果没有品牌或系统理由,质疑默认的 AI 蓝色/紫色调色板,特别是像 Tailwind 的 #3B82F6。
  • 布局节奏:当产品上下文受益于节奏、强调、不对称、轮播/弯曲处理或变化的卡片权重时,避免过度完美的 3 列或 4 列均匀网格。
  • 渐变节制:除非品牌明确拥有该视觉语言,否则淡化极端的渐变。
  1. 一次运行一个针对气味的步骤

    • 步骤 1:死代码删除
    • 步骤 2:重复移除
    • 步骤 3:命名和错误处理清理
    • 步骤 4:测试强化
    • 在每个步骤后重新运行针对性验证。
    • 不要将不相关的重构打包到同一编辑集中。
  2. 运行质量门

    • 保持回归测试通过。
    • 运行相关区域的 lint、类型检查和单元/集成测试。
    • 如果可用,运行现有的静态或安全检查。
    • 如果某个门失败,修复问题或撤销有风险的清理,而不是强行通过。
  3. 以证据密集的报告结束 始终报告:

    • 变更的文件
    • 简化内容
    • 行为锁定/验证运行
    • 剩余风险

使用方式

  • /oh-my-claudecode:ai-slop-cleaner <target>
  • /oh-my-claudecode:ai-slop-cleaner <target> --review
  • /oh-my-claudecode:ai-slop-cleaner <file-a> <file-b> <file-c>
  • 从 Ralph:对 Ralph 会话中仅变更的文件运行清理器,然后返回 Ralph 进行清理后的回归验证

良好示例

好: deslop this module: too many wrappers, duplicate helpers, and dead code

好: cleanup the AI slop in src/auth and tighten boundaries without changing behavior

差: refactor auth to support SSO

差: clean up formatting

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

agent-doc-discipline

Writing-time discipline for documents agents consume (the five surfaces, specs, tickets, .omc/skills/) — every rule checkable and carrying a why, steps before reference, one meaning in one home, no restating what the environment already says. Mandatory at drydock seed generation and the launch C5 sediment pass; opt-in for any other agent-facing doc edit. The companion of minimal-code-discipline: that one disciplines code, this one disciplines papers.

ask

Process-first advisor routing for Claude, Codex, Gemini, Antigravity, Grok, or Cursor via `omc ask`, with artifact capture and no raw CLI assembly

ask-navigator

Shipyard

autopilot

Full autonomous execution from idea to working code

autoresearch

Stateful single-mission improvement loop with strict evaluator contract, markdown decision logs, and max-runtime stop behavior

cancel

Cancel any active OMC mode (autopilot, ralph, ultragoal, swarm, ultrapilot, pipeline, team) and clean up retired legacy state

configure-notifications

Configure notification integrations (Telegram, Discord, Slack) via natural language

debug

Diagnose the current OMC session or repo state using logs, traces, state, and focused reproduction

deepinit

Deep codebase initialization with hierarchical AGENTS.md documentation

deep-interview

Socratic deep interview with mathematical ambiguity gating before explicit execution approval

drydock

Lay the keel of the shipyard harness in any repo — the 4-pillar shared environment (Context, Rules, Tools, Standards) across 5 surfaces (CLAUDE.md, skills, design-system, mcp/cli, shared context) so that every human and agent inherits the same design language and anyone can ship. Run once per repo; re-run with --check to audit drift.

execute

Carry an approved task through to working, verified code

external-context

Invoke parallel document-specialist agents for external web searches and documentation lookup

graph

Deterministic orchestration graph runtime - declarative DAG pipelines with journal-based crash recovery

harbor

Harbor intake for external work — the captain only handles unresolved decisions. Sweeps incoming issues and PRs, verifies every claim before disposition, reuses every decision already made, and hands the maintainer a docket whose pending items each carry one question with options, recommendation, impact and evidence. Agent-autonomous for facts and for actions covered by standing authorization; signed for every new judgment. Never merges.

hud

Configure HUD display options (layout, presets, display elements)

launch

Shipyard

loft

Loft the shape before cutting steel — answer a design question that prose cannot settle by building a throwaway artifact: a pure logic module in a clickable shell, or structurally different UI variants behind one route. The captain reacts to the artifact; the answer folds into the decision; the artifact never docks. Use when a design question stalls in words, when a navigator map carries a loft ticket, or when a spec discussion reaches

minimal-code-discipline

YAGNI-ladder coding discipline for writing changes — existence-first, reuse before writing, dependency ladder, shortest correct diff, with non-negotiables that must never be minimized away

omc-doctor

Diagnose and fix oh-my-claudecode installation issues

相关技能