Skip to content
Back to skills

Comment Why

ASecurity

Add why-comments to non-obvious code explaining intent, constraints, and gotchas

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 3, 2026
ai-agentsgoexpress

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill comment-why --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Comment Why?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Comment Why
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-comment-why/badge)](https://www.skillsdirectory.com/skills/black141312-comment-why)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: comment-why
description: Add why-comments to non-obvious code explaining intent, constraints, and gotchas
category: docs
---

# Comment Why

Use this when code is correct but mysterious — a magic constant, a workaround, an ordering that matters. Comment the reasoning the code can't express, not the mechanics it already shows.

1. Scan the target code for non-obvious spots: magic numbers, workarounds, defensive checks, surprising ordering, perf hacks.
2. For each, work out the why: the bug it prevents, the constraint it satisfies, the assumption it relies on.
3. Write a short comment stating intent — link an issue/spec/RFC or cite the source when relevant.
4. Flag landmines explicitly (`// HACK:`, `// WARNING:`, `// SAFETY:`) so future editors pause.
5. Delete or fix any comment that merely restates the code or has gone stale.
6. Re-read each comment cold and confirm it would actually save a future reader time.

## Rules
- Explain why, never what — `i += 2` doesn't need "increment i by 2".
- Anchor claims: link the issue, ticket, or upstream bug instead of vague "for compatibility".
- Don't narrate obvious code; noise comments are worse than none.
- Put the comment next to the surprising line, not in a distant block.
- A comment is a liability — if it can drift out of sync, prefer making the code self-explaining.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…