learn-add
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineselearn-add
learn-add
Route feedback to the appropriate LEARN.md file.
将反馈路由至对应的LEARN.md文件。
Context Files
上下文文件
- - Skill lessons
$JAAN_LEARN_DIR/*.learn.md - - Context files and lessons
$JAAN_CONTEXT_DIR/*.md - - Language resolution protocol
${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.md
- - 技能经验总结文件
$JAAN_LEARN_DIR/*.learn.md - - 上下文文件与经验总结
$JAAN_CONTEXT_DIR/*.md - - 语言解析协议
${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.md
Input
输入
Arguments: $ARGUMENTS
Expected format:
"target" "lesson"- Target: skill name, , or
$JAAN_TEMPLATES_DIR/name$JAAN_CONTEXT_DIR/name - Lesson: the feedback to add
Examples:
/jaan-to:learn-add "pm-prd-write" "Always ask about rollback strategy"/jaan-to:learn-add "$JAAN_CONTEXT_DIR/tech" "All new tables need soft delete"
If no input provided, ask for target and lesson.
参数: $ARGUMENTS
预期格式:
"target" "lesson"- Target: 技能名称、或
$JAAN_TEMPLATES_DIR/name$JAAN_CONTEXT_DIR/name - Lesson: 要添加的反馈内容
示例:
/jaan-to:learn-add "pm-prd-write" "始终询问回滚策略"/jaan-to:learn-add "$JAAN_CONTEXT_DIR/tech" "所有新表需要软删除"
若未提供输入,请询问目标和经验内容。
Pre-Execution Protocol
执行前协议
Language Settings
语言设置
Read and apply language protocol:
Override field for this skill:
${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.mdlanguage_learn-add读取并应用语言协议:
本技能的覆盖字段:
${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.mdlanguage_learn-addPHASE 1: Analysis (Read-Only)
阶段1: 分析(只读)
Step 1: Parse Input
步骤1: 解析输入
Extract target and lesson from arguments.
If format is unclear:
- "Which skill/context should this lesson apply to?"
- "What is the lesson to add?"
从参数中提取目标和经验内容。
若格式不清晰:
- "这条经验应该应用于哪个技能/上下文?"
- "要添加的经验内容是什么?"
Step 2: Determine Target File
步骤2: 确定目标文件
Route based on target:
| Target Pattern | LEARN.md Location |
|---|---|
Skill name (e.g., | |
System skill (e.g., | |
| |
| |
| |
| |
根据目标进行路由:
| 目标模式 | LEARN.md 路径 |
|---|---|
技能名称(例如: | |
系统技能(例如: | |
| |
| |
| |
| |
Step 3: Auto-Categorize Lesson
步骤3: 自动分类经验
Detect category from lesson keywords:
| Category | Trigger Keywords |
|---|---|
| Better Questions | ask, question, clarify, confirm, "should ask" |
| Edge Cases | edge, special, case, handle, check, "need to handle" |
| Workflow | workflow, process, step, order, "before/after" |
| Common Mistakes | avoid, mistake, wrong, don't, never, "should not" |
If unclear, ask: "Which category? [questions/edge-cases/workflow/mistakes]"
根据经验内容中的关键词检测分类:
| 分类 | 触发关键词 |
|---|---|
| 更佳提问 | 询问、问题、澄清、确认、"应当询问" |
| 边缘场景 | 边缘、特殊、场景、处理、检查、"需要处理" |
| 工作流 | 工作流、流程、步骤、顺序、"之前/之后" |
| 常见错误 | 避免、错误、不正确、不要、绝不、"不应当" |
若分类不明确,询问: "请选择分类?[questions/edge-cases/workflow/mistakes]"
Step 4: Read Current LEARN.md
步骤4: 读取当前LEARN.md文件
Read the target LEARN.md file if it exists at .
If not found, check legacy path — if legacy found, rename it to the dash-prefixed path first.
If neither exists, prepare to create with template.
$JAAN_LEARN_DIR/jaan-to-{name}.learn.md$JAAN_LEARN_DIR/jaan-to:{name}.learn.md如果目标LEARN.md文件存在于,则读取该文件。
若未找到,检查旧路径 —— 若找到旧文件,先将其重命名为短横线连接的路径。
若两者都不存在,则准备使用模板创建。
$JAAN_LEARN_DIR/jaan-to-{name}.learn.md$JAAN_LEARN_DIR/jaan-to:{name}.learn.mdHARD STOP - Human Review Check
强制暂停 - 人工审核检查
Show preview:
markdown
Ready to Add Lesson
**File:** {file path}
**Category:** {category}
**Lesson:** {lesson text}
Preview:显示预览:
markdown
准备添加经验总结
**文件:** {文件路径}
**分类:** {分类名称}
**经验内容:** {经验文本}
预览:{Category}
{分类名称}
- {existing lessons...}
- {new lesson} <-- NEW
Confirm? [y/n/edit]
**Do NOT proceed without explicit approval.**
---- {现有经验内容...}
- {新经验内容} <-- 新增
确认执行?[是/否/编辑]
**未获得明确批准前,请勿继续执行。**
---PHASE 2: Write
阶段2: 写入
Step 5: Update LEARN.md
步骤5: 更新LEARN.md文件
If file exists:
- Read current content
- Find the category section (e.g., )
## Better Questions - Append new lesson as bullet point
- Update "Last updated" date
- Write file
If file doesn't exist:
- Check if plugin has seed data:
${CLAUDE_PLUGIN_ROOT}/skills/{skill-name}/LEARN.md - If seed exists and has meaningful content (contains bullet points), use it as starting point
- - If no seed exists, create from the template below
- Add the new lesson to the appropriate category
- Write file to:
$JAAN_LEARN_DIR/jaan-to-{skill-name}.learn.md
若文件已存在:
- 读取当前内容
- 找到对应分类章节(例如: )
## 更佳提问 - 将新经验作为项目符号追加
- 更新“最后更新”日期
- 写入文件
若文件不存在:
- 检查插件是否有种子数据:
${CLAUDE_PLUGIN_ROOT}/skills/{skill-name}/LEARN.md - 若种子文件存在且包含有效内容(包含项目符号),则以此为基础
- - 若没有种子文件,使用下方模板创建
- 将新经验添加至对应分类
- 将文件写入至:
$JAAN_LEARN_DIR/jaan-to-{skill-name}.learn.md
LEARN.md Template
LEARN.md模板
markdown
undefinedmarkdown
undefinedLessons: {skill-name}
经验总结: {skill-name}
Last updated: {date}
最后更新: {日期}
Better Questions
更佳提问
- {lesson if category matches}
- {匹配该分类的经验内容}
Edge Cases
边缘场景
- {lesson if category matches}
- {匹配该分类的经验内容}
Workflow
工作流
- {lesson if category matches}
- {匹配该分类的经验内容}
Common Mistakes
常见错误
- {lesson if category matches}
undefined- {匹配该分类的经验内容}
undefinedStep 6: Confirm Write
步骤6: 确认写入
markdown
Lesson Added
**File:** {path}
**Category:** {category}
**Lesson:** {lesson}markdown
经验总结已添加
**文件:** {路径}
**分类:** {分类名称}
**经验内容:** {经验文本}Step 7: Offer to Commit
步骤7: 询问是否提交
Ask user:
Commit this lesson? [y/n]If confirmed:
- Stage:
git add {file_path} - Commit:
git commit -m "learn({skill}): {short lesson summary}" - Show: "Lesson committed: "
{commit hash}
If declined:
- Skip commit, lesson is saved locally
- Show: "Lesson saved (not committed)"
询问用户:
是否提交这条经验总结?[是/否]若确认:
- 暂存:
git add {file_path} - 提交:
git commit -m "learn({skill}): {经验内容简短总结}" - 显示: "经验总结已提交: "
{提交哈希值}
若拒绝:
- 跳过提交,经验总结已保存至本地
- 显示: "经验总结已保存(未提交)"
Error Handling
错误处理
No Target
未指定目标
"No target specified. Which skill or context should this lesson apply to?"
"未指定目标。这条经验应该应用于哪个技能或上下文?"
Target Not Found
目标未找到
"Skill '{target}' not found. Available skills: {list}"
"未找到技能'{target}'。可用技能: {列表}"
Empty Lesson
经验内容为空
"No lesson provided. What feedback should be remembered?"
"未提供经验内容。需要记录什么反馈?"
LEARN.md Create Fail
LEARN.md创建失败
"Could not create LEARN.md. Check file permissions."
"无法创建LEARN.md文件。请检查文件权限。"
Trust Rules
信任规则
- NEVER modify without user confirmation
- ALWAYS show preview before writing
- PRESERVE existing lessons
- ASK when category is unclear
- 绝不在未获得用户确认的情况下修改内容
- 始终在写入前显示预览
- 保留现有经验内容
- 询问当分类不明确时
Skill Alignment
技能一致性
- Two-phase workflow with HARD STOP for human approval
- Single source of truth (no duplication)
- Plugin-internal automation
- Maintains human control over changes
- 包含强制人工审核暂停的两阶段工作流
- 单一事实来源(无重复)
- 插件内部自动化
- 保持人类对变更的控制权
Definition of Done
完成标准
- Target skill/context identified and validated
- Lesson categorized (questions/edge-cases/workflow/mistakes)
- Preview shown and user approved
- LEARN.md file updated with new lesson
- Commit offered to user
- 已识别并验证目标技能/上下文
- 经验内容已分类(questions/edge-cases/workflow/mistakes)
- 已显示预览并获得用户批准
- LEARN.md文件已添加新经验内容
- 已向用户询问是否提交