{"slug":"code-simplifier-2","title":"code-simplifier","summary":"調用官方 code-simplifier agent 簡化程式碼。當使用者要求簡化、降低複雜度、清理冗餘，或執行 8 步開發迴圈步驟 3 時啟用。不適用於 PR 審查（用 code-reviewer）。","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-10-28T20:52:14.965614Z","repo":{"url":"https://github.com/kopp0510/claude-dd","stars":12,"forks":1,"license":"MIT","updatedAt":"2026-11-17T03:01:22Z"},"bodyHtml":"<hr>\n<h2>name: code-simplifier\ndescription: 調用官方 code-simplifier agent 簡化程式碼。當使用者要求簡化、降低複雜度、清理冗餘，或執行 8 步開發迴圈步驟 3 時啟用。不適用於 PR 審查（用 code-reviewer）。\nallowed-tools: Task, Bash, Read, Grep, Glob</h2>\n<h1>Code Simplifier — 官方 agent 包裝器</h1>\n<p>本 skill 只負責介面層：定範圍 → 調用官方 code-simplifier agent → 呈現結果。\n簡化邏輯全在 agent 內，不在此重複。</p>\n<h2>範圍決定</h2>\n<ul>\n<li><strong>8 步開發迴圈步驟 3</strong>（最常見）：範圍 = 該功能段落從起點到現在的變更（<code>git diff &lt;起點&gt;</code>，\n起點 = <code>~/.claude/scripts/check-claude-md.sh --segment-base</code> 的輸出），<strong>不詢問</strong>，直接執行。\n一段常有好幾個 commit，<code>HEAD~1</code> 只看得到最後一個；取不到起點（指令 exit 非 0 或輸出是空的）時當成「範圍不明」問一題，不要退回 <code>HEAD~1</code>。\n<strong>專案有 <code>task-planner</code> 進度表時例外</strong>：起點改用表上這段 commits 欄的起點。\n表在哪不用問 —— 根目錄 CLAUDE.md 第一個 <code>##</code> 之前的指路句會寫明檔名（通常在 <code>docs/designs/</code>）；\n沒有那句指路就是沒有進度表，照 <code>--segment-base</code> 走。回頭做 <code>BLOCKED</code> 過的段落時，\n中間插做別段會把 <code>--segment-base</code> 往後推，用它會漏掉這段先前已寫好的部分</li>\n<li><strong>使用者指明檔案/目錄/片段</strong>：照指示，不追問</li>\n<li><strong>範圍不明</strong>：問一題 —「要簡化哪個範圍？（預設：最近修改的檔案）」，其餘參數用預設</li>\n</ul>\n<p>預設不含測試檔；使用者要求才包含。</p>\n<h2>Agent 調用</h2>\n<p>依序嘗試 <code>subagent_type</code>：</p>\n<ol>\n<li><code>code-simplifier:code-simplifier</code>（plugin 命名空間）</li>\n<li><code>code-simplifier</code>（本地 <code>~/.claude/agents/code-simplifier.md</code>）</li>\n</ol>\n<p>兩者皆回 <code>Agent type not found</code> → 停下，請使用者跑 <code>./install-dd-pipeline.sh</code> 補齊。</p>\n<p>Prompt 模板：</p>\n<pre><code>請簡化以下程式碼，提高可讀性與可維護性，保留所有功能：\n\n範圍：{檔案清單或片段}\n\n重點：降低圈複雜度、改善命名、移除冗餘、簡化條件（early return、減少巢狀）。\n約束：不改公開 API 簽名；有測試必須全過。\n輸出：簡化摘要 + 關鍵變更的 Before/After 對比。\n</code></pre>\n<h2>結果呈現</h2>\n<p>轉述 agent 的簡化摘要與 Before/After 對比。統計數字<strong>只引用 agent 實際回報的</strong>，\n沒有就不列 — 禁止自行估算複雜度指標。</p>\n<p>簡化後提醒（在 8 步迴圈中則直接續行步驟 4）：用 <code>git diff</code> 審查變更，重跑測試確認行為不變。</p>\n<h2>範圍外</h2>\n<ul>\n<li>架構層重構（模組拆分、設計模式）、效能調校 — 超出簡化範疇，明說不做</li>\n<li>第三方 / 生成的程式碼 — 不修改</li>\n<li>效能關鍵段落 — 「看似複雜但高效」的寫法保留，標註說明即可</li>\n</ul>\n","files":[{"path":"SKILL.md","sizeBytes":3628,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-19T19:28:09.92669Z","sha256":"203C027A0949C2302BF27420E3F9187C3B1B91D640BB867FEBDD5B0DB5F88ECA","sizeBytes":2393},"review":null,"source":{"repositoryUrl":"https://github.com/kopp0510/claude-dd","path":"skills/code-simplifier","license":"MIT","commit":"2636b363ad6ccb9f2beb1972827ca61c1b33f8ee","subtreeSha":"0FB619052B13F1118E185C4B4C9BDEF636C8C6A50A1513A50DF01D6FE349B0A6","lastSyncedAt":"2026-11-19T19:27:31.713567Z"},"reviewedAt":"2026-11-19T19:46:21.520327Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/kopp0510/claude-dd/tree/main/skills/code-simplifier"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install kopp0510-claude-dd@llmmart"},{"target":"git","command":"git clone https://github.com/kopp0510/claude-dd.git"}]}