antislop-code
它能做什么
过滤读起来像通用 AI 写作的代码注释,例如装饰性横幅或重复代码内容的注释,并保留真正有信息量的注释。适用于希望代码注释更简洁的开发者。
适用场景
- ✓开发者让 AI 智能体在项目中编写或修改代码注释的时候。
- ✓开发者希望从代码中删除装饰性横幅或显而易见的注释的时候。
- ✓开发者只想保留能为读者提供实际信息的注释的时候。
技能链接
https://github.com/miqdadbadjuber/anti-slop/blob/main/skills/antislop-code/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我整理这个文件中的注释,删除多余的内容,保留有用的说明。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能会检查每条注释是否有实际用途,然后删除装饰性、重复或夸张的注释。它只修改注释,绝不改动可执行代码。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
antislop-code
Anti Slop: Rules for AI Coding Agents. Code Comments skill
Part of the antislop system. Read together with
antislop.md(the core). This skill filters comments that read as generically AI (decorative, restating the obvious, stiff, loud) while preserving the comments that carry real information. It references core rules by number and never duplicates or renumbers them. Load it when the task writes or edits code comments.
How to use this skill
- Load together with
antislop.mdwhenever the task touches code comments. The core holds the mechanism (the purpose test, the three tiers, the Delivery Gate); this skill holds comment-specific depth. - Every entry has the same shape: Tell (the pattern), Why (why it reads as slop), Fix (what to do instead), with the governing core rule cited as R-XX.
- Scope guardrail: this skill only modifies comments. Never modify executable code, identifiers, imports, formatting, indentation, whitespace, control flow, or logic. When in doubt, leave the code untouched.
- The Delivery Gate in the core remains the gate. The "Code Comment Checklist" at the end of this file is the comment-specific supplement to run alongside it.
Comments That Add Nothing
Decorative Separators
- Tell: banner comments built from repeated characters, ALL CAPS labels, or box drawing around a section name:
// =======================aroundAuthentication,// -------- WORKFLOW --------, or a/* ---- ROUTES ---- */header. - Why: the decoration is the message. A label wrapped in
=or-signals "AI made this" without adding information, and ALL CAPS reads as shouting. - Fix: replace with a single plain line, or remove entirely if the label adds nothing (R-31).
Restating the Obvious
- Tell: a comment that repeats what the next line or declaration already shows, like
// Initialize the variableabovelet count = 0,// User classaboveclass User {},// Validate userabovefunction validateUser(), orconst userAge = 25; // User age is 25. - Why: it doubles the reading load without adding anything. The code already says it; the comment just repeats it.
- Fix: remove and leave the line of code alone.
Workflow Narration
- Tell: comments that narrate the flow step by step, like
// Step 1: Validate input,// Step 2: Process request,// Step 3: Return response, or// First...,// Next...,// Finally.... - Why: the control flow is visible in the code itself. Numbering it reads as a checklist, not an explanation.
- Fix: remove. If the flow is genuinely hard to follow, that is a structure problem, not a missing comment problem.
Empty Labels
- Tell: generic labels with no information behind them:
// Main logic,// Core logic,// Business logic,// Helper function,// Entry point,// Error handling, or// Note: This is important./// Important: Please read. - Why: the label names a category, not a fact. "Main logic" tells the reader nothing they could not infer from the code.
- Fix: remove unless the label carries specific information. "Note: retries happen only on 5xx" earns its place; "Note: this is important" does not.
Vague Placeholders
- Tell: comments that promise future work without saying what:
// TODO: Improve this,// Future improvements,// Additional optimization can be added here,// Add more validation. - Why: a vague TODO is noise. It names a feeling (this could be better) instead of a task (what, and why).
- Fix: remove. Keep a TODO only when it names a specific task with enough context to act on.
Signature Echo
- Tell: documentation that only restates the signature, like a JSDoc block that repeats
@param price The price.and@returns Total price.for a function whose name and parameters already say all of it. - Why: docs that echo the signature add length, not understanding. The reader learns nothing new.
- Fix: simplify or remove the echo. Keep documentation that explains business rules, edge cases, assumptions, algorithms, limitations, side effects, API behavior, or security implications. Never strip real documentation.
Decorative Emoji
- Tell: emoji used as decoration in comments, like
// ✅ Validationor// 🚀 Performance. - Why: emoji is visual noise in code, and the specific set (✅, 🚀, 🔒) is the AI default vocabulary.
- Fix: replace with plain English, or remove if the lab
常见问题
它会改动我的代码吗?
不会。该技能说明它只编辑注释,不改变代码、名称、导入或格式。
它需要核心 antislop 规则吗?
需要。该技能应与主 antislop 文件一起使用,主文件包含共享规则。
它会保留哪些注释?
它会保留对读者有实际信息价值的注释,并删除那些没有附加价值的注释。
详情
作者的原始描述
Code comment hygiene for AI coding agents: remove generic AI-slop comments, keep the valuable ones, never touch the code.
repo: miqdadbadjuber/anti-slop
热度
- GitHub 星标
- 8.0k
- 排名
- #12648
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
antislop-copywriting
8.0k帮你的智能体用平实、自然的语言编写和修改营销文案、标题与行动号召,避免常见的 AI 写作套路和虚构事实。
antislop-human
8.0k帮你的智能体构建适合真实用户的界面,包括可读的对比度、键盘操作、可见的焦点和清晰的状态。
antislop-layoutmobile
8.0k帮你的智能体制作从手机到电脑都能良好重排的布局,网格清晰、没有横向溢出,并且点击目标易于点中。
antislop-ui
8.0k帮你的智能体设计看起来经过精心打造、而非千篇一律的界面,包括考究的配色、真实的布局和有目的的动效。