100% vibe coded. zero comments in my code, zero comments in yours.
this entire repo - code, docs, readme, everything - was written by LLMs. shoutout to claude opus 4.5.
A PostToolUse hook for Claude Code / OpenCode that yells at you when you write unnecessary comments.
Built with Rust + tree-sitter. Fast. Opinionated. No mercy.
comments are code smell. if your code needs comments to be understood, your code sucks.
this hook watches every Write, Edit, MultiEdit and screams when it detects comments.
exceptions exist. BDD comments (# given, # when, # then), linter directives (# noqa, // @ts-ignore), shebangs - these are fine. everything else? delete it. yes, even docstrings.
npm install -g @code-yeongyu/comment-checker
bun add -g @code-yeongyu/comment-checkerbrew tap code-yeongyu/tap
brew install comment-checkergrab binary from releases.
add to ~/.claude/settings.json (or .claude/settings.json in your project):
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "comment-checker"
}
]
}
]
}
}done. now claude will think twice before leaving // TODO: fix later in your code.
// bad: unnecessary comment
x := 1 + 1 // adds one to one
// bad: todo that will never be done
// TODO: refactor this later
// bad: commented out code
// fmt.Println("debug")# given - BDD comments are fine
def test_something():
# when
result = do_thing()
# then
assert result == expected# noqa: E501 - linter directives are fine#!/usr/bin/env python - shebangs are finepython, go, typescript, javascript, rust, c, c++, java, ruby, php, swift, kotlin, scala, elixir, and more.
if tree-sitter supports it, we support it. the archived Go implementation lives under go/; the production CLI is Rust.
- hook receives JSON from Claude Code
- extracts content from
Write/Edit/MultiEdittool input - detects language from file extension
- parses AST with tree-sitter
- finds comment nodes
- filters out allowed patterns (BDD, directives, shebangs)
- if anything remains → exit 2 with warning message
the Rust workspace also has buildable wasm32-unknown-unknown and N-API binding crates for future consumers. those paths are CI buildability gates for now; npm still ships native binaries.
| code | meaning |
|---|---|
| 0 | pass - no comments found or skipped |
| 2 | warning - problematic comments detected |
you can replace the default warning message with your own using --prompt:
comment-checker --prompt "Custom warning! {{comments}}"use {{comments}} placeholder to insert the detected comments XML. if omitted, only your custom message is shown.
{
"comment_checker": {
"custom_prompt": "DETECTED:\n{{comments}}\nFix it."
}
}"Code is like humor. When you have to explain it, it's bad." - Cory House
write self-documenting code. use meaningful names. extract functions. stop explaining what the code does and make the code explain itself.
MIT. do whatever.