update-agent-learnings

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<EXTREMELY-IMPORTANT> This skill updates durable agent guidance and live agent prompt files.
Non-negotiable rules:
  1. Only record learnings that belong in agent memory.
  2. Keep one central learnings source of truth; do not invent parallel central files.
  3. Sync approved learnings into every relevant agent surface that exists for the supported CLIs.
  4. Do not propagate "Claude Code Only" learnings into engineer/reviewer agent prompts.
  5. Get explicit user confirmation before modifying the learnings file or any agent file.
</EXTREMELY-IMPORTANT>
<EXTREMELY-IMPORTANT> 本Skill用于更新持久化Agent指导内容和实时Agent提示文件。
非协商规则:
  1. 仅记录属于Agent记忆的学习内容。
  2. 保持单一的中央学习内容可信源;不得创建并行的中央文件。
  3. 将已批准的学习内容同步到受支持CLI对应的所有相关Agent界面中。
  4. 不得将“Claude Code Only”学习内容传播到工程师/审核员Agent的提示文件中。
  5. 在修改学习内容文件或任何Agent文件之前,必须获得用户的明确确认。
</EXTREMELY-IMPORTANT>

Update Agent Learnings

更新Agent学习内容

Inputs

输入

  • $request
    : Optional learning candidate, scope hint, agent name, or reminder about what the session revealed
  • $request
    :可选的学习内容候选、范围提示、Agent名称,或关于会话所揭示内容的提醒

Goal

目标

Add one validated agent learning to the central learnings store and sync it into the matching agent files by:
  • confirming the learning belongs in agent memory
  • classifying the scope correctly
  • updating one canonical learnings file
  • regenerating the relevant
    ## Learnings
    sections
  • syncing those sections into all agent surfaces that exist
通过以下步骤将一条经过验证的Agent学习内容添加到中央学习内容存储库,并同步到匹配的Agent文件中:
  • 确认该学习内容属于Agent记忆范畴
  • 正确分类其适用范围
  • 更新一个标准的学习内容文件
  • 重新生成相关的
    ## Learnings
    章节
  • 将这些章节同步到所有存在的Agent界面中

Step 0: Confirm the learning belongs here

步骤0:确认学习内容归属

This skill is only for durable learnings that should shape agent behavior.
Valid examples:
  • global coding-agent rules such as scope control, testing, or iteration
  • agent-specific rules for one technology or role
  • "Claude Code Only" learnings that belong in the central learnings store but should not be pushed into subagent prompts
Invalid examples:
  • skill-design rules
  • main
    CLAUDE.md
    workflow rules
  • one-off implementation notes
  • direct requests to rewrite an agent prompt right now
Load
references/learning-scope.md
for routing and scope classification.
If the learning does not belong in agent memory, stop and say where it should go instead.
Success criteria: The learning clearly belongs in the agent learnings system.
本Skill仅适用于应塑造Agent行为的持久化学习内容。
有效示例:
  • 全局编码Agent规则,如范围控制、测试或迭代规则
  • 针对特定技术或角色的Agent专属规则
  • 属于中央学习内容存储库但不应推送到子Agent提示文件中的“Claude Code Only”学习内容
无效示例:
  • Skill设计规则
  • CLAUDE.md
    工作流规则
  • 一次性实现说明
  • 要求立即重写Agent提示文件的直接请求
加载
references/learning-scope.md
以进行路由和范围分类。
如果该学习内容不属于Agent记忆范畴,请停止操作并告知其应归属的位置。
成功标准:该学习内容明确属于Agent学习内容系统。

Step 1: Extract one concrete learning

步骤1:提取一条具体的学习内容

Review the session and identify the smallest useful rule.
Classify it as one of:
  • Global
  • Claude Code Only
  • Agent-Specific
Rules:
  • write it in imperative mood
  • prefer one precise learning over a vague bundle
  • only mark it
    Global
    if it truly applies across coding agents
  • use
    Claude Code Only
    for meta-work about skills, orchestration, configs, or project setup
Success criteria: You have one actionable learning candidate with a correct scope.
回顾会话并确定最小的实用规则。
将其分类为以下类型之一:
  • Global
  • Claude Code Only
  • Agent-Specific
规则:
  • 使用祈使语气撰写
  • 优先选择一条精确的学习内容,而非模糊的集合
  • 仅当该规则真正适用于所有编码Agent时,才标记为
    Global
  • 将关于Skill编排、配置或项目设置的元工作内容标记为
    Claude Code Only
成功标准:你已得到一个带有正确范围的可执行学习内容候选。

Step 2: Resolve the central learnings file and agent sync targets

步骤2:确定中央学习内容文件和Agent同步目标

Locate the canonical central learnings file.
Path policy:
  • if one central agent learnings file already exists, use it
  • if both
    .agents/learnings/agent-learnings.md
    and
    .claude/learnings/agent-learnings.md
    exist, pick one canonical source and do not maintain both by hand
  • in this
    .agents
    -first repo, prefer
    .agents/learnings/agent-learnings.md
  • if the repo only has
    .claude/learnings/agent-learnings.md
    , use that instead
Then discover agent sync targets:
  • sync into
    .agents/agents/*/AGENT.md
    when that tree exists
  • sync into
    .claude/agents/*
    when that tree exists
  • treat both trees as live CLI surfaces when both are present
Load:
  • references/learning-scope.md
    for scope and duplicate handling
  • references/agent-learnings-template.md
    only if the canonical learnings file does not exist yet
  • references/agent-sync-contract.md
    for Learnings-section generation and placement
Success criteria: The canonical learnings file and all sync target trees are known.
定位标准的中央学习内容文件。
路径规则:
  • 如果已存在一个中央Agent学习内容文件,则使用该文件
  • 如果
    .agents/learnings/agent-learnings.md
    .claude/learnings/agent-learnings.md
    同时存在,选择一个标准源,不得手动维护两个文件
  • 在这个优先使用
    .agents
    的仓库中,优先选择
    .agents/learnings/agent-learnings.md
  • 如果仓库中只有
    .claude/learnings/agent-learnings.md
    ,则使用该文件
然后查找Agent同步目标:
  • .agents/agents/*/AGENT.md
    目录树存在时,同步到该路径
  • .claude/agents/*
    目录树存在时,同步到该路径
  • 当两个目录树都存在时,将两者视为实时CLI界面
加载:
  • references/learning-scope.md
    :用于范围判定和重复内容处理
  • references/agent-learnings-template.md
    :仅当标准学习内容文件尚未存在时使用
  • references/agent-sync-contract.md
    :用于生成Learnings章节并确定其放置位置
成功标准:已明确标准学习内容文件和所有同步目标目录树。

Step 3: Confirm with the user

步骤3:获得用户确认

Before editing anything, present:
  • scope classification
  • final wording
  • canonical learnings file
  • sync targets that will be touched
Use
AskUserQuestion
if confirmation or wording refinement is needed.
Do not write until the user explicitly approves the update.
Success criteria: The user has approved the learning and the sync surface.
在进行任何编辑之前,向用户展示:
  • 范围分类结果
  • 最终措辞
  • 标准学习内容文件
  • 将被修改的同步目标
如果需要确认或措辞优化,请使用
AskUserQuestion
在用户明确批准更新之前,不得进行写入操作。
成功标准:用户已批准该学习内容和同步界面。

Step 4: Update the central learnings file

步骤4:更新中央学习内容文件

Apply the minimal correct edit:
  • preserve file structure
  • insert the learning in the correct section
  • avoid deleting unrelated content
  • update the "Last updated" marker only if the file already uses one
Rules:
  • if the canonical learnings file is missing, create it from
    references/agent-learnings-template.md
  • if the section is missing, create the smallest compatible section rather than restructuring the whole file
  • keep formatting consistent with the existing document
Success criteria: The central learnings file contains the approved learning exactly once.
执行最小化的正确编辑:
  • 保留文件结构
  • 将学习内容插入到正确的章节中
  • 避免删除无关内容
  • 仅当文件已使用“Last updated”标记时,才更新该标记
规则:
  • 如果标准学习内容文件缺失,从
    references/agent-learnings-template.md
    创建该文件
  • 如果对应的章节缺失,创建最小兼容的章节,而非重构整个文件
  • 保持与现有文档一致的格式
成功标准:中央学习内容文件中仅包含一次已批准的学习内容。

Step 5: Regenerate and sync Learnings sections into agent files

步骤5:重新生成并同步Learnings章节到Agent文件

Use the central learnings file to build the
## Learnings
section for each target agent file.
Sync rules:
  • global learnings go to all coding/reviewer agent files
  • agent-specific learnings go only to the matching agent files
  • "Claude Code Only" learnings stay in the central learnings file and are not pushed into subagent prompts
  • if an agent file already has a
    ## Learnings
    section, replace that section cleanly
  • if it does not, insert the section in the location defined by
    references/agent-sync-contract.md
Important:
  • when both
    .agents
    and
    .claude
    agent trees exist, update both surfaces
  • do not assume filename parity; resolve the actual paths present
  • do not rewrite unrelated prompt sections while syncing learnings
Success criteria: Every relevant agent file in every present CLI tree has the correct synced Learnings section.
使用中央学习内容文件为每个目标Agent文件构建
## Learnings
章节。
同步规则:
  • 全局学习内容同步到所有编码/审核员Agent文件
  • Agent专属学习内容仅同步到匹配的Agent文件
  • “Claude Code Only”学习内容保留在中央学习内容文件中,不得推送到子Agent提示文件
  • 如果Agent文件已存在
    ## Learnings
    章节,干净地替换该章节
  • 如果不存在,则按照
    references/agent-sync-contract.md
    定义的位置插入该章节
重要提示:
  • .agents
    .claude
    Agent目录树都存在时,更新两个界面
  • 不要假设文件名完全一致;解析实际存在的路径
  • 在同步学习内容时,不得重写无关的提示章节
成功标准:每个存在的CLI目录树中的所有相关Agent文件都具有正确同步的Learnings章节。

Step 6: Verify and report

步骤6:验证并报告

Verify:
  • the learning exists once in the central learnings file
  • sync targets were updated as intended
  • agent Learnings sections contain the right global and agent-specific content
  • "Claude Code Only" learnings did not leak into subagent prompts
Report:
  • scope classification
  • canonical learnings file
  • sync target trees updated
  • final wording
  • whether files were created or updated
Success criteria: The user can see exactly what changed centrally and across agent surfaces.
验证:
  • 学习内容在中央学习内容文件中仅存在一次
  • 同步目标已按预期更新
  • Agent的Learnings章节包含正确的全局和Agent专属内容
  • “Claude Code Only”学习内容未泄露到子Agent提示文件中
报告:
  • 范围分类结果
  • 标准学习内容文件
  • 已更新的同步目标目录树
  • 最终措辞
  • 文件是新建还是已更新
成功标准:用户可以清楚地看到中央存储库和各个Agent界面中发生的具体变更。

Guardrails

防护规则

  • Do not let the model invoke this skill proactively; it mutates durable learnings and agent prompt files.
  • Do not add
    context: fork
    ; this workflow edits the active repository.
  • Do not add
    paths:
    ; this is a generic maintenance skill.
  • Do not keep routing matrices, scorecards, or giant Learnings examples inline in
    SKILL.md
    .
  • Do not add a learning without explicit user approval.
  • Do not maintain two divergent central learnings files.
  • Do not skip one CLI tree when both
    .agents
    and
    .claude
    agent surfaces are present.
  • 不得让模型主动调用本Skill;它会修改持久化学习内容和Agent提示文件。
  • 不得添加
    context: fork
    ;此工作流会编辑活动仓库。
  • 不得添加
    paths:
    ;这是一个通用的维护Skill。
  • 不得在
    SKILL.md
    中内联路由矩阵、评分卡或大型学习内容示例。
  • 未经用户明确批准,不得添加学习内容。
  • 不得维护两个不一致的中央学习内容文件。
  • .agents
    .claude
    Agent界面都存在时,不得跳过其中一个CLI目录树。

When To Load References

何时加载参考文件

  • references/learning-scope.md
    Use for deciding whether the learning belongs in agent memory, choosing the right scope, and handling duplicates.
  • references/agent-learnings-template.md
    Use only when the canonical central learnings file is missing and a minimal compatible file must be created.
  • references/agent-sync-contract.md
    Use for generating the Learnings section and placing it correctly in agent files across the supported CLI trees.
  • references/learning-scope.md
    用于判断学习内容是否属于Agent记忆范畴、选择正确的范围以及处理重复内容。
  • references/agent-learnings-template.md
    仅当标准中央学习内容文件缺失且必须创建一个最小兼容文件时使用。
  • references/agent-sync-contract.md
    用于生成Learnings章节并将其正确放置在受支持CLI目录树的Agent文件中。

Output Contract

输出约定

Report:
  1. whether the learning was accepted or redirected elsewhere
  2. the chosen scope and canonical learnings file
  3. the final approved wording
  4. which CLI agent trees were updated
  5. any duplicate merge or sync-target decisions
报告以下内容:
  1. 学习内容是被接受还是被重定向到其他位置
  2. 所选的范围和标准学习内容文件
  3. 最终批准的措辞
  4. 哪些CLI Agent目录树已更新
  5. 任何重复内容合并或同步目标决策