用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/li-kai/bastion --skill write-comments命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | write-comments |
| description | Comment style and hygiene. Use when writing, reviewing, or refining code comments and documentation. |
Comments should tell the reader something they can't get from the signature and a quick scan of the body.
Litmus test: if you deleted the comment and a competent reader of the signature alone would be surprised by some behavior, the comment is load-bearing. If they'd just nod, it's noise.
Document what a function promises (failure conditions, edge-case behavior,
None semantics), not how it works internally.
// Good: tells you when it fails
/// Intersects numeric bounds and computes LCM of `multipleOf` values.
/// Returns `None` when bounds invert or no multiple exists in range.
// Bad: restates the body
/// Takes the max of the mins and the min of the maxs, then computes
/// the LCM of mul_of_a and mul_of_b using integer scaling.
If a design choice isn't obvious, the comment earns its place. If the code is clear, the comment is noise.
// Good: non-obvious rationale
// LCM overflow: keep the larger value (sound overapproximation --
// multiples of max(a,b) are a superset of multiples of lcm(a,b)).
// Bad: restates the match arms
// If both are Required, return Required. If one is Required, return
// Required. Otherwise return NotRequired.
///) vs inner comments (//)| Use | For |
|---|---|
/// | Contract: what callers need to know without reading body |
// | Implementation: algorithm steps, formulas, non-obvious logic |
A 3-line match body doesn't need a doc comment restating its truth table. A
sound overapproximation strategy does need an inner // explaining why it's
safe.
None/Err semantics when not obvious from the type/// Merges per-item constraints by variant:
/// - `Any` + x = x (identity)
/// - `Uniform` + `Uniform` = `and` schemas
/// - `Tuple` + `Tuple` = pairwise `and`, padded with `additional`
/// - `Uniform` + `Tuple` = distribute `Uniform` over each position
No comment is needed when:
基于 SOC 职业分类