| name | sweep |
| source | ../../../../skills/sweep/SKILL.md |
| source_version | 1.0.0 |
| translation_version | 1.0.0 |
| last_synced | "2026-07-16T00:00:00.000Z" |
| source_hash | 340ed7c83bbd |
| status | current |
| 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 语句则删除该行