Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/docs-authoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ When creating or editing any markdown file, follow the discipline below. These a
- **Prove it.** Before writing any technical claim, know the exact file (and ideally lines) that prove it. If you can't, don't write it. Silence beats speculation: no "appears to", "should", "will", or planned/intended behaviour.
- Fix existing statements that contradict the code.
- **Cut a comment by whole sentences, above the public floor.** Never delete or cut below one sentence the documentation comment on a public or exported symbol, a public structure member, or a package or module. Keep the sentence saying what it does, even where it restates the name, code, or syntax; where unclear, keep the first sentence. Correct a wrong or absent-content claim from the body. If the body was not read, keep the comment and report it. Cut other sentences that restate code, re-describe documented members, or narrate alternatives or reasoning where the code needs only the conclusion, keeping every other sentence word for word. A package or file comment says what the unit is for and never tours its members.
- **Current state only.** Describe the code as it is now, in prose and in comments alike. Never narrate the past ("replaces", "used to", "formerly", "for the first time", "unlike the old") and never name a file, flag, or tool that no longer exists. Future intent lives in a `TODO` in the code, never in the documentation. Name the code a comment describes (a line, a block, the function, or the file); a comment giving the reason the code is written as it is passes. Where no code corresponds, correct the comment to the current fact it carries, and delete it only when none remains. An existing comment, public or private, is kept unless it is commented-out code, every sentence restates the code beneath it, or it narrates a change stating no current fact; a verbose one is tightened by whole sentences, keeping its summary and every reason, constraint, or warning that no other kept sentence gives while cutting its history and the alternatives not taken, and trimming happens only inside the requested scope. A note about a deliberate omission the code depends on and a file header pass this test. An architectural or cross-cutting decision goes in a decision record of its own under [`docs/`](../../docs/index.md). The reason a particular piece of code is written as it is stays in a comment beside that code.
- **Current state only.** Describe the code as it is now, in prose and in comments alike. Never narrate the past ("replaces", "used to", "formerly", "for the first time", "unlike the old") and never name a file, flag, or tool that no longer exists. Future intent lives in a `TODO` in the code, never in the documentation. Name the code a comment describes (a line, a block, the function, or the file); a comment giving the reason the code is written as it is passes. Where no code corresponds, correct the comment to the current fact it carries, and delete it only when none remains. An existing comment, public or private, is kept unless it is commented-out code, every sentence restates the code beneath it, or it narrates a change stating no current fact; a verbose one is tightened by whole sentences, keeping its summary and every reason, constraint, or warning that no other kept sentence gives while cutting its history and the alternatives not taken, and trimming happens only inside the requested scope. Inside that scope, a comment you correct for drift is still tightened, and tightening also cuts a sentence arguing the code is safe, a scenario or consequence no code, test, or document states, or a general explanation of what a language, library, or platform does. A comment the change added is held to the length of a new comment: one sentence saying what the code does, plus at most one for an error, a constraint, a caller duty, or the reason the code cannot show. A note about a deliberate omission the code depends on and a file header pass this test. An architectural or cross-cutting decision goes in a decision record of its own under [`docs/`](../../docs/index.md). The reason a particular piece of code is written as it is stays in a comment beside that code.

## Style

Expand Down
18 changes: 12 additions & 6 deletions .claude/skills/audit-docs/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ argument-hint: '[paths or area to audit; defaults to the active pull request or
Read this whole file before you start. These rules hold however the skill was invoked.

- **Documentation has two parts, and you audit both.** One part is the Markdown pages. The other is the comments in the code: documentation comments, inline comments, and file headers. On a pull request, audit the comments in every code file the diff touched, not only the Markdown.
- **Keep it short.** Match the length to what the change needs. Cover the substance, and add no filler sections, repeated summaries, or boilerplate. On a pull request, the documentation edit is about the size of the code change: fix the sentence the change made false, and add a sentence only for behaviour the change added. A comment you write is one sentence, or two when the second states an error, a constraint, or a caller duty.
- **Keep it short.** Match the length to what the change needs. Cover the substance, and add no filler sections, repeated summaries, or boilerplate. On a pull request, the documentation edit is about the size of the code change: fix the sentence the change made false, and add a sentence only for behaviour the change added. A comment you write is one sentence, or two when the second states an error, a constraint, or a caller duty. A comment the change added is held to the limit in [A comment the change added](#a-comment-the-change-added): tighten a longer one in this run, and never take it past two sentences.
- **Write plain English for people.** Your reader is a developer reading once. Write complete, grammatical sentences, one idea each, with ordinary pronouns and transitions where the meaning is clear. State what the code does. Do not work out scenarios or consequences that no code, test, or document states.
- **Edit only what the request covers.** Edit in full only the files the scope resolves to (see [Scope](#scope)). On a pull request or working changes, those are the files the diff touched. Any other document gets only the edits the change itself requires. A file you opened only for context stays exactly as you found it.
- **Files keep their path and name.** Rename, move, split, merge, or delete a file, or create a directory, only when the request asks for it or the user approves it. Where one looks necessary, ask the user and wait. Where you cannot ask, propose it in your report instead.
Expand Down Expand Up @@ -63,6 +63,7 @@ Run this phase only when there is an active pull request or working changes. Tre
- List what the diff changed in behaviour: added, removed, or modified.
- For each change, update whichever documentation describes that behaviour: a Markdown page, a code comment, or both. Do this even where the pull request did not touch the docs.
- Document only behaviour the change made. Edit the existing sentence the change made false before you consider adding one. A new sentence states the new behaviour and stops.
- A comment gains at most one sentence in this phase. In a file in scope, Phase 3 still judges it afterwards, so a long comment you corrected here is also tightened there.
- Report whether you made changes or found the documentation already accurate.

## Phase 2: audit the Markdown pages
Expand All @@ -85,14 +86,18 @@ Run this phase on every audit, over every code file in scope, whatever Phases 1

### Judge each existing comment with these tests, in order

The first test that applies decides. [`existing-comments.md`](references/existing-comments.md) has before-and-after pairs.
Run test 1 on every comment first. Then the first of tests 2 to 4 that applies decides, except that a comment test 1 corrected skips test 2, so it is still tightened and never deleted. [`existing-comments.md`](references/existing-comments.md) has before-and-after pairs.

1. **Drifted.** It states something the code no longer does. Correct it from the body, and keep the wording that is still true.
2. **Wholly redundant.** Every sentence restates the name, the signature, or the line beneath it, such as `// Increment counter`, and gives no reason, constraint, edge case, or warning. Delete it, unless the floor keeps it.
3. **Verbose.** A useful fact sits inside padding. Keep the summary sentence and each sentence giving a reason, constraint, edge case, or warning that no other kept sentence gives. Cut whole sentences that restate the signature, describe members that have their own comments, walk through the body, describe alternatives that were not taken, tell the history of the code, or repeat a reason already given. This test never removes a whole comment. Put every comment longer than about five lines through this test.
3. **Verbose.** A useful fact sits inside padding. Keep the summary sentence and each sentence giving a reason, constraint, edge case, or warning that no other kept sentence gives. Cut whole sentences that restate the signature, describe members that have their own comments, walk through the body, describe alternatives that were not taken, tell the history of the code, or repeat a reason already given. Also cut a sentence that argues the code is correct or safe, works out a scenario or consequence that no code, test, or document states, or explains what a language, library, or platform does in general. These read like reasons but give none about this code. This test never removes a whole comment. Put every comment longer than about five lines through this test.
4. **Otherwise, it stays as written.**

**Cut by whole sentences.** Keep every sentence you do not cut word for word. Where a kept sentence depends on a cut one ("also", "these"), keep both or cut both. A rewritten or merged sentence is a new claim and needs its own proof. Correct a comment that is both wrong and long before you tighten it.
**Cut by whole sentences.** Keep every sentence you do not cut word for word. Where a kept sentence depends on a cut one ("also", "these"), keep both or cut both. A rewritten or merged sentence is a new claim and needs its own proof.

### A comment the change added

On a pull request or working changes, a comment whose lines the diff added is new writing under review, not an existing comment. It meets the length of a comment you write: one sentence saying what the code does, plus at most one sentence for an error, a constraint, a caller duty, or the one reason the code cannot show. Choose the kept sentences by the tests above, then cut the rest by whole sentences. List each reason you cut in your report, so the author can move it to the pull request description or a decision record. Sentences the diff added to an older comment are held to the same limit; the older sentences stay under the tests above. A comment the diff only moved, with the same lines removed elsewhere in the diff, stays an existing comment, and a licence header is not held to this limit. The floor and the closed delete list still apply.

**The closed delete list.** Besides test 2, delete only:

Expand Down Expand Up @@ -246,12 +251,13 @@ Before you write the report, confirm each item and fix what fails inside the sco
- Every existing list, table, and code block kept its form; any code block you removed only transcribed code and is now a link.
- No hedging, no new subjective adjectives, and no em-dashes or en-dashes in what you wrote.
- No comment was deleted except under the closed list, no public symbol's comment dropped below its floor, and every tightened comment lost whole sentences only.
- Every comment you wrote is at most two sentences, and it sits on a declaration, not above a use.
- Every comment you wrote, and every comment the diff added, is at most two sentences, and a comment you wrote sits on a declaration, not above a use. No comment you edited grew by more than one Phase 1 sentence.
- Every comment longer than about five lines in a code file in scope went through test 3, and the report gives the line count before and after of each one it tightened.
- Each page you edited in full opens by naming its subject, and nothing in it stops a newcomer, or your report names the place that does.
- Every diagram has `accTitle` and `accDescr` and parses, and every image has real alt text. Every table you touched still has matching cell counts, and nested lists render.
- Every file link resolves to a file, not a directory.
- Each file you edited is no longer than the change needed. Record each file's line count before and after in the report.

## Reminder

Keep every edit as short as the change allows, in plain English a developer understands on the first read. Audit the comments in every code file in scope, not only the Markdown.
Keep every edit as short as the change allows, in plain English a developer understands on the first read. Audit the comments in every code file in scope, not only the Markdown. Tighten a long comment the change added or touched, and add at most one sentence to any comment.
13 changes: 8 additions & 5 deletions .claude/skills/audit-docs/agents/surface-auditor.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,12 @@ A comment can be true, non-repeated, and still carry sentences its reader does n
- a sentence listing or re-describing members that carry their own comments, which is how a package or type comment turns into a tour of the interface: each member's own comment, and the reference the language generates from them, already carry it;
- a sentence describing an alternative that was considered and not taken, where another sentence already states the approach the code uses;
- a sentence telling the history of the code, such as what an earlier version did;
- a sentence repeating a reason, constraint, or warning that another kept sentence already gives.
- a sentence repeating a reason, constraint, or warning that another kept sentence already gives;
- a sentence arguing that the code is correct or safe;
- a sentence working out a scenario or consequence that no code, test, or document states;
Comment thread
AlexJSully marked this conversation as resolved.
Resolved
- a sentence explaining what a language, library, or platform does in general rather than what this code does with it.

Report the comment's own sentences in two verbatim sets: `KEEP`, the sentences carrying something the code does not show, and `CUT`, each sentence of the kinds above beside the code string or member comment it restates. **`KEEP` is never empty for any comment reported here, public or private, documentation or inline**: keep its summary sentence, or the first sentence if unclear. This list tightens a comment and never removes one; a comment whose every sentence restates the line beneath it, with nothing kept, is outside this list and the caller judges it. A sentence giving a reason, a constraint, an edge case, a warning, or an explanation of non-obvious logic that no other kept sentence already gives is always `KEEP`, since that is what the code cannot show. A sentence that only restates one of those, argues against an alternative not taken, or tells the history is `CUT`. A wrong comment is corrected from the body, never deleted; an unread body means keep and report it. Never write replacement text: the caller writes any new wording from code it opens itself. A wrong comment also goes under `CONTRADICTED`, and the caller corrects it before cutting.
Report the comment's own sentences in two verbatim sets: `KEEP`, the sentences carrying something the code does not show, and `CUT`, each sentence of the kinds above beside the code string or member comment it restates. **`KEEP` is never empty for any comment reported here, public or private, documentation or inline**: keep its summary sentence, or the first sentence if unclear. This list tightens a comment and never removes one; a comment whose every sentence restates the line beneath it, with nothing kept, is outside this list and the caller judges it. A sentence giving a reason, a constraint, an edge case, a warning, or an explanation of non-obvious logic about this code that no other kept sentence already gives is `KEEP`, since that is what the code cannot show. A sentence that only restates one of those, argues against an alternative not taken, tells the history, or is one of the last three kinds above is `CUT`, even where it reads like a reason. `KEEP` marks what the code cannot show, not what must survive: the caller may still cut a `KEEP` sentence under its own length limit for a comment the change added. A wrong comment is corrected from the body, never deleted; an unread body means keep and report it. Never write replacement text: the caller writes any new wording from code it opens itself. A wrong comment also goes under `CONTRADICTED`, and the caller corrects it before cutting.

```python
# We need to check if the user is eligible for the discount.
Expand Down Expand Up @@ -166,7 +169,7 @@ A contradiction is reported only with a verbatim string copied out of the body.

- **A signature, a type, or a declaration proves what is declared and never what runs.** A function named `delete_user` returning a success type settles nothing about whether a row is removed.
- **A comment cannot be evidence about another comment.** Where a file-level header and a symbol's own comment disagree, quote the body or report neither.
- **Where the whole body was read and no string either supports or contradicts the comment, report nothing.** The outcome may be fixed by a value supplied elsewhere, or the comment may state something the body cannot show. Silence costs the caller one entry; a guess puts an invented contradiction into the audit.
- **Where the whole body was read and no string either supports or contradicts the comment, report nothing under `CONTRADICTED`.** The outcome may be fixed by a value supplied elsewhere, or the comment may state something the body cannot show. Silence costs the caller one entry; a guess puts an invented contradiction into the audit.

## Output format returned

Expand Down Expand Up @@ -200,9 +203,9 @@ DECLARATION: <file path of the declaration>
BLOCKED BY: <outside the paths handed in / inside them and not opened>

VERBOSE
<file path> :: <symbol, or the line the comment sits above>
<file path> :: <symbol, or the line the comment sits above> :: <the comment's line count>
KEEP: <each sentence carrying what the code does not show, verbatim, with any credential value replaced by [REDACTED]; never empty, with the summary sentence or, if unclear, the first sentence always here>
CUT: <each sentence to delete, verbatim> :: <the code string or member comment it restates, or the later sentence that already states the same conclusion>
CUT: <each sentence to delete, verbatim> :: <the code string or member comment it restates, the later sentence that already states the same conclusion, or its padding kind: safety argument, unstated scenario, or general explanation>

COUNTS
Files in scope: <n>
Expand Down
Loading