[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79FKS8WR6VJPFDHX88EN00Q":3,"skill-same:01M79FKS8WR6VJPFDHX88EN00Q":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":33,"ownerDescription":6,"updatedAt":34,"install":35,"resources":48},"01M79FKS8WR6VJPFDHX88EN00Q","code-comments",null,"The Penca commenting standard — comment WHY, never WHAT. Self-documenting code and precise names carry the \"what\"; comments are reserved for non-obvious rationale, correctness invariants, third-party\u002Fspec quirks, regex intent, and TODO(CHA-NNN) pointers. The default action on a comment is DELETE, not add. Read preemptively while implementing so comments are good the first time (the primary use — NOT a cleanup pass, NOT wired into \u002Fdo-issue orchestration); invoke ad-hoc with a scope to prune an over-commented file by hand.","penca-io\u002Fpenca","penca-io","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F294652540?v=4","01M79FKD3WVDHQXKBT43KMQFPR","Penca","01M79FKD4JJK7894AKV1R7RHTR",8,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fpenca-io\u002Fpenca\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcode-comments\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: code-comments\ndescription: The Penca commenting standard — comment WHY, never WHAT. Self-documenting code and precise names carry the \"what\"; comments are reserved for non-obvious rationale, correctness invariants, third-party\u002Fspec quirks, regex intent, and TODO(CHA-NNN) pointers. The default action on a comment is DELETE, not add. Read preemptively while implementing so comments are good the first time (the primary use — NOT a cleanup pass, NOT wired into \u002Fdo-issue orchestration); invoke ad-hoc with a scope to prune an over-commented file by hand.\nargument-hint: \"[\u003Cscope> — file\u002Fcrate\u002Fdir to audit; omit for guidance-only]\"\nallowed-tools: Read Grep Glob Bash Edit WebFetch\n---\n\n# Code comments\n\nThe Penca commenting standard. **Comments are an apology, not a requirement — good code mostly documents itself.** A comment earns its place only when it tells the reader something the code and its names cannot: *why* this line exists, *why* it's written this odd way, what invariant it protects, or what third-party quirk forced it. Everything else is noise, and noise is worse than nothing — it rots, it lies after the code changes, and it buries the few comments that matter.\n\n**The default action on any comment is DELETE.** This skill's bias is subtraction. The repo's problem is over-commenting, not under-commenting; adding a comment is the rare, deliberate exception, not the reflex.\n\n## The one test\n\nBefore writing or keeping a comment, ask:\n\n> **Would deleting this comment lose information the code + names + types + tests don't already carry?**\n\nIf **no** → delete it (or never write it).\nIf **yes** → first try to make the answer *no* by improving the code: rename a variable, extract a named constant, split a function, add a type. Only when the \"why\" genuinely cannot live in the code does it become a comment.\n\nA comment is the fallback for what you couldn't express in the code itself — reach for a rename or an extraction first, a comment last.\n\n## When to use this skill\n\n**Primary use — read for guidance while implementing.** `\u002Fdo-issue`'s \"read the conventions up front\" step loads this SKILL.md preemptively, alongside `docs\u002Fstyle-guide.md`. The implementer internalizes the standard and writes good comments *the first time*, so no cleanup pass is ever needed. This is the whole point: proactive, not reactive.\n\n**Secondary use — ad-hoc audit.** Invoke `\u002Fcode-comments \u003Cscope>` to prune an existing over-commented file, crate, or directory by hand. See \"Ad-hoc audit mode\" below. This is a manual, on-demand action a human chooses.\n\n**This skill is deliberately NOT:**\n- **A `\u002Fdo-issue` cleanup pass.** It is not an `orch:run-cleanup` step and is never auto-invoked by the drain. Good comments come from the implementer knowing the standard, not from a bot re-commenting after the fact. (Contrast `\u002Fclean-code-refactor` and `\u002Ftracing-instrument`, which *are* wired as cleanup passes.)\n- **The heavy two-phase kata-gated machinery** of `\u002Fclean-code-refactor`. There is no plan-draft\u002Fplan-reviewer cycle here — comment edits are behavior-preserving and low-risk. The ad-hoc mode is a straight walk-and-prune.\n- **A license to touch logic.** Comment edits change comments only. If you spot a real bug or a refactor while auditing, that's a separate `\u002Fdo-issue` ticket, not a smuggled diff.\n\n## Grounding principles\n\nInlined here intentionally — this skill is a durable artifact and must remain self-sufficient.\n\n### 1. Comment the WHY; let the code be the WHAT\n\nThe code already says what it does. A comment that restates the next line is pure redundancy — the #1 form of comment bloat in this repo.\n\n```rust\n\u002F\u002F BAD — restates the code\n\u002F\u002F increment the counter\ncounter += 1;\n\n\u002F\u002F loop over every segment and read its bytes\nfor segment in segments {\n    let bytes = segment.read()?;\n}\n```\n\n```rust\n\u002F\u002F GOOD — no comment; the code is self-evident\ncounter += 1;\n\nfor segment in segments {\n    let bytes = segment.read()?;\n}\n```\n\nKeep the comment only where the *reason* is invisible in the code:\n\n```rust\n\u002F\u002F GOOD — the WHY is not in the code (pydantic-core recursion_guard.rs shape)\n\u002F\u002F saturating_add is faster than checked_add (no error path) and the recursion\n\u002F\u002F limit is hit long before u8 overflows, so saturation is never actually reached.\nself.depth = self.depth.saturating_add(1);\n```\n\n### 2. Only comment genuine complexity or non-obvious rationale\n\nIf a function is clear, it needs no comment. Reserve prose for business logic, a subtle algorithm step, a correctness invariant, or a decision a future reader would otherwise \"fix\" and break.\n\n```python\n# BAD — every line narrated\ndef hash_key(data):\n    h = 0                        # the hash\n    n = len(data)                # length of the string\n    for i in range(n):           # loop over each character\n        c = ord(data[i])         # get the character code\n        h = (h \u003C\u003C 5) - h + c     # update the hash\n    return h\n```\n\n```python\n# GOOD — one comment, only where the operation is non-obvious\ndef hash_key(data):\n    h = 0\n    for ch in data:\n        # Polynomial rolling hash, 31*h + c: (h \u003C\u003C 5) - h stands in for the\n        # *31 (32 - 1), same multiplier as Java's String.hashCode.\n        h = (h \u003C\u003C 5) - h + ord(ch)\n    return h & 0xFFFFFFFF  # clamp to 32-bit; callers index a fixed-size table\n```\n\n### 3. No commented-out code\n\nVersion control is the history. Dead code behind `\u002F\u002F` is a distraction that readers must mentally evaluate and that greps pollute.\n\n```rust\n\u002F\u002F BAD\npersist_committed(tx)?;\n\u002F\u002F persist_all(tx)?;\n\u002F\u002F legacy_flush(tx)?;\n```\n\n```rust\n\u002F\u002F GOOD\npersist_committed(tx)?;\n```\n\nIf you might need it back, it's in `git log`. Delete it.\n\n### 4. No journal \u002F changelog comments\n\nWho-changed-what-when belongs in `git log`, the commit body, or an ADR — never in a comment block that grows forever and drifts from reality.\n\n```python\n# BAD\n# 2026-05-12 nhobin: switched locked counter -> sequence\n# 2026-06-01 nhobin: added abort axis\n# 2026-06-20 nhobin: purge now owns aborts\ndef next_seq(...): ...\n```\n\n```python\n# GOOD — the function stands alone; history is in git \u002F the ADR\ndef next_seq(...): ...\n```\n\nThis includes citing tickets as history. `\u002F\u002F CHA-444 replaced the old clamp` is archaeology; a reader doesn't need it. (A *forward* pointer — `TODO(CHA-155)` for unfinished work — is different and encouraged; see principle 8.)\n\n### 5. No positional markers or section-divider banners\n\n`\u002F\u002F ======== Handlers ========`, `\u002F\u002F ---- config ----`, `\u002F\u002F\u002F\u002F\u002F\u002F\u002F\u002F setup` add visual noise. Structure comes from function boundaries, module layout, and whitespace — not ASCII banners.\n\n### 6. Third-party \u002F spec quirks — DO comment (this is what comments are FOR)\n\nUndocumented library behavior, a deliberate deviation from a spec to match reality, a workaround for an upstream bug — a future reader *will* try to \"clean this up\" and break it unless you tell them why. These are the highest-value comments in the codebase.\n\n```python\n# GOOD — requests\u002Fsessions.py shape: deliberate spec deviation, flagged\n# Do what browsers do, despite the standard: turn 302s into GETs.\nif response.status_code == codes.found and method != \"HEAD\":\n    method = \"GET\"\n\n# GOOD — a real Penca driver quirk\n# adbc_driver_manager calls prepare() unconditionally in _prepare_execute,\n# so even a bare no-param SELECT takes the prepared path. Don't \"optimize\"\n# it away — the driver, not us, decides. See CHA-355.\n```\n\nAnchor the quirk to a source of truth where one exists (an upstream issue number, an RFC section, a Linear ticket), the way pydantic-core writes `\u002F\u002F see #143 this is used as a backup in case the identity check fails`.\n\n### 7. Correctness invariants, safety, and empirical constants — DO comment\n\nWhy a value is *this* value, why an ordering is load-bearing, what breaks if the invariant is violated.\n\n```rust\n\u002F\u002F GOOD — load-bearing invariant that the code alone doesn't reveal\n\u002F\u002F Swap in a FRESH catalog_list per derived context: a cloned SessionState\n\u002F\u002F keeps catalog_list Arc-shared, so two units would otherwise register their\n\u002F\u002F tables into the SAME catalog and collide on names.\n.with_catalog_list(Arc::new(MemoryCatalogProviderList::new()))\n```\n\n```rust\n\u002F\u002F GOOD — empirically-tuned constant (pydantic-core shape)\n\u002F\u002F Trial and error: 16 is the sweet spot; larger makes the array lookups in\n\u002F\u002F the hot path measurably slower.\nconst ARRAY_SIZE: usize = 16;\n```\n\n```python\n# GOOD — ordering rationale that prevents a real bug (requests shape)\n# Extract keys first to avoid mutating the dict while iterating it.\nnone_keys = [k for k, v in merged.items() if v is None]\nfor key in none_keys:\n    del merged[key]\n```\n\n### 8. Regex — always comment expected input and matching behavior\n\nRegexes are write-once, read-never. State what they match, with a concrete example.\n\n```python\n# GOOD\n# Matches \"cha-\u003Cdigits>\" case-insensitively, capturing the number:\n#   \"CHA-432\" -> \"432\", \"cha-1\" -> \"1\". Leading zeros preserved.\nTICKET_RE = re.compile(r\"cha-(\\d+)\", re.IGNORECASE)\n```\n\nRust's `x` (verbose) flag or an inline example comment serves the same purpose for `regex` crate patterns.\n\n### 9. TODOs always reference a Linear ticket: `TODO(CHA-NNN)`\n\nA bare `TODO` \u002F `FIXME` is untracked debt that bloats the codebase and never gets done. Every TODO names an actionable Linear issue, so the future work is greppable (`grep -r CHA-155`) and lives in the tracker, not just the source.\n\n```rust\n\u002F\u002F BAD\n\u002F\u002F TODO: stream this instead of buffering the whole SELECT\n\n\u002F\u002F GOOD\n\u002F\u002F TODO(CHA-155): stream batches and emit one Change per batch instead of\n\u002F\u002F buffering the whole SELECT result set.\n```\n\nIf you have a TODO with no ticket, mint the ticket first (or fold the fix into the current change). This mirrors `docs\u002Fstyle-guide.md` → \"Future improvements and TODOs\".\n\n### 10. Doc comments (`\u002F\u002F\u002F`, docstrings) state the current contract — not history or internals\n\nPublic doc comments describe what the API *is* and its contract for a caller: inputs, outputs, invariants, panics\u002Ferrors. They do **not** narrate internal mechanics, derivations, or what a prior version did — those leak implementation detail and rot. This is the same rule `docs\u002Fstyle-guide.md` applies to proto comments (\"describe current wire semantics — not history or internal derivations\"), extended to all doc comments.\n\n```rust\n\u002F\u002F\u002F BAD — internal mechanics + history in a public doc comment\n\u002F\u002F\u002F Returns the tie-breaker. Previously we derived this from data_log_prefix_uuid\n\u002F\u002F\u002F but CHA-380 changed it; internally this reads the snapshot fast-path then\n\u002F\u002F\u002F falls back to the persist substrate.\npub fn tie_breaker(&self) -> Uuid { ... }\n```\n\n```rust\n\u002F\u002F\u002F GOOD — the caller's contract, nothing else\n\u002F\u002F\u002F The deterministic tie-breaker for rows sharing a commit sequence.\n\u002F\u002F\u002F Stable across reads; two rows never share one within a table.\npub fn tie_breaker(&self) -> Uuid { ... }\n```\n\n## Reference exemplars\n\nThree real repositories whose comment discipline is the standard to match — one per relevant language, plus the canonical anti-pattern catalog. Fetch with `WebFetch` when you want fresh examples; do not treat Penca's *current* comments as exemplary (over-commenting is exactly the problem this skill exists to fix).\n\n- **[psf\u002Frequests](https:\u002F\u002Fgithub.com\u002Fpsf\u002Frequests) (Python)** — `src\u002Frequests\u002Fsessions.py`, `adapters.py`, `utils.py`. Nearly every inline comment justifies a decision: a browser-compat deviation, an RFC exception kept for backwards compatibility, a security consideration (withholding `Proxy-Authorization` over TLS to avoid leaking it), an edge case that prevents a hang. The gold standard for \"comment the WHY\" in Python.\n- **[pydantic\u002Fpydantic-core](https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-core) (Rust)** — `src\u002Frecursion_guard.rs`, `src\u002Flookup_key.rs`, `src\u002Fserializers\u002F`. Comments document segfault-prevention rationale, performance trade-offs (`saturating_add` vs `checked_add`), platform stack-size constraints (wasm\u002FPyPy), empirically-tuned constants, and defensive-`Drop` safety. The gold standard for Rust.\n- **[ryanmcdermott\u002Fclean-code-javascript § Comments](https:\u002F\u002Fgithub.com\u002Fryanmcdermott\u002Fclean-code-javascript#comments)** — the canonical catalog of what NOT to do: comment only business-logic complexity, no commented-out code, no journal comments, no positional markers. Language-agnostic; the source of principles 2–5 above.\n\nSupplementary, on demand: the **Linux kernel** networking\u002Fmm subsystems are the C\u002Fsystem gold standard for explaining *why a hardware workaround or memory-safety hack is necessary* — the same instinct as principle 6, at the systems level.\n\n## Ad-hoc audit mode\n\nWhen invoked as `\u002Fcode-comments \u003Cscope>` (a file, crate, or directory), walk the scope and prune. This is a light, single-pass, behavior-preserving edit — no kata graph, no plan gate.\n\n1. **Read the scope in full.** You must understand the code to judge whether a comment carries real \"why\".\n\n2. **Grep for the high-frequency smells**, then judge each hit against the principles — grep *locates* candidates, it does not decide:\n   ```bash\n   # commented-out code (statements behind \u002F\u002F  or  #, not prose)\n   rg -n '^\\s*(\u002F\u002F|#)\\s*[a-z_]+\\s*[({=.].*[;):]?\\s*$' \u003Cscope>\n   # journal \u002F dated comments\n   rg -n '(\u002F\u002F|#).*(20[0-9]{2}[-\u002F][0-9]{2}|changelog|updated by|history:)' \u003Cscope>\n   # positional-marker banners\n   rg -n '(\u002F\u002F|#)\\s*[=\\-*]{4,}' \u003Cscope>\n   # bare TODO\u002FFIXME without a ticket (rg's default engine has no look-around,\n   # so filter with a second pass rather than a negative look-ahead)\n   rg -n '(TODO|FIXME|XXX)' \u003Cscope> | rg -v 'CHA-'\n   ```\n\n3. **For each comment, apply the one test:**\n   - **Redundant** (restates the code) → delete.\n   - **Commented-out code \u002F journal \u002F positional marker** → delete.\n   - **Bare TODO\u002FFIXME** → mint or find the Linear ticket and rewrite as `TODO(CHA-NNN)`; if the fix is trivial and in-scope, do it and delete the TODO. Never leave it bare.\n   - **Weak why-comment** (gestures at a reason but vaguely) → tighten it, or replace the comment with a rename\u002Fextraction that makes it unnecessary.\n   - **Genuine why \u002F invariant \u002F quirk \u002F regex \u002F contract** → keep. Add a *missing* why-comment only where a real, non-obvious rationale is currently undocumented — sparingly.\n\n4. **Commit** comment-only changes. Conventional type `docs` (comments are documentation-in-code): `docs(\u003Cscope>): prune redundant comments`. If the audit is part of a larger change, fold it into that change's commits instead of a standalone one.\n\n5. **Gate.** Run `just check` once before opening a PR — comment edits rarely break it, but a mangled doc-comment or an unclosed block comment can. Route through `just`, never bare `cargo`\u002F`ruff`.\n\nScope discipline: comments only. A tempting refactor or a real bug found mid-audit is a separate `\u002Fdo-issue` ticket, surfaced to the user — not bundled into a `docs:` commit.\n\n## Relationship to other skills and docs\n\n- **`\u002Fclean-code-refactor`** is the natural partner: its self-documenting-code principles (meaningful names, small single-responsibility functions, no aliasing) are what make comments unnecessary in the first place. When the one test says \"improve the code instead of commenting,\" that improvement is often a `\u002Fclean-code-refactor` candidate.\n- **`docs\u002Fstyle-guide.md`** owns the `TODO(CHA-NNN)` convention (principle 9) and the proto-comment-hygiene rule that principle 10 generalizes. This skill is the fuller treatment; the style guide is the quick reference.\n- **`docs\u002Fdevelopment-methodology-guide.md`** → KISS: \"document *why* complexity exists\" is the same instinct as principle 7, at the design level (record necessary complexity's rationale in `docs\u002Fdesign-decisions.md`, not scattered comments).\n","# Code comments\n\nThe Penca commenting standard. **Comments are an apology, not a requirement — good code mostly documents itself.** A comment earns its place only when it tells the reader something the code and its names cannot: *why* this line exists, *why* it's written this odd way, what invariant it protects, or what third-party quirk forced it. Everything else is noise, and noise is worse than nothing — it rots, it lies after the code changes, and it buries the few comments that matter.\n\n**The default action on any comment is DELETE.** This skill's bias is subtraction. The repo's problem is over-commenting, not under-commenting; adding a comment is the rare, deliberate exception, not the reflex.\n\n## The one test\n\nBefore writing or keeping a comment, ask:\n\n> **Would deleting this comment lose information the code + names + types + tests don't already carry?**\n\nIf **no** → delete it (or never write it).\nIf **yes** → first try to make the answer *no* by improving the code: rename a variable, extract a named constant, split a function, add a type. Only when the \"why\" genuinely cannot live in the code does it become a comment.\n\nA comment is the fallback for what you couldn't express in the code itself — reach for a rename or an extraction first, a comment last.\n\n## When to use this skill\n\n**Primary use — read for guidance while implementing.** `\u002Fdo-issue`'s \"read the conventions up front\" step loads this SKILL.md preemptively, alongside `docs\u002Fstyle-guide.md`. The implementer internalizes the standard and writes good comments *the first time*, so no cleanup pass is ever needed. This is the whole point: proactive, not reactive.\n\n**Secondary use — ad-hoc audit.** Invoke `\u002Fcode-comments \u003Cscope>` to prune an existing over-commented file, crate, or directory by hand. See \"Ad-hoc audit mode\" below. This is a manual, on-demand action a human chooses.\n\n**This skill is deliberately NOT:**\n- **A `\u002Fdo-issue` cleanup pass.** It is not an `orch:run-cleanup` step and is never auto-invoked by the drain. Good comments come from the implementer knowing the standard, not from a bot re-commenting after the fact. (Contrast `\u002Fclean-code-refactor` and `\u002Ftracing-instrument`, which *are* wired as cleanup passes.)\n- **The heavy two-phase kata-gated machinery** of `\u002Fclean-code-refactor`. There is no plan-draft\u002Fplan-reviewer cycle here — comment edits are behavior-preserving and low-risk. The ad-hoc mode is a straight walk-and-prune.\n- **A license to touch logic.** Comment edits change comments only. If you spot a real bug or a refactor while auditing, that's a separate `\u002Fdo-issue` ticket, not a smuggled diff.\n\n## Grounding principles\n\nInlined here intentionally — this skill is a durable artifact and must remain self-sufficient.\n\n### 1. Comment the WHY; let the code be the WHAT\n\nThe code already says what it does. A comment that restates the next line is pure redundancy — the #1 form of comment bloat in this repo.\n\n```rust\n\u002F\u002F BAD — restates the code\n\u002F\u002F increment the counter\ncounter += 1;\n\n\u002F\u002F loop over every segment and read its bytes\nfor segment in segments {\n    let bytes = segment.read()?;\n}\n```\n\n```rust\n\u002F\u002F GOOD — no comment; the code is self-evident\ncounter += 1;\n\nfor segment in segments {\n    let bytes = segment.read()?;\n}\n```\n\nKeep the comment only where the *reason* is invisible in the code:\n\n```rust\n\u002F\u002F GOOD — the WHY is not in the code (pydantic-core recursion_guard.rs shape)\n\u002F\u002F saturating_add is faster than checked_add (no error path) and the recursion\n\u002F\u002F limit is hit long before u8 overflows, so saturation is never actually reached.\nself.depth = self.depth.saturating_add(1);\n```\n\n### 2. Only comment genuine complexity or non-obvious rationale\n\nIf a function is clear, it needs no comment. Reserve prose for business logic, a subtle algorithm step, a correctness invariant, or a decision a future reader would otherwise \"fix\" and break.\n\n```python\n# BAD — every line narrated\ndef hash_key(data):\n    h = 0                        # the hash\n    n = len(data)                # length of the string\n    for i in range(n):           # loop over each character\n        c = ord(data[i])         # get the character code\n        h = (h \u003C\u003C 5) - h + c     # update the hash\n    return h\n```\n\n```python\n# GOOD — one comment, only where the operation is non-obvious\ndef hash_key(data):\n    h = 0\n    for ch in data:\n        # Polynomial rolling hash, 31*h + c: (h \u003C\u003C 5) - h stands in for the\n        # *31 (32 - 1), same multiplier as Java's String.hashCode.\n        h = (h \u003C\u003C 5) - h + ord(ch)\n    return h & 0xFFFFFFFF  # clamp to 32-bit; callers index a fixed-size table\n```\n\n### 3. No commented-out code\n\nVersion control is the history. Dead code behind `\u002F\u002F` is a distraction that readers must mentally evaluate and that greps pollute.\n\n```rust\n\u002F\u002F BAD\npersist_committed(tx)?;\n\u002F\u002F persist_all(tx)?;\n\u002F\u002F legacy_flush(tx)?;\n```\n\n```rust\n\u002F\u002F GOOD\npersist_committed(tx)?;\n```\n\nIf you might need it back, it's in `git log`. Delete it.\n\n### 4. No journal \u002F changelog comments\n\nWho-changed-what-when belongs in `git log`, the commit body, or an ADR — never in a comment block that grows forever and drifts from reality.\n\n```python\n# BAD\n# 2026-05-12 nhobin: switched locked counter -> sequence\n# 2026-06-01 nhobin: added abort axis\n# 2026-06-20 nhobin: purge now owns aborts\ndef next_seq(...): ...\n```\n\n```python\n# GOOD — the function stands alone; history is in git \u002F the ADR\ndef next_seq(...): ...\n```\n\nThis includes citing tickets as history. `\u002F\u002F CHA-444 replaced the old clamp` is archaeology; a reader doesn't need it. (A *forward* pointer — `TODO(CHA-155)` for unfinished work — is different and encouraged; see principle 8.)\n\n### 5. No positional markers or section-divider banners\n\n`\u002F\u002F ======== Handlers ========`, `\u002F\u002F ---- config ----`, `\u002F\u002F\u002F\u002F\u002F\u002F\u002F\u002F setup` add visual noise. Structure comes from function boundaries, module layout, and whitespace — not ASCII banners.\n\n### 6. Third-party \u002F spec quirks — DO comment (this is what comments are FOR)\n\nUndocumented library behavior, a deliberate deviation from a spec to match reality, a workaround for an upstream bug — a future reader *will* try to \"clean this up\" and break it unless you tell them why. These are the highest-value comments in the codebase.\n\n```python\n# GOOD — requests\u002Fsessions.py shape: deliberate spec deviation, flagged\n# Do what browsers do, despite the standard: turn 302s into GETs.\nif response.status_code == codes.found and method != \"HEAD\":\n    method = \"GET\"\n\n# GOOD — a real Penca driver quirk\n# adbc_driver_manager calls prepare() unconditionally in _prepare_execute,\n# so even a bare no-param SELECT takes the prepared path. Don't \"optimize\"\n# it away — the driver, not us, decides. See CHA-355.\n```\n\nAnchor the quirk to a source of truth where one exists (an upstream issue number, an RFC section, a Linear ticket), the way pydantic-core writes `\u002F\u002F see #143 this is used as a backup in case the identity check fails`.\n\n### 7. Correctness invariants, safety, and empirical constants — DO comment\n\nWhy a value is *this* value, why an ordering is load-bearing, what breaks if the invariant is violated.\n\n```rust\n\u002F\u002F GOOD — load-bearing invariant that the code alone doesn't reveal\n\u002F\u002F Swap in a FRESH catalog_list per derived context: a cloned SessionState\n\u002F\u002F keeps catalog_list Arc-shared, so two units would otherwise register their\n\u002F\u002F tables into the SAME catalog and collide on names.\n.with_catalog_list(Arc::new(MemoryCatalogProviderList::new()))\n```\n\n```rust\n\u002F\u002F GOOD — empirically-tuned constant (pydantic-core shape)\n\u002F\u002F Trial and error: 16 is the sweet spot; larger makes the array lookups in\n\u002F\u002F the hot path measurably slower.\nconst ARRAY_SIZE: usize = 16;\n```\n\n```python\n# GOOD — ordering rationale that prevents a real bug (requests shape)\n# Extract keys first to avoid mutating the dict while iterating it.\nnone_keys = [k for k, v in merged.items() if v is None]\nfor key in none_keys:\n    del merged[key]\n```\n\n### 8. Regex — always comment expected input and matching behavior\n\nRegexes are write-once, read-never. State what they match, with a concrete example.\n\n```python\n# GOOD\n# Matches \"cha-\u003Cdigits>\" case-insensitively, capturing the number:\n#   \"CHA-432\" -> \"432\", \"cha-1\" -> \"1\". Leading zeros preserved.\nTICKET_RE = re.compile(r\"cha-(\\d+)\", re.IGNORECASE)\n```\n\nRust's `x` (verbose) flag or an inline example comment serves the same purpose for `regex` crate patterns.\n\n### 9. TODOs always reference a Linear ticket: `TODO(CHA-NNN)`\n\nA bare `TODO` \u002F `FIXME` is untracked debt that bloats the codebase and never gets done. Every TODO names an actionable Linear issue, so the future work is greppable (`grep -r CHA-155`) and lives in the tracker, not just the source.\n\n```rust\n\u002F\u002F BAD\n\u002F\u002F TODO: stream this instead of buffering the whole SELECT\n\n\u002F\u002F GOOD\n\u002F\u002F TODO(CHA-155): stream batches and emit one Change per batch instead of\n\u002F\u002F buffering the whole SELECT result set.\n```\n\nIf you have a TODO with no ticket, mint the ticket first (or fold the fix into the current change). This mirrors `docs\u002Fstyle-guide.md` → \"Future improvements and TODOs\".\n\n### 10. Doc comments (`\u002F\u002F\u002F`, docstrings) state the current contract — not history or internals\n\nPublic doc comments describe what the API *is* and its contract for a caller: inputs, outputs, invariants, panics\u002Ferrors. They do **not** narrate internal mechanics, derivations, or what a prior version did — those leak implementation detail and rot. This is the same rule `docs\u002Fstyle-guide.md` applies to proto comments (\"describe current wire semantics — not history or internal derivations\"), extended to all doc comments.\n\n```rust\n\u002F\u002F\u002F BAD — internal mechanics + history in a public doc comment\n\u002F\u002F\u002F Returns the tie-breaker. Previously we derived this from data_log_prefix_uuid\n\u002F\u002F\u002F but CHA-380 changed it; internally this reads the snapshot fast-path then\n\u002F\u002F\u002F falls back to the persist substrate.\npub fn tie_breaker(&self) -> Uuid { ... }\n```\n\n```rust\n\u002F\u002F\u002F GOOD — the caller's contract, nothing else\n\u002F\u002F\u002F The deterministic tie-breaker for rows sharing a commit sequence.\n\u002F\u002F\u002F Stable across reads; two rows never share one within a table.\npub fn tie_breaker(&self) -> Uuid { ... }\n```\n\n## Reference exemplars\n\nThree real repositories whose comment discipline is the standard to match — one per relevant language, plus the canonical anti-pattern catalog. Fetch with `WebFetch` when you want fresh examples; do not treat Penca's *current* comments as exemplary (over-commenting is exactly the problem this skill exists to fix).\n\n- **[psf\u002Frequests](https:\u002F\u002Fgithub.com\u002Fpsf\u002Frequests) (Python)** — `src\u002Frequests\u002Fsessions.py`, `adapters.py`, `utils.py`. Nearly every inline comment justifies a decision: a browser-compat deviation, an RFC exception kept for backwards compatibility, a security consideration (withholding `Proxy-Authorization` over TLS to avoid leaking it), an edge case that prevents a hang. The gold standard for \"comment the WHY\" in Python.\n- **[pydantic\u002Fpydantic-core](https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-core) (Rust)** — `src\u002Frecursion_guard.rs`, `src\u002Flookup_key.rs`, `src\u002Fserializers\u002F`. Comments document segfault-prevention rationale, performance trade-offs (`saturating_add` vs `checked_add`), platform stack-size constraints (wasm\u002FPyPy), empirically-tuned constants, and defensive-`Drop` safety. The gold standard for Rust.\n- **[ryanmcdermott\u002Fclean-code-javascript § Comments](https:\u002F\u002Fgithub.com\u002Fryanmcdermott\u002Fclean-code-javascript#comments)** — the canonical catalog of what NOT to do: comment only business-logic complexity, no commented-out code, no journal comments, no positional markers. Language-agnostic; the source of principles 2–5 above.\n\nSupplementary, on demand: the **Linux kernel** networking\u002Fmm subsystems are the C\u002Fsystem gold standard for explaining *why a hardware workaround or memory-safety hack is necessary* — the same instinct as principle 6, at the systems level.\n\n## Ad-hoc audit mode\n\nWhen invoked as `\u002Fcode-comments \u003Cscope>` (a file, crate, or directory), walk the scope and prune. This is a light, single-pass, behavior-preserving edit — no kata graph, no plan gate.\n\n1. **Read the scope in full.** You must understand the code to judge whether a comment carries real \"why\".\n\n2. **Grep for the high-frequency smells**, then judge each hit against the principles — grep *locates* candidates, it does not decide:\n   ```bash\n   # commented-out code (statements behind \u002F\u002F  or  #, not prose)\n   rg -n '^\\s*(\u002F\u002F|#)\\s*[a-z_]+\\s*[({=.].*[;):]?\\s*$' \u003Cscope>\n   # journal \u002F dated comments\n   rg -n '(\u002F\u002F|#).*(20[0-9]{2}[-\u002F][0-9]{2}|changelog|updated by|history:)' \u003Cscope>\n   # positional-marker banners\n   rg -n '(\u002F\u002F|#)\\s*[=\\-*]{4,}' \u003Cscope>\n   # bare TODO\u002FFIXME without a ticket (rg's default engine has no look-around,\n   # so filter with a second pass rather than a negative look-ahead)\n   rg -n '(TODO|FIXME|XXX)' \u003Cscope> | rg -v 'CHA-'\n   ```\n\n3. **For each comment, apply the one test:**\n   - **Redundant** (restates the code) → delete.\n   - **Commented-out code \u002F journal \u002F positional marker** → delete.\n   - **Bare TODO\u002FFIXME** → mint or find the Linear ticket and rewrite as `TODO(CHA-NNN)`; if the fix is trivial and in-scope, do it and delete the TODO. Never leave it bare.\n   - **Weak why-comment** (gestures at a reason but vaguely) → tighten it, or replace the comment with a rename\u002Fextraction that makes it unnecessary.\n   - **Genuine why \u002F invariant \u002F quirk \u002F regex \u002F contract** → keep. Add a *missing* why-comment only where a real, non-obvious rationale is currently undocumented — sparingly.\n\n4. **Commit** comment-only changes. Conventional type `docs` (comments are documentation-in-code): `docs(\u003Cscope>): prune redundant comments`. If the audit is part of a larger change, fold it into that change's commits instead of a standalone one.\n\n5. **Gate.** Run `just check` once before opening a PR — comment edits rarely break it, but a mangled doc-comment or an unclosed block comment can. Route through `just`, never bare `cargo`\u002F`ruff`.\n\nScope discipline: comments only. A tempting refactor or a real bug found mid-audit is a separate `\u002Fdo-issue` ticket, surfaced to the user — not bundled into a `docs:` commit.\n\n## Relationship to other skills and docs\n\n- **`\u002Fclean-code-refactor`** is the natural partner: its self-documenting-code principles (meaningful names, small single-responsibility functions, no aliasing) are what make comments unnecessary in the first place. When the one test says \"improve the code instead of commenting,\" that improvement is often a `\u002Fclean-code-refactor` candidate.\n- **`docs\u002Fstyle-guide.md`** owns the `TODO(CHA-NNN)` convention (principle 9) and the proto-comment-hygiene rule that principle 10 generalizes. This skill is the fuller treatment; the style guide is the quick reference.\n- **`docs\u002Fdevelopment-methodology-guide.md`** → KISS: \"document *why* complexity exists\" is the same instinct as principle 7, at the design level (record necessary complexity's rationale in `docs\u002Fdesign-decisions.md`, not scattered comments).\n",{"name":5,"description":7,"allowed-tools":24,"argument-hint":25},"Read Grep Glob Bash Edit WebFetch","[\u003Cscope> — file\u002Fcrate\u002Fdir to audit; omit for guidance-only]","main","5857ef2d015e3d9011c5e73b01660da6043e0f0e",".claude\u002Fskills\u002Fcode-comments",0,"https:\u002F\u002Fgithub.com\u002Fpenca-io\u002Fpenca","https:\u002F\u002Fpenca.io\u002F","https:\u002F\u002Fgithub.com\u002Fpenca-io","https:\u002F\u002Fpenca.io","2026-08-01 08:29:37",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add penca-io\u002Fpenca --skill code-comments",{"tool":41,"command":42},"bunx","bunx skills add penca-io\u002Fpenca --skill code-comments",{"tool":44,"command":45},"pnpm","pnpm dlx skills add penca-io\u002Fpenca --skill code-comments","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fpenca-io\u002Fpenca\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcode-comments\u002FSKILL.md",true,[],[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M79FNA3MSFZJJEY8K32KJ7VG","tracing-instrument","Add structured `tracing`-crate instrumentation (spans + events + fields) to Penca Rust code — one combined plan emitted as kata tasks under `cha-NNN plan-draft` and gated once by `\u002Fplan-reviewer`, then one branch carrying every site as its own commit drained from the approved kata queue, gated once by `just check` at PR open. Scope is the `tracing` crate only (logs-as-events + spans); metrics and OpenTelemetry are out of scope. Use for observability tickets, ad-hoc instrumentation passes on a crate, or as the `\u002Fdo-issue` `orch:run-cleanup` cleanup-context pass.","https:\u002F\u002Fgithub.com\u002Fpenca-io\u002Fpenca\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Ftracing-instrument\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M79FN8FWKKYX3PG3MPHFBMSP","test","Run the test suite with pytest","https:\u002F\u002Fgithub.com\u002Fpenca-io\u002Fpenca\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Ftest\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M79FN4G6C2KG7D737QDQCJFM","software-architect","High-level architecture analysis for Penca design questions — bounded contexts, microservice boundaries, cross-service interfaces, storage tier separations (hot vs cold), CQRS-shaped splits, design-stamina trade-offs, and incremental-replacement strategies. Use when a Linear ticket needs design framing, when an existing plan has a structural concern, or when a proposed change crosses bounded-context boundaries. Advisory — does not edit code.","https:\u002F\u002Fgithub.com\u002Fpenca-io\u002Fpenca\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsoftware-architect\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M79FN1Y86PSSG0A6A4QZSVKW","save-memory","Save or update a memory entry. Always targets the **current repo root's** `.claude\u002Fmemory\u002F`, resolved via `git rev-parse --show-toplevel`; never the runtime `~\u002F.claude\u002Fprojects\u002F\u003Cslug>\u002Fmemory\u002F` path.","https:\u002F\u002Fgithub.com\u002Fpenca-io\u002Fpenca\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsave-memory\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M79FMXG15K3SFKP8FVYASF8Q","review-pr","Review a Penca PR against project conventions and architecture","https:\u002F\u002Fgithub.com\u002Fpenca-io\u002Fpenca\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Freview-pr\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M79FMQVW8TEK002D5SY7N22Z","plan-reviewer","Audit a Penca `\u002Fdo-issue` plan — a set of kata tasks under `cha-NNN plan-draft` — for the mechanism-bound rule + dependency-graph sanity. Use after `\u002Fdo-issue` Step 2 emits the task set and before the user flips `plan-draft` → `approved`. Checks that every task names symbols\u002Ffiles to change AND symbols the new code path must invoke, has mechanism non-goals where relevant, avoids parallel-path workarounds, and that every implementation task is `--blocked-by` at least one red-test task with no cycles in the graph.","https:\u002F\u002Fgithub.com\u002Fpenca-io\u002Fpenca\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fplan-reviewer\u002FSKILL.md",[],[]]