docs: rewrite the in-file comment convention
Encode the sharpened ruleset: why-over-what, self-containment, the absence-only cross-file exception, no domain-glossary terms, no against-alternative or future-state framing, one-line file headers, placeholder wording, and how option description strings differ.
This commit is contained in:
14
CLAUDE.md
14
CLAUDE.md
@@ -5,10 +5,16 @@ The domain model (Host, Module, Skeleton, Auto-loader, Enable convention, overla
|
||||
|
||||
## Conventions
|
||||
|
||||
- In-file comments describe only the current content and behaviour of the file they sit in.
|
||||
Do not write comments about history ("used to be X", "now moved here"), about how a value is consumed in other files, or that justify the choice against alternatives.
|
||||
Never reference agent-facing state (anything under `.claude/` or `CLAUDE.md`) from a code comment: that state is not part of understanding the code.
|
||||
A reader looking at only that file should find every comment accurate and self-contained.
|
||||
- Write comments only where they earn their place, and keep them concise.
|
||||
Assume the reader can read code: comment the "why", not the "what", and explain "what" only when it is genuinely non-obvious.
|
||||
A comment must be self-contained to its file — accurate to a reader looking at that file alone.
|
||||
Do not write about history ("used to be X", "now moved here") or future state, about how a value is consumed elsewhere, or to justify the choice against alternatives; state the positive reason a thing exists, keeping any real stakes as a present-tense consequence.
|
||||
The only permitted cross-file mention is a bare pointer explaining why something is *absent* here (e.g. "disko derives `fileSystems`; none declared here"), never narrating what the other file or tool does.
|
||||
Do not use the domain model's capitalized terms (Host, Module, Skeleton, Auto-loader, Enable convention) as glossary references; describe things in plain language, using "host"/"module" only as ordinary lowercase nouns.
|
||||
Never reference agent-facing state (anything under `.claude/` or `CLAUDE.md`).
|
||||
A file-top header is one concise purpose line, added only where the filename or path does not already say it — never a feature inventory of the code below.
|
||||
For a placeholder, say so plainly plus any actionable present-tense directive ("Placeholder: regenerate with nixos-generate-config on the target machine"), never "placeholder for <missing feature>".
|
||||
Option `description`/`mkEnableOption` strings are user-facing documentation rather than comments, so they may describe behaviour more fully — but the self-contained rule and the bans on glossary terms and agent-state references still apply.
|
||||
- Comments posted to Gitea (pull requests, issues, reviews) go out under the operator's account, so sign every one to make clear the author is the agent, not the operator.
|
||||
End the comment with a `— Claude` sign-off.
|
||||
(A dedicated bot account may replace this later; until then, the sign-off is the only marker.)
|
||||
|
||||
Reference in New Issue
Block a user