agentleFS
yuanhaorannnnnnyuanhaorannnnnn/agent-skills/skills/codify/SKILL.md

codify

Skill0 starsChanged 56 days agoMITView on GitHub

Write one compact reusable guardrail to prevent a recurring mistake. Trigger on "remember this mistake", "write this down as a rule", or "add a guardrail". Incident chronology goes to after-action; a full completed-task report goes to sanitize report.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check Canon patterns/ and incidents/ first, then check repo-local .agent-state/rules/mistakes.md for compatibility duplicates.

    line 23
  2. Very specific:

    If the rule is reusable beyond one isolated incident, promote it to Canon patterns/ or incidents/.

    line 25
  3. Very specific:

    Keep one-off or purely local mistakes only as raw incident entries in repo-local .agent-state/rules/mistakes.md.

    line 56
  4. Distinctive:

    If the rule is project-specific only, update the project page or local rule file and state that no cross-project Canon pattern was created.

    line 64
  5. Very specific:

    Use <skills-root>/.scripts/note_rule.py for deterministic repo-local compatibility updates.

    line 68

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 the full task lifecycle and evaluation matter, route to sanitize report.

When the request asks how an incident was fixed, its chronology, failed attempts, or root cause, stop the rule workflow and use the after-action incident-review workflow. Load after-action if available. If it is unavailable, disclose that limitation and still organize the available evidence as an incident review; do not claim the skill was invoked. Preserve failed attempts, root-cause evidence, and verification boundaries; ask for missing evidence instead of inventing an incident. Merely mentioning after-action is not a completed handoff, and incident-review behavior does not require that exact name.

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 审核量与上下文膨胀)。

参考依据:wiki 仓库 queries/20260730-codex-custom-code-review-rules.md 与 raw/config/20260723-codex-default.rules(Codex custom rules 优化任务)—— 规则只写 consequential、non-obvious 的不变量;删除后 review 结果不变的规则 不值得常驻;能写成测试 / lint / checklist / 脚本的约束,不占规则位。

Promotion Rule

Promote a mistake into Canon when at least one of these is true:

  • it has happened more than once
  • it affects multiple skills or workflows
  • it is a process-level guardrail, not just a local typo
  • it belongs in the cross-project Canon graph as a long-term rule

Keep one-off or purely local mistakes only as raw incident entries in repo-local .agent-state/rules/mistakes.md. Do not elevate them into Canon patterns.

Canon 输出边界

读取共享契约:/home/yhr/.agents/repos/agent-skills/references/canon-output-contract.md。

  • Durable rules go to Canon patterns/ or incidents/; repo-local .agent-state/rules/mistakes.md remains a runtime compatibility mirror.
  • For each materially new reusable rule, create or update /media/yhr/2T/Canon/raw/update-cards/<date>-codify-<slug>.md with wrong/correct/trigger/evidence.
  • If the rule is project-specific only, update the project page or local rule file and state that no cross-project Canon pattern was created.

Script

Use <skills-root>/.scripts/note_rule.py for deterministic repo-local compatibility updates. The script records the raw incident in .agent-state/rules/mistakes.md; Canon promotion is the durable step.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.