scan-code-hygiene
Skill2 starsChanged 7 months agoMITView on GitHub
扫描代码库中的卫生问题:console.log 调试语句、TODO/FIXME、硬编码地址/密钥、中文注释中的敏感词
In this repository26 other files it gives its agents.
- advise-tech-stackSkill
- commit-with-affectsSkill
- db-dev-guideSkill
- export-db-indexesSkill
- frontend-dev-guideSkill
- frontend-ux-evaluatorSkill
- generate-pr-descriptionSkill
- generate-test-from-impactSkill
- generate-test-skeletonSkill
- lock-global-conventionsSkill
- plan-component-hierarchySkill
- plan-page-mapSkill
- proposal-reviewSkill
- propose-workflow-improvementsSkill
- pr-self-reviewSkill
- record-decisionSkill
- review-guardrailsSkill
- run-pending-specsSkill
- run-testsSkill
- scan-bundle-bloatSkill
- scan-dead-routesSkill
- scan-frontend-qualitySkill
- scan-orphan-componentsSkill
- scan-unused-exportsSkill
- sync-llm-contextSkill
- verify-specSkill
The file
Files
Scan Code Hygiene Skill
单独调用:
/scan-code-hygiene(发版前自查)或/scan-code-hygiene --scope=all(全量扫描) 在工作流中调用:由production-releaseStep 2 自动触发 默认 scope:staged(只扫本次变更),发版前建议用all
执行步骤
Step 1:确定扫描范围
--scope=staged:git diff HEAD --name-only获取变更文件列表--scope=all:扫描{{FRONTEND_PATH}}和{{BACKEND_PATH}}下所有源文件
Step 2:执行扫描检测
调试语句(🔴 发版前必须清除):
# 前端
grep -rn "console\.log(" 变更文件 --include="*.{{EXT}}"
# 后端
grep -rn "print(" 变更文件 --include="*.py"
grep -rn "pprint\|pp\(" 变更文件 --include="*.py"未完成标记(🟡 建议处理):
grep -rn "TODO\|FIXME\|HACK\|XXX\|TEMP\|临时\|TODO:" 变更文件硬编码环境地址(🔴 必须修复):
grep -rn "localhost:\|127\.0\.0\.1:\|http://.*\.com\|https://.*\.com" 变更文件
# 排除测试文件和注释潜在密钥(🔴 必须修复):
grep -rn "password\s*=\s*['\"].\|api_key\s*=\s*['\"].\|secret\s*=\s*['\"]." 变更文件Step 3:输出报告
输出格式
## 代码卫生扫描报告
扫描范围:staged / all
扫描文件数:N
### 🔴 必须修复(发版阻断)
- `frontend/src/api/client.ts:23` — console.log("response:", data)
- `backend/app/config.py:5` — password = "hardcoded_pass"
### 🟡 建议处理
- `backend/app/service.py:45` — TODO: 优化批量查询性能
### ✅ 未发现问题
- 硬编码地址:无
- 潜在密钥:无
---
结论:发现 🔴 2 项(需修复后再发版)/ ✅ 全部通过约束
- NEVER 自动修改任何文件,只输出报告
- MUST 对
console.warn/console.error不报告(这些可以保留) - 硬编码地址扫描需排除测试文件(
*.test.ts、conftest.py)和注释中的示例 - 若发现 🔴 项,在
production-release流程中这是强制阻断条件
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

