ds-lessons

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ds-lessons

ds-lessons

An instruction an agent can skip is a wish. Make repeated mistakes fail loudly instead.
Agent 可以跳过的指令无异于愿望。应让重复出现的错误显式失败。

Steps

步骤

  1. Gather mistakes. Read the current session, recent commits, reverts, review comments, agent instruction files and workaround comments. Group them into classes. A class counts once it happened twice.
  2. For each class, pick the highest level that works:
    1. Structure: one owner per piece of state, one supported way per task, hidden internals, delete old patterns an agent would copy.
    2. Types: make the bad state impossible to write.
    3. Lint or CI check: the error message names the right file, type or function to use. If the bad pattern is already common, fail only on new additions.
    4. Test: checks behavior, not internals.
    5. Docs or agent rules: only for judgment calls that cannot be checked. Add a short example of the failure.
  3. Fix the most frequent classes now, one commit each.
  4. Prove each new check. Re-introduce a real past mistake, run the check, and show it fails. Then remove it and show it passes.
  5. Keep a table in the agent instruction file: rule, and what enforces it. If a rule already existed but nothing enforced it, treat it as a repeat and enforce it now.
  6. End-of-session reflection: list what went wrong, what took extra loops and what the user corrected. Route each item to a check, a skill edit or a rule. Drop one-off issues.
  1. 收集错误。阅读当前会话、最近的提交、回滚记录、评审评论、Agent 指令文件以及临时变通方案注释。将它们归为不同类别。同一类别发生两次后即可计为一类。
  2. 为每类错误选择能够奏效的最高层级:
    1. 结构:每份状态只有一个归属者,每项任务只有一种受支持的方式,隐藏内部实现,并删除 Agent 可能模仿的旧模式。
    2. 类型:使错误状态无法被写出。
    3. Lint 或 CI 检查:错误信息应指明应使用的正确文件、类型或函数。如果错误模式已经普遍存在,则仅对新增加的内容触发失败。
    4. 测试:检查行为,而非内部实现。
    5. 文档或 Agent 规则:仅用于无法自动检查的判断类问题。添加一个简短的失败示例。
  3. 立即修复出现频率最高的类别,每类单独提交一次。
  4. 验证每项新检查。重新引入一个真实发生过的错误,运行检查并展示失败结果。然后移除该错误并展示检查通过。
  5. 在 Agent 指令文件中保留一张表:规则及其执行机制。如果某条规则已经存在,却没有任何机制执行它,则将其视为重复问题,并立即落实执行机制。
  6. 会话结束复盘:列出出了什么问题、哪些地方导致了额外循环,以及用户纠正了什么。将每一项分派给某项检查、某次 skill 编辑或某条规则。丢弃一次性问题。

Stop when

停止条件

  • Each chosen class has an enforcement that you showed failing on a real mistake.
  • Or you have handled the top three classes this session. Note the rest.
  • 每个选定类别都有执行机制,并且已展示该机制在真实错误上失败。
  • 或本次会话已经处理了频率最高的前三类。记录其余类别。

Rules

规则

  • If the fix is structural, do not also add prose. The prose was the symptom.
  • Report each class with evidence, the level chosen, and why a higher level did not work.
  • 如果修复方式是结构性的,则不要再添加说明文字。文字只是症状。
  • 报告每个类别时附上证据、所选层级,以及更高层级无法奏效的原因。