Communitygithub.com

AI Slop Cleaner

清理 AI 生成的程式碼垃圾,採用回歸安全、刪除優先的工作流程,並可選審查者專用模式。

AI Slop Cleaner 是什麼?

這項技能專門用於清理 AI 生成的程式碼中常見的「垃圾」(slop),例如冗餘、過度抽象、重複邏輯或死程式碼,同時確保不改變原有行為。它採用「刪除優先」的工作流程,優先透過刪除而非新增來簡化程式碼,並在每次修改前先鎖定行為(例如撰寫回歸測試)以確保安全。支援標準清理模式與 `--review` 審查模式,後者讓審查者在不直接修改程式碼的情況下檢視清理計畫與結果,實現撰寫與審查的分離。此技能可與 Ralph 整合,僅清理會話中變更的檔案,並在清理後重新執行回歸驗證。

相容平台✓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 執行姿態

  • 除非使用者明確要求變更行為,否則保留行為。
  • 只要可行,優先使用聚焦的回歸測試鎖定行為。
  • 在編輯程式碼之前先撰寫清理計畫。
  • 偏好刪除而非新增。
  • 在引入新模式之前,先重複使用現有的工具與模式。
  • 除非使用者明確要求,否則避免新增相依套件。
  • 保持差異(diff)小、可逆轉,並專注於程式碼壞味道。
  • 保持簡潔且證據密集:檢查、編輯、驗證、報告。
  • 將新的使用者指示視為局部範圍更新,但不要捨棄先前未衝突的限制條件。

限定檔案列表使用

當呼叫者已知安全的清理範圍時,此技能可限定於明確的檔案列表或已變更的檔案範圍。

  • 適用情境: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. 一次執行一個專注於壞味道的階段

    • 第一階段:刪除死程式碼
    • 第二階段:移除重複邏輯
    • 第三階段:命名與錯誤處理清理
    • 第四階段:強化測試
    • 每個階段後重新執行針對性的驗證。
    • 不要將無關的重構捆綁到同一組編輯中。
  2. 執行品質閘門

    • 保持回歸測試通過。
    • 對受影響的區域執行相關的 lint、型別檢查以及單元/整合測試。
    • 在可用時執行現有的靜態或安全性檢查。
    • 如果某個閘門失敗,請修正問題或撤銷風險較高的清理,而非強行通過。
  3. 以證據密集的報告結尾 始終報告:

    • 已變更的檔案
    • 簡化項目
    • 行為鎖定 / 驗證執行
    • 剩餘風險

使用方式

  • /oh-my-claudecode:ai-slop-cleaner <目標>
  • /oh-my-claudecode:ai-slop-cleaner <目標> --review
  • /oh-my-claudecode:ai-slop-cleaner <檔案A> <檔案B> <檔案C>
  • 從 Ralph:僅對 Ralph 會話中變更的檔案執行清理器,然後返回 Ralph 進行清理後的回歸驗證

適用情境

適用: deslop 這個模組:太多包裝器、重複的輔助函式和死程式碼

適用: 清理 src/auth 中的 AI 垃圾,並在不改變行為的情況下收緊邊界

不適用: 重構 auth 以支援 SSO

不適用: 清理格式

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

相關技能