chore: Testing out AI instructions for shorter comments - #11438
Draft
alin-at-dfinity wants to merge 1 commit into
Draft
chore: Testing out AI instructions for shorter comments#11438alin-at-dfinity wants to merge 1 commit into
alin-at-dfinity wants to merge 1 commit into
Conversation
I asked Claude to rewrite the comments for commit e120aa1 given its current local rules, pointing out that I had modified `~/.claude/CLAUDE.md`. This is the result. For reference, here are the instructions (first section has been there for a while now, the rest I just added) if you want to iterate on them (tweak the rules, then pick a commit you don't like and ask Claude to redo the comments): ```md Try very, very hard to be as concise as you can when writing documents or comments; and when chatting. Unless it's really necessary to refer to some other concept / comment / document section, prefer not to. Definitely do not explain the same concept repeatedly, in multiple locations. Explain it once and simply mention it when actually necessary (i.e. when the statement you are making is likely to be hard to understand without this extra context). - **Why, Not What:** Never comment *what* the code is doing (e.g., avoid `// Reset foo`). Comment only *why* it is being done, or the non-obvious architectural context. - **Micro-Comments Only:** Keep inline comments to one or two hyper-focused lines. No multi-paragraph prose blocks. - **High Signal-to-Noise:** If the code is clear, write zero comments. With very few exceptions, there should be more code than documentation. Else, the code is likely too opaque and needs refactoring. - **Context:** Comments must make sense to a future reader in the context of all of the surrounding code (and codebase), NOT in the context of the changes being made now. Code represents the current state; let git handle history. - **Hierarchy of Detail:** Where context is needed (e.g. "the resources returned here were reserved when...") provide it at the highest appropriate level (e.g. describe the resource reservation model once in the module or crate doc comment, instead of selective bits across function or inline comments). Expect future readers to acquire the full context by reading the documentation of the full hierarchy. ```
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.
[DO NOT MERGE. This is just for reference.]
I asked Claude to rewrite the comments for commit e120aa1 given its current local rules, pointing out that I had modified
~/.claude/CLAUDE.md. This is the result.For reference, here are the instructions if you want to iterate on them (tweak the rules, then pick a commit you don't like and ask Claude to redo the comments):
[I've had the first section for a while now, the rest I just added. I left it all in just in case you tested out the new instructions only and got very different results. I suspect we could get rid of the first.]