Skip to content

docs(rules): add comment-content rule + fix stale rules index in CLAUDE.md#1302

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:docs/rule-comments-what-not-why
Jul 9, 2026
Merged

docs(rules): add comment-content rule + fix stale rules index in CLAUDE.md#1302
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:docs/rule-comments-what-not-why

Conversation

@ChaoWao

@ChaoWao ChaoWao commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Two docs-only changes:

1. New rule .claude/rules/comments.md — a code comment states a
non-obvious present-tense fact about the code as it stands (invariant,
contract, constraint). It never justifies a change, narrates the
modification/history, or acts as an epitaph for a deletion. Rationale and
change-context go in the commit message, PR description, or
docs/investigations/. Litmus test: would the comment still make sense to a
reader who never saw the diff?
Sharpens codestyle.md §1 and reconciles
doc-consistency.md §5 terminology.

2. Fix the stale rules index in CLAUDE.md (surfaced by review). The list
referenced architecture and terminology, which are not files
architecture content lives in ascend.md, and there is no terminology rule —
and it omitted five real rules (ascend, known-issues-tracking,
project-layout, running-onboard, venv-isolation). The index now links
every existing .claude/rules/*.md and references nothing that doesn't exist.

Docs-only; no code changes.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a new .claude/rules/comments.md document specifying conventions for writing present-tense, fact-based code comments while banning justification, narration, edit-history, and deletion-explanation comments. It also updates CLAUDE.md's Important Rules to reference a broader set of rule documents.

Changes

Comment Rules Documentation

Layer / File(s) Summary
Add comments rule and wire into CLAUDE.md
.claude/rules/comments.md, CLAUDE.md
New rule document defines comment conventions (present-tense facts, no justification/narration/deletion epitaphs, litmus test, pointers to commit/PR/docs for rationale); CLAUDE.md's Important Rules bullet is expanded to reference this and other rule documents.

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

Poem

A rule was born, so crisp and clean,
"State the facts, skip what-has-been!"
No epitaphs for code that's gone,
Just present truths to carry on.
Hop hop, I file this doc with glee 🐇📜

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the docs rule addition and the CLAUDE.md rules index fix.
Description check ✅ Passed The description accurately describes both docs-only changes and matches the pull request scope.

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new markdown rule file .claude/rules/comments.md that defines guidelines for writing code comments, and updates CLAUDE.md to reference it. The review feedback recommends linking other existing guidelines (architecture, codestyle, and terminology) in CLAUDE.md to their respective files for better consistency and navigation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread CLAUDE.md Outdated
@ChaoWao ChaoWao force-pushed the docs/rule-comments-what-not-why branch from ad2bcf6 to c3cd763 Compare July 9, 2026 03:12
Add `.claude/rules/comments.md`: a code comment states a non-obvious fact
about the code as it currently stands (invariant, contract, constraint),
never the rationale for a change, its history, or an epitaph for deleted
code. Rationale/context belong in the commit message, PR, or
docs/investigations. Sharpens codestyle.md §1 and reconciles doc-consistency
§5 terminology.

Also fix the CLAUDE.md rules index, which was stale: it listed `architecture`
and `terminology` (no such files — architecture content is in ascend.md,
terminology has no file) and omitted five real rules (ascend,
known-issues-tracking, project-layout, running-onboard, venv-isolation). The
list now links every existing `.claude/rules/*.md` and nothing that doesn't
exist.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChaoWao ChaoWao changed the title docs(rules): add comment-content rule (state WHAT, not WHY/history) docs(rules): add comment-content rule + fix stale rules index in CLAUDE.md Jul 9, 2026
@ChaoWao ChaoWao merged commit 77abb15 into hw-native-sys:main Jul 9, 2026
14 checks passed
@ChaoWao ChaoWao deleted the docs/rule-comments-what-not-why branch July 9, 2026 03:19
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.

1 participant