console-cleanup
它能做什么
这项技能检查 JavaScript 中是否有不应在正式网站上运行的 console 语句。适合在发布前准备脚本的开发者。
适用场景
- ✓当正式环境的脚本中包含 console.log 或 console.debug 调用时。
- ✓当调试信息可能向访客泄露隐私时。
- ✓当你设置的构建流程应当自动去除日志时。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/console-cleanup/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在发布前从我的结账脚本中删除调试日志。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会找出 console 语句,将其删除,或改用在正式环境中关闭的日志方案,并在需要的地方保留错误日志。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Remove console statements in production
Console statements leak sensitive information, impact performance, and create unprofessional user experiences when visible in production.
Quick Reference
- Remove console.log, console.debug, console.table before production
- Use environment-aware logging utilities
- Configure build tools to strip console statements automatically
- Keep console.error for critical error tracking if needed
Check
Scan this JavaScript code for console.log, console.debug, console.warn, console.error, and other console statements that should be removed before production deployment.
Fix
Remove or conditionally disable console statements for production, or replace them with a proper logging service.
Explain
Explain why console statements should be removed from production code and alternatives for logging.
Code Review
Review scripts, client components, and browser execution paths related to Remove console statements in production. Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/javascript/console-cleanup
常见问题
为什么 console 语句在正式环境中是个问题?
这项技能说明,它们可能泄露敏感信息、影响性能,并显得不够专业。
错误还能记录吗?
可以。这项技能说明,如果错误追踪需要,console.error 可以保留。
替代 console 日志的好方法是什么?
能感知环境的日志工具,或专业的日志服务。
详情
作者的原始描述
Use when reviewing scripts, client components, bundles, or runtime behavior related to Remove console statements in production. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.
热度
- GitHub 星标
- 75k
- 排名
- #2780
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。