Skip to content

Write down the comment conventions - #396

Merged
medihack merged 2 commits into
mainfrom
docs/comment-conventions
Aug 16, 2026
Merged

Write down the comment conventions#396
medihack merged 2 commits into
mainfrom
docs/comment-conventions

Conversation

@medihack

@medihack medihack commented Aug 16, 2026

Copy link
Copy Markdown
Member

Summary

Adds two comment conventions to AGENTS.md under Code Standards. Neither was written down anywhere — the file had no guidance on comments at all.

- **Comments**: write one only where the code cannot speak for itself — an invariant, a
  constraint that is not visible locally, or a decision a future reader would otherwise
  undo. Explain *why*, never restate *what*. A comment earns its place if removing it
  would let someone reintroduce a bug; if it only describes the line below it, delete it.
- **Comments describe the code as it is now**, never how it used to be or why it changed.
  No "previously we used X", no "changed after review", no narrating the fix or the
  discussion that produced it. That belongs in the commit message, where it stays attached
  to the change instead of ageing in the source. The same goes for docstrings: they tell a
  caller how to use the thing, not what it replaced.

Why

The second rule is the one with teeth. A comment describing a diff is meaningless to someone reading the file later — they never saw the previous version and cannot act on the information. The commit message is where that belongs, because it stays anchored to the change and git log -L retrieves it on demand.

A useful test falls out of it: if a comment would be false or pointless in a fresh checkout with no history, it is in the wrong place. "Do not swap this for Greatest, because a foreign config's ts_rank is not reliably ~0" passes — it describes the code as it stands and stops a future mistake. "Trimmed after review" fails.

The first rule exists because review-driven changes accumulate one justification per round and nobody ever removes them, since each was individually earned. What is left narrates the review rather than the code.

Scope

Documentation only — no code, no behaviour change. CLAUDE.md and GEMINI.md are symlinks to AGENTS.md, so editing the one file covers all three.

The same change is opened against the sibling repositories so the convention is consistent across the workspace.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Expanded code standards guidance for comments and docstrings.
    • Clarified that documentation should explain non-obvious rationale, describe current behavior, and avoid historical change narratives.

Comments only where the code cannot speak for itself, and never describing how
the code used to be -- that belongs in the commit message, where it stays
anchored to the change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WQ5JV4VntoXmqMjT7CHDVR
Copilot AI balanced review requested due to automatic review settings August 16, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@medihack, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f3c5fb54-4b7f-44ae-b8ba-cdf8e563c592

📥 Commits

Reviewing files that changed from the base of the PR and between 0a3c834 and acc49db.

📒 Files selected for processing (1)
  • AGENTS.md

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dee0bb44-d221-4652-b6c3-5dbdbe4ed678

📥 Commits

Reviewing files that changed from the base of the PR and between 1123e76 and 0a3c834.

📒 Files selected for processing (1)
  • AGENTS.md

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

AGENTS.md adds Code Standards guidance for comments and docstrings. The guidance requires concise explanations of non-obvious rationale or invariants, describes current code, and excludes historical change narratives.

Changes

Comment and docstring standards

Layer / File(s) Summary
Code standards update
AGENTS.md
Adds rules for concise, rationale-focused comments and docstrings that describe current usage instead of past implementations or change history.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 0a3c8

This documentation-only change adds comment-writing guidance without changing product behavior, and no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: numericaladvantage

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the documentation change that adds comment conventions to AGENTS.md.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/comment-conventions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI review requested due to automatic review settings August 16, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@medihack
medihack merged commit 81e72a3 into main Aug 16, 2026
2 checks passed
@medihack
medihack deleted the docs/comment-conventions branch August 16, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants