A simple but very effective rule I use in Claude Code is this "comments[.]md" file. It prevents Claude from writing slop comments like "increment counter" on already self-documenting code.
in /.claude/rules/comments.md: --- globs: ["*.ts", "*.tsx", "*.js", "*.jsx", "*.py"] alwaysApply: true description: Comment policy --- ## Comment Policy ### Unacceptable Comments - Comments that repeat what code does - Commented-out code (delete it) - Obvious comments ("increment counter") - Comments instead of good naming ### Principle Code should be self-documenting. If you need a comment to explain WHAT the code does, consider refactoring to make it clearer.
17