learn

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Learn from Conversation

从对话中学习

Analyze the conversation to extract lessons learned, then persist them to AI assistant configuration files.
分析对话内容以提取经验教训,然后将其保存到AI助手配置文件中。

Supported Assistants

支持的助手

AssistantConfig FileFormat
Claude Code
CLAUDE.md
Markdown
Gemini
GEMINI.md
Markdown
AGENTS.md
AGENTS.md
Markdown
Cursor
.cursorrules
or
.cursor/rules/*.mdc
Markdown/MDC
GitHub Copilot
.github/copilot-instructions.md
Markdown
Windsurf
.windsurf/rules/rules.md
Markdown
Continue
.continuerc.json
JSON
See references/assistant-configs.md for format details.
助手配置文件格式
Claude Code
CLAUDE.md
Markdown
Gemini
GEMINI.md
Markdown
AGENTS.md
AGENTS.md
Markdown
Cursor
.cursorrules
.cursor/rules/*.mdc
Markdown/MDC
GitHub Copilot
.github/copilot-instructions.md
Markdown
Windsurf
.windsurf/rules/rules.md
Markdown
Continue
.continuerc.json
JSON
有关格式详情,请参阅 references/assistant-configs.md

Process

处理流程

1. Detect and Assess Configurations

1. 检测并评估配置

Scan for config files and check their sizes:
bash
for f in CLAUDE.md GEMINI.md AGENTS.md .cursorrules .github/copilot-instructions.md \
  .windsurf/rules/rules.md .continuerc.json; do
  [ -f "$f" ] && wc -l "$f"
done
find .cursor/rules -name "*.mdc" -exec wc -l {} \; 2>/dev/null
Behavior based on detection:
ScenarioAction
Single config foundUpdate it automatically
Multiple configs foundPrompt user to select which to update
No configs foundDisplay init commands from assistant-configs.md, then exit
扫描配置文件并检查其大小:
bash
for f in CLAUDE.md GEMINI.md AGENTS.md .cursorrules .github/copilot-instructions.md \
  .windsurf/rules/rules.md .continuerc.json; do
  [ -f "$f" ] && wc -l "$f"
done
find .cursor/rules -name "*.mdc" -exec wc -l {} \; 2>/dev/null
基于检测结果的行为:
场景操作
找到单个配置自动更新该配置
找到多个配置提示用户选择要更新的配置
未找到配置显示 assistant-configs.md 中的初始化命令,然后退出

Size Thresholds

大小阈值

LinesStatusAction
< 400HealthyAdd learnings directly
400-500WarningAdd carefully, suggest cleanup
> 500OversizedRefactor before adding new content
行数状态操作
< 400健康直接添加经验内容
400-500警告谨慎添加,建议清理
> 500过大添加新内容前先重构

Discover Existing Skills

发现现有技能

List skills for routing decisions:
bash
find . -name "SKILL.md" -type f 2>/dev/null | grep -v node_modules | \
  xargs grep -l "^name:" | while read -r f; do
  grep -m1 "^name:" "$f" | sed 's/name: //'
done
列出技能用于路由决策:
bash
find . -name "SKILL.md" -type f 2>/dev/null | grep -v node_modules | \
  xargs grep -l "^name:" | while read -r f; do
  grep -m1 "^name:" "$f" | sed 's/name: //'
done

2. Analyze Conversation

2. 分析对话

Scan for:
  • Corrections: Commands retried, assumptions proven wrong, missing prerequisites
  • Discoveries: Undocumented patterns, integration quirks, environment requirements
  • Improvements: Steps that should be automated or validated earlier
扫描以下内容:
  • 修正内容:重试的命令、被证明错误的假设、缺失的前置条件
  • 发现内容:未记录的模式、集成细节、环境要求
  • 改进点:应提前自动化或验证的步骤

3. Categorize and Route Each Learning

3. 分类并路由每条经验

CategoryPrimary DestinationFallback When Oversized
Project factsConfig fileExtract to new skill
PrerequisitesConfig fileExtract to
project-setup
skill
EnvironmentConfig fileExtract to
environment-setup
skill
Workflow patternExisting related skillCreate new skill
Automated workflowNew skillNew skill (always)
类别主要目标位置过大时的备选方案
项目事实配置文件提取到新技能中
前置条件配置文件提取到
project-setup
技能中
环境信息配置文件提取到
environment-setup
技能中
工作流模式现有相关技能创建新技能
自动化工作流新技能新技能(始终)

Routing Decision Tree

路由决策树

For each learning, evaluate in order:
  1. Is this a multi-step automated workflow (>5 steps)?
    • YES → Create new skill (proceed to Step 5, Route C)
    • NO → Continue
  2. Does an existing skill cover this topic?
    • YES → Update that skill
    • NO → Continue
  3. Is the target config file oversized (>500 lines)?
    • YES → Create new skill OR offer refactoring (see Step 4)
    • NO → Continue
  4. Is this learning situation-specific (applies to narrow context)?
    • YES → Create new skill with
      globs
      or context constraints
    • NO → Add to config file
对于每条经验,按以下顺序评估:
  1. 这是一个多步骤自动化工作流(超过5步)吗?
    • 是 → 创建新技能(进入步骤5,路由C)
    • 否 → 继续
  2. 现有技能是否涵盖该主题?
    • 是 → 更新该技能
    • 否 → 继续
  3. 目标配置文件是否过大(超过500行)?
    • 是 → 创建新技能或提供重构选项(见步骤4)
    • 否 → 继续
  4. 这条经验是否是特定场景的(仅适用于狭窄上下文)?
    • 是 → 创建带有
      globs
      或上下文约束的新技能
    • 否 → 添加到配置文件

Size-Based Rules

基于大小的规则

Learning SizePreferred Destination
< 3 linesConfig file (even if near threshold)
3-30 linesFollow decision tree above
> 30 linesStrongly prefer skill creation
经验内容大小首选目标位置
< 3行配置文件(即使接近阈值)
3-30行遵循上述决策树
> 30行强烈建议创建技能

Skill Relevance Matching

技能相关性匹配

Match learnings to existing skills using these criteria:
Learning TopicMatching Skill Indicators
Testing patternsSkill name contains: test, spec, e2e, unit
Build/compile issuesSkill name contains: build, compile, bundle
DependenciesSkill name contains: package, dependency, npm, yarn
API patternsSkill name contains: api, http, fetch, request
DatabaseSkill name contains: db, database, migration, schema
DeploymentSkill name contains: deploy, release, ci, cd
Also check skill
description
field for keyword overlap with the learning topic.
使用以下标准将经验与现有技能匹配:
经验主题匹配技能的指标
测试模式技能名称包含:test、spec、e2e、unit
构建/编译问题技能名称包含:build、compile、bundle
依赖项技能名称包含:package、dependency、npm、yarn
API模式技能名称包含:api、http、fetch、request
数据库技能名称包含:db、database、migration、schema
部署技能名称包含:deploy、release、ci、cd
同时检查技能的
description
字段,看是否与经验主题存在关键词重叠。

4. Present and Confirm

4. 展示并确认

For each learning, show:
**[Category]**: [Brief description]
- Source: [What happened in conversation]
- Proposed change: [Exact text or file to add]
- Destination: [Config file] ([current] → [projected] lines)
对于每条经验,显示:
**[类别]**: [简要描述]
- 来源: [对话中发生的内容]
- 建议更改: [要添加的准确文本或文件]
- 目标位置: [配置文件] ([当前行数] → [预计行数])

Handle Size Threshold

处理大小阈值

If adding the learning would push a config file over threshold:
Adding this learning would bring [filename] to [X] lines (threshold: [Y]).

Options:
1. Add learning anyway (not recommended)
2. [Refactor](references/refactoring.md) existing content to skills first, then add
3. Create a new skill for this learning instead
4. Skip this config file
Ask for confirmation before applying each change.
如果添加经验会导致配置文件超过阈值:
添加此经验会使[文件名]达到[X]行(阈值:[Y])。

选项:
1. 仍添加经验(不推荐)
2. 先将现有内容重构为技能,再添加
3. 为此经验创建新技能
4. 跳过此配置文件
在应用每项更改前请求确认。

5. Apply Changes

5. 应用更改

Apply changes based on routing decision from Step 3:
根据步骤3的路由决策应用更改:

Route A: Add to Config File

路由A:添加到配置文件

Markdown configs (CLAUDE.md, GEMINI.md, AGENTS.md, Copilot, Windsurf):
  • Find appropriate section, preserve existing structure
  • Append to relevant section or create new section if needed
Cursor rules:
  • Legacy
    .cursorrules
    : Treat like markdown, append content
  • Modern
    .cursor/rules/*.mdc
    : See references/format-cursor-mdc.md
Continue (
.continuerc.json
):
  • Update
    customInstructions
    field, preserving existing content
  • See references/format-continue.md
Markdown配置(CLAUDE.md、GEMINI.md、AGENTS.md、Copilot、Windsurf):
  • 找到合适的章节,保留现有结构
  • 追加到相关章节,或在需要时创建新章节
Cursor规则:
  • 旧版
    .cursorrules
    : 视为Markdown处理,追加内容
  • 新版
    .cursor/rules/*.mdc
    : 参阅 references/format-cursor-mdc.md
Continue
.continuerc.json
):
  • 更新
    customInstructions
    字段,保留现有内容
  • 参阅 references/format-continue.md

Route B: Update Existing Skill

路由B:更新现有技能

When adding to an existing skill:
  1. Read the skill file:
    skills/[name]/SKILL.md
  2. Find appropriate section or create new one
  3. Append learning, maintaining the skill's existing structure
  4. If skill has references, consider adding to reference file instead
Skill update format:
markdown
undefined
添加到现有技能时:
  1. 读取技能文件:
    skills/[name]/SKILL.md
  2. 找到合适的章节或创建新章节
  3. 追加经验内容,保持技能的现有结构
  4. 如果技能有参考文件,考虑添加到参考文件中
技能更新格式:
markdown
undefined

[New Section or append to existing]

[新章节或追加到现有章节]

[Learning content formatted as guidance or workflow step]
undefined
[经验内容格式化为指南或工作流步骤]
undefined

Route C: Create New Skill

路由C:创建新技能

Create in
skills/[name]/SKILL.md
with this template:
markdown
---
name: [learning-topic]
description: [What this handles and when to use it - triggers belong here, not in body]
---
skills/[name]/SKILL.md
中使用以下模板创建:
markdown
---
name: [learning-topic]
description: [What this handles and when to use it - triggers belong here, not in body]
---

[Learning Topic]

[Learning Topic]

[Learning content structured as workflow]
[Learning content structured as workflow]

Process

Process

1. [First Step]

1. [First Step]

[Details]
undefined
[Details]
undefined

6. Verify Changes

6. 验证更改

After applying each change, confirm success by showing:
✓ Added to [file path]:
  [Section name]
  > [First 2-3 lines of added content...]
If a write failed, report the error and offer to retry or skip.
应用每项更改后,通过以下方式确认成功:
✓ 添加到[文件路径]:
  [章节名称]
  > [添加内容的前2-3行...]
如果写入失败,报告错误并提供重试或跳过选项。

7. Summarize

7. 总结

List:
  • Config files modified (with full paths)
  • Sections updated in each file
  • Any skills created
列出:
  • 修改的配置文件(含完整路径)
  • 每个文件中更新的章节
  • 创建的任何技能

Examples

示例

SituationLearning
"e2e tests failed because API wasn't running"Add prerequisite to selected config(s)
"Parse SDK doesn't work with Vite out of the box"Document workaround in selected config(s)
"Build failed because NODE_ENV wasn't set"Add required env var to selected config(s)
"Every component needs tests, lint, build..."Create
add-component
skill
场景经验内容
"e2e测试失败因为API未运行"向前选中的配置添加前置条件
"Parse SDK无法直接与Vite配合使用"在选中的配置中记录解决方法
"构建失败因为未设置NODE_ENV"向前选中的配置添加所需环境变量
"每个组件都需要测试、Lint、构建..."创建
add-component
技能

Edge Cases

边缘情况

ScenarioHandling
No configs detectedGuide user to initialize one first, exit early
Multiple configs foundPrompt user to select which to update
Malformed config fileWarn and skip that file
Duplicate content existsCheck before adding, warn if similar learning exists
Config file already oversizedOffer refactoring before adding (Step 4)
Learning matches multiple skillsPresent options, let user choose which skill to update
Skill file also oversizedSuggest creating sub-skills or reference files
Learning is very small (<3 lines)Prefer config file even if near threshold
Learning is very large (>30 lines)Strongly suggest skill creation
No existing skills foundSkip skill matching, proceed with config or new skill
场景处理方式
未检测到配置引导用户先初始化配置,提前退出
找到多个配置提示用户选择要更新的配置
配置文件格式错误发出警告并跳过该文件
存在重复内容添加前检查,若存在相似经验则发出警告
配置文件已过大添加前提供重构选项(步骤4)
经验匹配多个技能提供选项,让用户选择要更新的技能
技能文件也过大建议创建子技能或参考文件
经验内容非常短(<3行)即使接近阈值也优先选择配置文件
经验内容非常长(>30行)强烈建议创建技能
未找到现有技能跳过技能匹配,继续使用配置文件或创建新技能

Guidelines

指南

See references/guidelines.md for learning quality principles.
有关经验质量原则,请参阅 references/guidelines.md