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:
- Only record learnings that belong in agent memory.
- Keep one central learnings source of truth; do not invent parallel central files.
- Sync approved learnings into every relevant agent surface that exists for the supported CLIs.
- Do not propagate "Claude Code Only" learnings into engineer/reviewer agent prompts.
- Get explicit user confirmation before modifying the learnings file or any agent file.
<EXTREMELY-IMPORTANT>
本Skill用于更新持久化Agent指导内容和实时Agent提示文件。
非协商规则:
- 仅记录属于Agent记忆的学习内容。
- 保持单一的中央学习内容可信源;不得创建并行的中央文件。
- 将已批准的学习内容同步到受支持CLI对应的所有相关Agent界面中。
- 不得将“Claude Code Only”学习内容传播到工程师/审核员Agent的提示文件中。
- 在修改学习内容文件或任何Agent文件之前,必须获得用户的明确确认。
Update Agent Learnings
更新Agent学习内容
Inputs
输入
- : Optional learning candidate, scope hint, agent name, or reminder about what the session revealed
$request
- :可选的学习内容候选、范围提示、Agent名称,或关于会话所揭示内容的提醒
$request
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 sections
## Learnings - 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 workflow rules
CLAUDE.md - one-off implementation notes
- direct requests to rewrite an agent prompt right now
Load for routing and scope classification.
references/learning-scope.mdIf 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:
GlobalClaude Code OnlyAgent-Specific
Rules:
- write it in imperative mood
- prefer one precise learning over a vague bundle
- only mark it if it truly applies across coding agents
Global - use for meta-work about skills, orchestration, configs, or project setup
Claude Code Only
Success criteria: You have one actionable learning candidate with a correct scope.
回顾会话并确定最小的实用规则。
将其分类为以下类型之一:
GlobalClaude Code OnlyAgent-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 and
.agents/learnings/agent-learnings.mdexist, pick one canonical source and do not maintain both by hand.claude/learnings/agent-learnings.md - in this -first repo, prefer
.agents.agents/learnings/agent-learnings.md - if the repo only has , use that instead
.claude/learnings/agent-learnings.md
Then discover agent sync targets:
- sync into when that tree exists
.agents/agents/*/AGENT.md - sync into when that tree exists
.claude/agents/* - treat both trees as live CLI surfaces when both are present
Load:
- for scope and duplicate handling
references/learning-scope.md - only if the canonical learnings file does not exist yet
references/agent-learnings-template.md - for Learnings-section generation and placement
references/agent-sync-contract.md
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 - :用于生成Learnings章节并确定其放置位置
references/agent-sync-contract.md
成功标准:已明确标准学习内容文件和所有同步目标目录树。
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 if confirmation or wording refinement is needed.
AskUserQuestionDo 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 section for each target agent file.
## LearningsSync 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 section, replace that section cleanly
## Learnings - if it does not, insert the section in the location defined by
references/agent-sync-contract.md
Important:
- when both and
.agentsagent trees exist, update both surfaces.claude - 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
重要提示:
- 当和
.agentsAgent目录树都存在时,更新两个界面.claude - 不要假设文件名完全一致;解析实际存在的路径
- 在同步学习内容时,不得重写无关的提示章节
成功标准:每个存在的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 ; this workflow edits the active repository.
context: fork - Do not add ; this is a generic maintenance skill.
paths: - 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 and
.agentsagent surfaces are present..claude
- 不得让模型主动调用本Skill;它会修改持久化学习内容和Agent提示文件。
- 不得添加;此工作流会编辑活动仓库。
context: fork - 不得添加;这是一个通用的维护Skill。
paths: - 不得在中内联路由矩阵、评分卡或大型学习内容示例。
SKILL.md - 未经用户明确批准,不得添加学习内容。
- 不得维护两个不一致的中央学习内容文件。
- 当和
.agentsAgent界面都存在时,不得跳过其中一个CLI目录树。.claude
When To Load References
何时加载参考文件
-
Use for deciding whether the learning belongs in agent memory, choosing the right scope, and handling duplicates.
references/learning-scope.md -
Use only when the canonical central learnings file is missing and a minimal compatible file must be created.
references/agent-learnings-template.md -
Use for generating the Learnings section and placing it correctly in agent files across the supported CLI trees.
references/agent-sync-contract.md
-
用于判断学习内容是否属于Agent记忆范畴、选择正确的范围以及处理重复内容。
references/learning-scope.md -
仅当标准中央学习内容文件缺失且必须创建一个最小兼容文件时使用。
references/agent-learnings-template.md -
用于生成Learnings章节并将其正确放置在受支持CLI目录树的Agent文件中。
references/agent-sync-contract.md
Output Contract
输出约定
Report:
- whether the learning was accepted or redirected elsewhere
- the chosen scope and canonical learnings file
- the final approved wording
- which CLI agent trees were updated
- any duplicate merge or sync-target decisions
报告以下内容:
- 学习内容是被接受还是被重定向到其他位置
- 所选的范围和标准学习内容文件
- 最终批准的措辞
- 哪些CLI Agent目录树已更新
- 任何重复内容合并或同步目标决策