From a091775b38978ca1a5f60d7eff798a4f7f588aa1 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 1 Oct 2026 19:40:55 +0200 Subject: [PATCH 1/3] Title what Comments and documentation adds to Prose, and cut what Prose already says --- CLAUDE.md | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 23ba1b23..a0c57975 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -36,19 +36,15 @@ Everything written — chat, commit messages, comments, docs, code — is in **E ## Comments and documentation (`README.md`, `AGENTS.md`, `docs/`, API specs) -**One bar for all of it.** A comment or a paragraph earns its place by saying what a competent reader of THIS codebase could not infer and the repo cannot say for itself: a surprising WHY, a footgun, an invariant, an external constraint. The fix for a redundant one is deletion, not trimming — two copies drift, and the doc copy is the one nobody updates. Once it has earned its place, make it plain and short. GOOD: `// Loud-fail: missing amount used to coerce to '0' = phantom "0 SEK reversal" in api-4.` — records a past prod bug the code can't show. +"Prose" above applies to all of it. These rules are special to writing that sits beside code. -**A false claim is a bug — fix it where you find it.** Docs, comments and what a program prints — `--help`, an error, a log line — assert checkable things: a command, a resolution rule, a path, a limit. Verify one before you repeat or build on it. When it is wrong, correct it in the same change: the claim — or the code, when consumers already rely on what the claim promises. Never work around it or record the discrepancy elsewhere. +### What earns a place -**Negation, history and limitations: name the action, or say nothing.** Prose describing the code as it stands — a comment, a README, an `AGENTS.md`, an API spec — may narrate what is *not* done (a removed step, a call we don't make, a superseded version `we used to X, now Y`, a limitation) in one shape only: where a reader would otherwise **do** something harmful, and the sentence says what to do instead. GOOD: `wrap a direct ./tests/run.sh to put it under the same lock`. BANNED: `run.sh takes no host lock`. A limitation with nothing to do instead belongs in the PR or ticket, because **documenting a limitation is not fixing it**. +The reader is a competent reader of THIS codebase. A comment or a paragraph earns its place by saying what that reader could not infer and the repo cannot say for itself: a surprising WHY, a footgun, an invariant, an external constraint. Fix a redundant one by deleting it, never by trimming it: two copies drift, and the doc copy is the one nobody updates. GOOD: `// Loud-fail: missing amount used to coerce to '0' = phantom "0 SEK reversal" in api-4.` — records a past prod bug the code can't show. -**The inversion: a decision record owns what a call site may not say.** A rejected alternative, or what something deliberately does not cover, is banned beside the code precisely because the decision record holds it — a standing choice a future reader would otherwise relitigate, where a `CHANGELOG` holds what changed in a release. **The decision log has one home: `docs/decisions.md`**, or `docs/decisions/` split by area once it outgrows one file. `AGENTS.md` carries a one-line index of the titles, so a session or a reviewer sees that a decision exists without loading its reasoning. An entry states the decision, its date, who made it, and the premise it rests on ("valid while X") so it can expire honestly when that premise dies. A decision found anywhere else — an `AGENTS.md` body, a comment, or a README section that is neither a goal nor how one is met — moves there and leaves its index line behind. A goal stays a goal in the README; the log records only what the goal leaves open. +### A false claim is a bug — fix it where you find it -**Every decision links to a goal or a technical principle.** An entry names the goal it serves or the technical principle under `~/.claude/principles/` it applies; one that can do neither is a missing goal, and an entry already in the repo with neither behind it is a finding. Propose the goal, never a reason of your own — the ask rule above says how. An entry working against a goal or a technical principle stands only while it names the `todo.md` item that ends it. - -**Link, don't inline — and keep the link bare.** A mechanism identical across call sites or repos is documented once in the canonical source and pointed at with a one-line bare link. Don't summarize what's behind the link or restate the identifier's own name. - -**A pointer is not a definition.** A definition the reader needs to follow the code — what a unit counts, what a term means, what invariant a cache rests on — sits at the code in one line. A pointer to it (`see AGENTS.md §11`) cannot be checked against the code beside it, so it rots invisibly. A pointer carrying rationale — a rejected alternative, the premise behind a standing choice — is correct and stays. +Docs, comments and what a program prints — `--help`, an error, a log line — assert checkable things: a command, a resolution rule, a path, a limit. Verify one before you repeat or build on it. When it is wrong, correct it in the same change: the claim — or the code, when consumers already rely on what the claim promises. Never work around it or record the discrepancy elsewhere. ### Comments @@ -68,14 +64,29 @@ Default to NO comment. Delete one that is any of: **A README covers what a reader needs *before* opening the code**: how it meets its goals, how to build, test, run, and deploy it, and cross-cutting decisions no single file owns. It does **not** narrate an individual symbol, file, or test case — whoever wants to know what a test asserts opens the test, where the answer is exact and cannot drift. -**"Refresh `README.md` to match" means keep it true, not longer.** A change that alters a build/test/run/deploy step, a required env var, or a prerequisite makes the README a false claim by omission, fixed per "A false claim is a bug". Otherwise most changes need no README edit at all, and adding a section is a deliberate act you must justify. GOOD: `run-tests.sh` gained a required `--profile` flag → update the documented command. BANNED: the change added a test case → add a paragraph describing it. +**"Refresh `README.md` to match" means keep it true, not longer.** A change that alters a build/test/run/deploy step, a required env var, or a prerequisite makes the README a false claim by omission, fixed per "A false claim is a bug". Otherwise most changes need no README edit at all. GOOD: `run-tests.sh` gained a required `--profile` flag → update the documented command. BANNED: the change added a test case → add a paragraph describing it. + +### Decisions: one home, linked to a goal + +**A decision record owns what a call site may not say.** A rejected alternative, or what something deliberately does not cover, is banned beside the code precisely because the decision record holds it — a standing choice a future reader would otherwise relitigate, where a `CHANGELOG` holds what changed in a release. **The decision log has one home: `docs/decisions.md`**, or `docs/decisions/` split by area once it outgrows one file. `AGENTS.md` carries a one-line index of the titles, so a session or a reviewer sees that a decision exists without loading its reasoning. An entry states the decision, its date, who made it, and the premise it rests on ("valid while X") so it can expire honestly when that premise dies. A decision found anywhere else — an `AGENTS.md` body, a comment, or a README section that is neither a goal nor how one is met — moves there and leaves its index line behind. A goal stays a goal in the README; the log records only what the goal leaves open. + +**Every decision links to a goal or a technical principle.** An entry names the goal it serves or the technical principle under `~/.claude/principles/` it applies; one that can do neither is a missing goal, and an entry already in the repo with neither behind it is a finding. Propose the goal, never a reason of your own — the ask rule above says how. An entry working against a goal or a technical principle stands only while it names the `todo.md` item that ends it. + +### Links and pointers + +**Link, don't inline — and keep the link bare.** A mechanism identical across call sites or repos is documented once in the canonical source and pointed at with a one-line bare link. Don't summarize what's behind the link or restate the identifier's own name. + +**A pointer is not a definition.** A definition the reader needs to follow the code — what a unit counts, what a term means, what invariant a cache rests on — sits at the code in one line. A pointer to it (`see AGENTS.md §11`) cannot be checked against the code beside it, so it rots invisibly. A pointer carrying rationale — a rejected alternative, the premise behind a standing choice — is correct and stays. + +### Negation, history and limitations: name the action, or say nothing + +Prose describing the code as it stands — a comment, a README, an `AGENTS.md`, an API spec — may narrate what is *not* done (a removed step, a call we don't make, a superseded version `we used to X, now Y`, a limitation) in one shape only: where a reader would otherwise **do** something harmful, and the sentence says what to do instead. GOOD: `wrap a direct ./tests/run.sh to put it under the same lock`. BANNED: `run.sh takes no host lock`. A limitation with nothing to do instead belongs in the PR or ticket, because **documenting a limitation is not fixing it**. ### Package README (what someone finds on npm or GitHub) - The public API is the contract, so the README documents it: options, results, events, everything exported. The rule against narrating a file or test case still holds. -- Order sections by what a new developer wants first: install, the main task, the next task, and so on. The reference half — options tables, in-depth behaviour, low-level API, development — goes below the quick starts. -- Headline plus short, clear instruction, nothing else. No meta-prose ("things to keep in mind", "you may want to know"). An intro is a line or two that points at the in-depth section. +- Order: install, the main task, the next task, and so on. The reference half — options tables, in-depth behaviour, low-level API, development — goes below the quick starts. - Keep every documented behaviour, as terse facts, bullets and tables rather than paragraphs. Where the README is the only record of a behaviour, cutting it is a decision to ask about, not a tidy-up. -- Write for the app developer using the package; gloss a domain term once, on first use. +- Write for the app developer using the package. - Top: badges (package version, CI), a one-line tagline that is also the package manifest's description, a feature list, a one-line table of contents. Near the bottom: a table of everything exported. - A guide for migrating from an older major goes in `MIGRATION.md`, linked from one line in the README. -- 2.52.0 From 40cd9cebf3070c5bd1f28919449f852e78abc0b3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 1 Oct 2026 19:42:14 +0200 Subject: [PATCH 2/3] Answer the docs-section review's first round --- CLAUDE.md | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index a0c57975..20a29471 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -36,8 +36,6 @@ Everything written — chat, commit messages, comments, docs, code — is in **E ## Comments and documentation (`README.md`, `AGENTS.md`, `docs/`, API specs) -"Prose" above applies to all of it. These rules are special to writing that sits beside code. - ### What earns a place The reader is a competent reader of THIS codebase. A comment or a paragraph earns its place by saying what that reader could not infer and the repo cannot say for itself: a surprising WHY, a footgun, an invariant, an external constraint. Fix a redundant one by deleting it, never by trimming it: two copies drift, and the doc copy is the one nobody updates. GOOD: `// Loud-fail: missing amount used to coerce to '0' = phantom "0 SEK reversal" in api-4.` — records a past prod bug the code can't show. @@ -58,19 +56,11 @@ Default to NO comment. Delete one that is any of: **What stays is one terse line, and only where the code cannot show it.** GOOD: `# Pinned to 7.x: hurl 8's jsonpath change breaks the nth-filter asserts.` A second line belongs in the commit message or the ticket. The one exception is a paragraph for an invariant a reader must hold before touching the code below; it stays with the code it guards. -**Density is a review signal.** Prose comment lines much past ~10% of a file's non-blank lines mean something is wrong — narrating comments, or code that fails to carry its own meaning. A defect to investigate, not a style preference. +**Density is a review signal.** Prose comment lines much past ~10% of a file's non-blank lines mean something is wrong — narrating comments, or code that fails to carry its own meaning. A defect to investigate. -### README +### Negation, history and limitations: name the action, or say nothing -**A README covers what a reader needs *before* opening the code**: how it meets its goals, how to build, test, run, and deploy it, and cross-cutting decisions no single file owns. It does **not** narrate an individual symbol, file, or test case — whoever wants to know what a test asserts opens the test, where the answer is exact and cannot drift. - -**"Refresh `README.md` to match" means keep it true, not longer.** A change that alters a build/test/run/deploy step, a required env var, or a prerequisite makes the README a false claim by omission, fixed per "A false claim is a bug". Otherwise most changes need no README edit at all. GOOD: `run-tests.sh` gained a required `--profile` flag → update the documented command. BANNED: the change added a test case → add a paragraph describing it. - -### Decisions: one home, linked to a goal - -**A decision record owns what a call site may not say.** A rejected alternative, or what something deliberately does not cover, is banned beside the code precisely because the decision record holds it — a standing choice a future reader would otherwise relitigate, where a `CHANGELOG` holds what changed in a release. **The decision log has one home: `docs/decisions.md`**, or `docs/decisions/` split by area once it outgrows one file. `AGENTS.md` carries a one-line index of the titles, so a session or a reviewer sees that a decision exists without loading its reasoning. An entry states the decision, its date, who made it, and the premise it rests on ("valid while X") so it can expire honestly when that premise dies. A decision found anywhere else — an `AGENTS.md` body, a comment, or a README section that is neither a goal nor how one is met — moves there and leaves its index line behind. A goal stays a goal in the README; the log records only what the goal leaves open. - -**Every decision links to a goal or a technical principle.** An entry names the goal it serves or the technical principle under `~/.claude/principles/` it applies; one that can do neither is a missing goal, and an entry already in the repo with neither behind it is a finding. Propose the goal, never a reason of your own — the ask rule above says how. An entry working against a goal or a technical principle stands only while it names the `todo.md` item that ends it. +Prose describing the code as it stands — a comment, a README, an `AGENTS.md`, an API spec — may narrate what is *not* done (a removed step, a call we don't make, a superseded version `we used to X, now Y`, a limitation) in one shape only: where a reader would otherwise **do** something harmful, and the sentence says what to do instead. GOOD: `wrap a direct ./tests/run.sh to put it under the same lock`. BANNED: `run.sh takes no host lock`. A limitation with nothing to do instead belongs in the PR or ticket, because **documenting a limitation is not fixing it**. ### Links and pointers @@ -78,14 +68,22 @@ Default to NO comment. Delete one that is any of: **A pointer is not a definition.** A definition the reader needs to follow the code — what a unit counts, what a term means, what invariant a cache rests on — sits at the code in one line. A pointer to it (`see AGENTS.md §11`) cannot be checked against the code beside it, so it rots invisibly. A pointer carrying rationale — a rejected alternative, the premise behind a standing choice — is correct and stays. -### Negation, history and limitations: name the action, or say nothing +### Decisions: one home, each linked to a goal or a technical principle -Prose describing the code as it stands — a comment, a README, an `AGENTS.md`, an API spec — may narrate what is *not* done (a removed step, a call we don't make, a superseded version `we used to X, now Y`, a limitation) in one shape only: where a reader would otherwise **do** something harmful, and the sentence says what to do instead. GOOD: `wrap a direct ./tests/run.sh to put it under the same lock`. BANNED: `run.sh takes no host lock`. A limitation with nothing to do instead belongs in the PR or ticket, because **documenting a limitation is not fixing it**. +**A decision record owns what a call site may not say.** A rejected alternative, or what something deliberately does not cover, is banned beside the code precisely because the decision record holds it — a standing choice a future reader would otherwise relitigate, where a `CHANGELOG` holds what changed in a release. **The decision log has one home: `docs/decisions.md`**, or `docs/decisions/` split by area once it outgrows one file. `AGENTS.md` carries a one-line index of the titles, so a session or a reviewer sees that a decision exists without loading its reasoning. An entry states the decision, its date, who made it, and the premise it rests on ("valid while X") so it can expire honestly when that premise dies. A decision found anywhere else — an `AGENTS.md` body, a comment, or a README section that is neither a goal nor how one is met — moves there and leaves its index line behind. A goal stays a goal in the README; the log records only what the goal leaves open. + +**Every decision links to a goal or a technical principle.** An entry names the goal it serves or the technical principle under `~/.claude/principles/` it applies; one that can do neither is a missing goal, and an entry already in the repo with neither behind it is a finding. Propose the goal, never a reason of your own — "Ask, don't guess" under "Working loop" says how. An entry working against a goal or a technical principle stands only while it names the `todo.md` item that ends it. + +### README + +**A README covers what a reader needs *before* opening the code**: how it meets its goals, how to build, test, run, and deploy it, and cross-cutting decisions no single file owns. It does **not** narrate an individual symbol, file, or test case — whoever wants to know what a test asserts opens the test, where the answer is exact and cannot drift. + +**"Refresh `README.md` to match" means keep it true, not longer.** A change that alters a build/test/run/deploy step, a required env var, or a prerequisite makes the README a false claim by omission, fixed per "A false claim is a bug". Otherwise most changes need no README edit at all. GOOD: `run-tests.sh` gained a required `--profile` flag → update the documented command. BANNED: the change added a test case → add a paragraph describing it. ### Package README (what someone finds on npm or GitHub) - The public API is the contract, so the README documents it: options, results, events, everything exported. The rule against narrating a file or test case still holds. -- Order: install, the main task, the next task, and so on. The reference half — options tables, in-depth behaviour, low-level API, development — goes below the quick starts. -- Keep every documented behaviour, as terse facts, bullets and tables rather than paragraphs. Where the README is the only record of a behaviour, cutting it is a decision to ask about, not a tidy-up. +- Sections, in order: install, the main task, the next task, and so on. The reference half — options tables, in-depth behaviour, low-level API, development — goes below the quick starts. An intro is a line or two that points at the in-depth section. +- Keep every documented behaviour, as facts, bullets and tables rather than paragraphs. Where the README is the only record of a behaviour, cutting it is a decision to ask about, not a tidy-up. - Write for the app developer using the package. - Top: badges (package version, CI), a one-line tagline that is also the package manifest's description, a feature list, a one-line table of contents. Near the bottom: a table of everything exported. - A guide for migrating from an older major goes in `MIGRATION.md`, linked from one line in the README. -- 2.52.0 From 5028936bb4725b4f2f9dcb7d05c538b45862519f Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 1 Oct 2026 19:45:20 +0200 Subject: [PATCH 3/3] Say each quick start's intro links its in-depth section --- CLAUDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 20a29471..108864f5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -82,7 +82,7 @@ Prose describing the code as it stands — a comment, a README, an `AGENTS.md`, ### Package README (what someone finds on npm or GitHub) - The public API is the contract, so the README documents it: options, results, events, everything exported. The rule against narrating a file or test case still holds. -- Sections, in order: install, the main task, the next task, and so on. The reference half — options tables, in-depth behaviour, low-level API, development — goes below the quick starts. An intro is a line or two that points at the in-depth section. +- Sections, in order: install, the main task, the next task, and so on. The reference half — options tables, in-depth behaviour, low-level API, development — goes below the quick starts. Each quick start opens with a line or two that links its in-depth section. - Keep every documented behaviour, as facts, bullets and tables rather than paragraphs. Where the README is the only record of a behaviour, cutting it is a decision to ask about, not a tidy-up. - Write for the app developer using the package. - Top: badges (package version, CI), a one-line tagline that is also the package manifest's description, a feature list, a one-line table of contents. Near the bottom: a table of everything exported. -- 2.52.0