codify
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodify
Codify
Move recurring review lessons into the standards file, its section, and checker configs.
Propose, wait for approval, then write.
Never stage, commit, branch, push, or comment on a PR.
## One-way doors将反复出现的评审经验移入标准文件、其 部分以及 checker 配置。
提出方案,等待批准,然后再写入。
绝不暂存、提交、创建分支、推送,也绝不在 PR 上发表评论。
## One-way doors1. Pin the target and the window
1. 锁定目标与窗口
The target is , or when only that exists.
Never .
.agents/coding-standards.mdCODING_STANDARDS.mdCONTRIBUTING.mdThe window takes at most one argument:
- a PR number: that PR alone, merged or not
- : PRs merged on or after that date
--since <YYYY-MM-DD> - nothing: PRs merged after the newest default-branch commit whose subject starts with , else the 10 most recently merged
Codify
With no GitHub access or an empty window, continue on the user's input alone.
目标是 ;如果仅存在 ,则改用后者。
绝不选择 。
.agents/coding-standards.mdCODING_STANDARDS.mdCONTRIBUTING.md窗口最多接受一个参数:
- PR 编号:仅处理该 PR,无论其是否已合并
- :处理在该日期及之后合并的 PR
--since <YYYY-MM-DD> - 不传参数:处理在最新一条主题以 开头的默认分支提交之后合并的 PR;如果不存在这样的提交,则处理最近合并的 10 个 PR
Codify
如果没有 GitHub 访问权限或窗口内没有 PR,则仅根据用户的输入继续。
2. Ask the user
2. 询问用户
Show the window and its PRs (at most 20), then ask exactly this and wait:
Which review comments did you catch yourself making, in these PRs or anywhere lately?
Each comment is a finding sourced .
stated <today's date>显示该窗口及其中的 PR(最多 20 个),然后原样询问以下内容并等待:
你最近在这些 PR 中或其他地方,发现自己提出了哪些反复出现的评审意见?
每条评论都作为一项发现,来源标记为 。
stated <today's date>3. Gather findings
3. 收集发现
From each PR:
- human comments (conversation, review, inline), skipping bots and bare approvals
- review findings left open (such as lines) in the PR body and commit bodies, plus fixed ones under an
Open:commit subject or PR heading, never review-changeAddress reviewlinesFixed: - commits pushed after merge that only the PR body describes, counted once
从每个 PR 中收集:
- 人工发表的评论(会话评论、评审评论和行内评论),跳过机器人评论和未附带其他意见的批准
- PR 正文和提交正文中仍未关闭的评审发现(例如 行),以及位于
Open:提交主题或 PR 标题下的已修复发现;绝不采用评审变更中的Address review行Fixed: - 合并后推送、但仅在 PR 正文中有所描述的提交,只计一次
4. Turn findings into rules
4. 将发现转化为规则
Rewrite each finding as the rule it implies, in this repo's own words; one-off bugs, spec gaps and user-only decisions imply none.
Group narrowly: a reviewer reading only the rule must flag every finding in it.
A rule recurs when the user stated it or its findings span two or more PRs.
Drop a rule a checker already enforces, a generic smell that is not repo-specific, or one the target already states (a sharpen if findings show it is missed).
A surviving rule that does not recur goes on the watching list.
使用该仓库自身的措辞,将每项发现改写为其对应的规则;一次性缺陷、规格缺口和仅涉及用户的决策均不产生规则。
进行窄范围归组:仅阅读该规则的评审者必须能够标记出其中包含的每一项发现。
如果用户明确提出某项规则,或者其发现横跨两个或更多 PR,则该规则属于反复出现的规则。
排除以下规则:checker 已经强制执行的规则、不针对该仓库的通用坏味道,或目标文件中已经载明的规则(如果相关发现表明现有规则有所遗漏,则归为 sharpen)。
保留下来的规则如果未反复出现,则放入观察列表。
5. Choose where each recurring rule lands
5. 为每条反复出现的规则选择落点
First fit wins:
- check: enable or tighten a rule an installed checker already ships; anything needing a new plugin, custom rule or test is a follow-up, never written
- one-way door: a change reverting the code cannot undo, under
## One-way doors - standard: everything else, under
## Rules
A coding rule in a tracked or is a move: deleted there, added to the target.
Process rules stay.
AGENTS.mdCLAUDE.mdAbove 40 entries under , pair every new standard with a proposed cut or merge.
## Rules按以下顺序匹配,命中第一项即停止:
- check:启用或收紧已安装 checker 内置提供的规则;任何需要新插件、自定义规则或测试的内容都属于 follow-up,绝不写入
- one-way door:代码回退也无法撤销的改动,放在 下
## One-way doors - standard:其他所有规则,放在 下
## Rules
已被 Git 跟踪的 或 中的编码规则属于 move:从原位置删除,并添加到目标文件。
流程规则保持不变。
AGENTS.mdCLAUDE.md当 下的条目超过 40 个时,每项新标准都必须与一项拟议的 cut 或 merge 配对。
## Rules6. Propose
6. 提出方案
text
Codify: <window>, PRs <#a, #b> | your input: <n comments | none>
Target: <path> (<n rules | will be created>)
Proposed:
1. [standard | one-way door | sharpen <name> | move <file:line>]
<the entry, exactly as it will be written>
2. [check] <config>: <change> - <sources>
3. [cut] <name> - <why>
Follow-ups, not written:
- <what to build> - <sources>
Watching, one PR only:
- <rule> - <source>Sources are PR numbers or ; an empty section reads ; an empty ends the run.
Otherwise ask exactly this and wait:
stated <date>- noneProposedApprove, edit, or drop each numbered item. Reply with the numbers and what to do with each.
text
Codify: <window>, PRs <#a, #b> | your input: <n comments | none>
Target: <path> (<n rules | will be created>)
Proposed:
1. [standard | one-way door | sharpen <name> | move <file:line>]
<the entry, exactly as it will be written>
2. [check] <config>: <change> - <sources>
3. [cut] <name> - <why>
Follow-ups, not written:
- <what to build> - <sources>
Watching, one PR only:
- <rule> - <source>来源可以是 PR 编号或 ;空的小节写作 ;如果 为空,则结束本次运行。
否则,原样询问以下内容并等待:
stated <date>- noneProposed请逐项批准、修改或舍弃每个编号项。请回复各编号以及对应的处理方式。
7. Write what was approved
7. 写入已批准的内容
If the target is missing, create it from references/new-standards-file.md.
Every standard and one-way door is exactly two lines:
markdown
- **<Short name>**: <the rule, one sentence, a must or a never where it is one>
Why: <one sentence> (<sources>).Keep the bold name short and unique: other skills cite it.
A sharpen replaces in place; a cut deletes.
If a checker config changed, run the project's check command once and report violations in existing code without fixing them.
如果目标文件不存在,则根据 references/new-standards-file.md 创建。
每条标准和 one-way door 都必须恰好写成两行:
markdown
- **<Short name>**: <the rule, one sentence, a must or a never where it is one>
Why: <one sentence> (<sources>).保持粗体名称简短且唯一,其他 skill 会引用该名称。
sharpen 原地替换相应内容,cut 则删除相应内容。
如果 checker 配置发生变化,则运行一次项目的 check 命令,并报告现有代码中的违规项,但不要修复。
8. Report
8. 报告
- changed files, from
git status --short - the check result, or
not run: no config change - follow-ups and watching list
- a commit message, , which marks where the next window starts
Codify: <#a, #b> - a warning if says the target is gitignored
git check-ignore <target>
- 来自 的变更文件列表
git status --short - 检查结果,或
not run: no config change - 后续事项与观察列表
- 一条提交消息 ,用于标记下一个窗口的起始位置
Codify: <#a, #b> - 如果 表明目标文件被 gitignore,则给出警告
git check-ignore <target>