locales/zh-CN/skills/sweep/SKILL.md
[UDS] 扫描代码库的调试残留与代码质量问题;可自动修正安全模式。 Use when: before committing, during PR review, or periodic codebase cleanup. Keywords: sweep, debug cleanup, console.log, debugger, TODO, ts-any, code quality, 扫描, 清理.
npx skillsauth add asiaostrich/universal-dev-standards sweepInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
语言: 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 # 扫描并将报告写入 .uds/sweep-report.json
/sweep --path src/ # 扫描指定目录
/sweep --exclude "**/*.test.ts" # 排除模式(glob)
使用 Glob tool 找出目标路径下所有源代码文件。
默认排除:node_modules/、dist/、.git/、*.min.js、coverage/。
对每个 pattern 使用 Grep 在所有文件中查找匹配结果。
汇总发现:{ file, line, column, pattern_id, label, fixable, content }。
输出结构化摘要:
📊 扫描结果
─────────────────────────────────────
console-log: 12 条 (可自动修正)
debugger: 2 条 (可自动修正)
todo-fixme: 28 条 (仅报告)
ts-any: 5 条 (仅报告)
─────────────────────────────────────
合计:47 条 | 可修正:14 条
若设置 --fix 且可修正发现总数超过 20:
暂停并要求用户明确确认后才应用修正。
显示将被修改的文件清单。
对每条可修正发现:
console-log:若该行仅含 console 语句则删除该行debugger:若该行仅含 debugger 语句则删除该行使用 Edit tool 逐文件应用变更。 报告:「已修正 N 条,影响 M 个文件。」
将发现写入 .uds/sweep-report.json:
{
"timestamp": "<ISO8601>",
"total_findings": 47,
"fixable": 14,
"fixed": 14,
"findings_by_pattern": { "console-log": 12, "debugger": 2, "todo-fixme": 28, "ts-any": 5 },
"files_modified": ["src/auth.ts", "src/utils.ts"]
}
通过 uds.project.yaml 设置:
sweep:
default_path: "src/"
exclude_patterns:
- "**/*.test.ts"
- "**/*.spec.ts"
- "**/fixtures/**"
hitl_threshold: 20 # 可修正项超过此值时需确认
patterns:
enabled:
- console-log
- debugger
- todo-fixme
- ts-any
/sweep 完成后建议:
- 执行
/checkin在提交前验证整体代码质量- 执行
/review审查清理后的变更- 执行
/commit提交修正
| 版本 | 日期 | 变更 | |------|------|------| | 1.0.0 | 2026-04-28 | 初始版本 — XSPEC-097 Phase 1(从上游迁移) |
本 Skill 采用 MIT License 与 CC BY 4.0 双重授权发布。
tools
[UDS] 从规格衍生 BDD 场景、TDD 骨架或 ATDD 表格
development
[UDS] 识别重复流程并以正确的开发深度构建 Skill
tools
[UDS] AI 辅助 git push 安全层:质量门禁 + 协作护栏。 Use when: pushing commits, force pushing, pushing to protected branches, pushing feature branches. Keywords: git push, force push, protected branch, quality gate, push receipt, PR automation, 推送, 保护分支, 质量门禁.
testing
[UDS] 从 Spec 文档、OpenSpec 变更或自由文本需求生成 plan.json。 Use when: converting specifications into executable task plans for /orchestrate. Keywords: plan, spec, task plan, 计划, 规格, 任务, plan.json, DAG.