codifylisted
Install: claude install-skill yuanhaorannnnnn/agent-skills
# Capture Mistake Rule
## Boundary
Produce a rule, not a story or report. The minimum useful output is wrong approach, correct approach, trigger, and evidence. If incident chronology matters, route to after-action. If the full task lifecycle and evaluation matter, route to `sanitize report`.
## Workflow
1. Apply the permanence gate before drafting anything. Reject durable storage when the incident is a one-off typo, an obvious local error, or already enforced by compiler/lint/test. Explain which criterion failed; do not invent a generalized rule merely because the user asked to make it permanent.
2. Summarize the qualifying mistake in one sentence.
3. Convert it into a compact rule with:
- incorrect approach
- correct approach
- trigger scenario
4. Check Canon `patterns/` and `incidents/` first, then check repo-local `.agent-state/rules/mistakes.md` for compatibility duplicates.
5. Append the raw incident record if it is materially new.
6. If the rule is reusable beyond one isolated incident, promote it to Canon `patterns/` or `incidents/`; repo-local `.agent-state/rules/mistakes.md` is a project compatibility mirror.
## Quality Gate(写规则前自问)
一条 guardrail 必须同时满足:
- 持久价值:后果显著、结论不显然,且不是 compiler/lint/test 已可靠覆盖的错误
- 触发条件:什么时候会再犯(具体场景,不是“任何时候”)
- 动作:该做什么(可执行命令句,不是“注意/小心/确认”)
- 可检查结果:怎么知道做没做(可被代码、日志或 checklist 验证)
不满足任一 → 不写 guardrail。多步流程交给 pattern / checklist / 脚本工具;
单次事故且无复现证据的教训只记 raw,不 codify。禁止为写规则而写规则:
颗粒度小的伪规则直接丢弃(历史教训:曾因堆积细粒度 rule 造成 guardian/
autoreview