docs: tighten comment rules based on recurring review feedback - #10
Merged
Conversation
Add two patterns to Documentation Comments (describe the caller-facing effect, not internal mechanism vocabulary; state facts declaratively rather than instructing the reader) and a new Regular Comments (//) section establishing what a comment is for: justifying why this implementation was chosen, not a memo of what was learned while writing or debugging it, and not a restatement of something already evident from the code (e.g. a signature forced by protocol conformance). Also covers not naming a specific consumer type in a comment on general-purpose code, since that goes stale as soon as callers change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
## Documentation Comments: describe the caller-facing effect, not internal mechanism vocabulary (e.g. "borrow"/"pool"); state facts declaratively rather than instructing the reader, matching Apple's own DocC discussion style.## Regular Comments (//)section: a comment justifies why this implementation was chosen, not a memo of what was learned while writing/debugging, and not a restatement of something already evident from the code (e.g. a signature forced by protocol conformance — no comment needed at all in that case). Also covers not naming a specific consumer type in a comment on general-purpose code, since that goes stale as soon as callers change.These codify recurring feedback given during review of a separate PR (#8) — the same categories of comment mistakes kept recurring, so the rule needed to be explicit rather than re-derived each time.
Test plan
.claude/rules/swift.md; no application code touched, so no build/CI impact.Generated by Claude Code