| name | sweep |
| source | ../../../../skills/sweep/SKILL.md |
| source_version | 1.0.0 |
| translation_version | 1.0.0 |
| last_synced | "2026-05-28T00:00:00.000Z" |
| scope | universal |
| description | [UDS] 掃描程式庫的除錯殘留與程式碼品質問題;可自動修正安全模式。
Use when: before committing, during PR review, or periodic codebase cleanup.
Keywords: sweep, debug cleanup, console.log, debugger, TODO, ts-any, code quality, 掃描, 清理.
|
| allowed-tools | Read, Grep, Glob, Bash(find:*), Edit, Write |
| argument-hint | [--fix] [--report] [--path <dir>] [--exclude <pattern>] |
掃碼助手
語言: English | 繁體中文
掃描程式庫的除錯殘留、程式碼品質問題與技術債標記。
可選擇性自動修正安全模式(console.log、debugger 等語句)。
掃描模式
| Pattern ID | 名稱 | 可自動修正 | 說明 |
|---|
console-log | console.log / console.debug / console.trace | ✅ 是 | 留在正式環境的除錯輸出 |
debugger | debugger 語句 | ✅ 是 | 留在程式碼中的中斷點 |
todo-fixme | TODO / FIXME / HACK / XXX | ❌ 僅回報 | 技術債標記 |
ts-any | TypeScript any 型別 | ❌ 僅回報 | 型別安全違規 |
使用方式
/sweep
/sweep --fix
/sweep --report
/sweep --path src/
/sweep --exclude "**/*.test.ts"
執行工作流程
Step 1:搜尋檔案
使用 Glob tool 找出目標路徑下所有原始碼檔案。
預設排除:node_modules/、dist/、.git/、*.min.js、coverage/。
Step 2:逐 Pattern 掃描
對每個 pattern 使用 Grep 在所有檔案中尋找比對結果。
彙整發現:{ file, line, column, pattern_id, label, fixable, content }。
Step 3:回報發現
輸出結構化摘要:
📊 掃描結果
─────────────────────────────────────
console-log: 12 筆 (可自動修正)
debugger: 2 筆 (可自動修正)
todo-fixme: 28 筆 (僅回報)
ts-any: 5 筆 (僅回報)
─────────────────────────────────────
合計:47 筆 | 可修正:14 筆
Step 4:HITL 閘門(--fix 且發現數 > 20)
若設定 --fix 且可修正發現總數超過 20:
暫停並要求使用者明確確認才套用修正。
顯示將被修改的檔案清單。
Step 5:套用修正(確認 --fix 後)
對每筆可修正發現:
console-log:若該行僅含 console 語句則刪除該行
debugger:若該行僅含 debugger 語句則刪除該行