跳到正文
Skillpedia
网站与界面(前端)75k · #2780

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/console-cleanup/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2780
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能