重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/shihyuho/skills --skill lessons-learned使用此技能来维护一个轻量级的项目记忆循环。
将此文件视为唯一可信源,用于定义经验记忆的行为:触发规则、回忆流程、捕获流程、限制条件和验证规则。README.md、references/ 以及阶段入口命令均不得覆盖这些规则。
在以下时刻调用此技能:
以下情况不触发:
当此技能是会话中的主要流程技能时:
将所有经验制品存储在项目根目录下的 docs/lessons/ 中:
docs/lessons/
├── _index.md
├── api-timeout-retry-pattern.md
├── db-migration-run-order.md
└── null-check-before-save.md
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
每张经验卡都是一个原子化的 Zettelkasten 笔记。每张卡片只保留一条可复用的经验。
在整个技能包中各处应用这些限制:
related 链接。confidence 在闭区间 0.0-0.9 内。如果其他文件与此限制冲突,以此文件为准。
在编写代码前运行此阶段。
docs/lessons/ 不存在,将其视为首次运行状态并跳过回忆。docs/lessons/ 存在但 _index.md 不存在,则本次回忆直接读取现有卡片的前置元数据,并警告应在下一次捕获/更新维护过程中重建 _index.md。project 用于跨领域或仓库范围的关注点module 用于包/目录级别的关注点feature 用于特定流程或组件docs/lessons/_index.md。docs/lessons/ 中的卡片构建常规回忆的候选集。
confidence: 0.0 的卡片。confidence 的卡片仍有资格,并使用旧版回退机制。confidence: 0.0 的卡片仍保留在 docs/lessons/ 中,供显式历史查找使用。标签匹配 -> 范围匹配 -> 置信度(降序) -> 日期(降序)。
confidence 缺失时应用:根据 source 推导(user-correction=0.7, bug-fix=0.5, retrospective=0.3)。如果两者都缺失,则使用 0.3。related 链接进行扩展,最多加载 2 张额外卡片。confidence 的只读操作:
* 不要因为加载了某条经验而更改其 confidence。
* 不要因为未加载某条经验而更改其 confidence。
* 不要因为某条经验最近未被使用而更改其 confidence。如果没有匹配的卡片,则在没有经验约束的情况下继续工作。
以下情况视为非阻塞性警告,继续执行:
docs/lessons/。_index.md,因此本次回忆使用了直接的卡片元数据。confidence,需要旧版回退。related 目标缺失。当满足以下任一条件时运行此阶段:
此阶段用于两种类型的记忆维护:
提问:"下次出现类似任务时,这条经验能节省时间吗?"
此步骤分别应用于两个决策:
跳过创建新卡并不跳过对现有卡片的纠正性更新。如果当前工作表明某条已回忆或相关的卡片需要纠正,即使没有捕获新经验,也要继续对该现有卡片执行步骤 2。
只捕获非显而易见的见解。优先捕获以下类型的经验:
满足以下条件则捕获:
满足以下条件则更新现有卡片:
满足以下条件则跳过:
这些跳过规则适用于创建新卡片。当当前证据表明需要重写现有卡片或更改其 confidence 时,它们不会阻止对现有卡片进行纠正性更新。
创建新卡片时,生成一个描述经验的语义化 kebab-case ID(例如 api-timeout-retry-pattern)。
在编写或更新卡片之前,检查是否存在语义相似的现有卡片,并明确做出决定:
decision=create。decision=update。仅当捕获过程中所有受影响的卡片共享相同的结果类型时,才使用 decision=create 或 decision=update。如果一次捕获过程同时创建和更新了卡片,则只报告 created=<n> 和 updated=<n> 计数。
当一次捕获过程影响多张卡片时,报告 created=<n> 和 updated=<n> 计数。如果一次捕获过程同时创建和更新了卡片,则不要包含 decision=。
在编写卡片前分配一个 scope:
project 用于仓库范围的约束module 用于包/目录级别的约束feature 用于单个流程/组件根据 source 分配初始 confidence:
user-correction: 0.7bug-fix: 0.5retrospective: 0.3置信度仅在捕获/更新期间更改,绝不在回忆期间更改。
如果用户明确确认某条经验仍然有用,则将 confidence 增加 +0.1(最大 0.9)。
当后续证据表明经验适用性降低时,将 confidence 降低 -0.1。
当经验部分过时时,首先更新卡片内容,然后仅在需要时降低 confidence。
仅当卡片不应再参与常规回忆时,才将 confidence 直接设置为 0.0。
不要仅仅因为经验最近未被使用而降低 confidence。
使用 references/card-template.md 中的模板将卡片写入 docs/lessons/<id>.md。
创建新卡片前,检查语义重复:
当当前工作削弱了某条已回忆或相关的卡片时:
confidenceconfidence 设置为 0.0最小纠正捕获示例:
经验捕获报告:decision=update, updated=1 (
db-migration-run-order), confidence=0.7->0.6 (在当前配置中适用性减弱), skipped=0
卡片字段:
| 字段 | 用途 |
|---|---|
id | 语义化 kebab-case 标识符,也是文件名 |
date | 捕获经验的 ISO 日期 |
scope | project / module / feature 适用性 |
tags | 3–6 个小写标签,用于回忆匹配 |
source | user-correction / bug-fix / retrospective |
confidence | 用于回忆排序的数值置信度分数 |
related | 0–2 个高相关性经验引用,使用 [[card-id]] |
| 标题 | 经验的一行摘要 |
| 上下文 | 错误发生时的情况 |
| 错误 | 出了什么问题 |
| 经验 | 提取的规则或最佳实践 |
| 何时应用 | 未来此经验重要的场景 |
任务结束时的行为:
每个卡片 ID 在 docs/lessons/_index.md 中更新或插入一行。
如果 _index.md 不存在,则使用以下结构创建它:
# 经验索引
> 由经验总结技能自动生成。请勿手动编辑。
| 卡片 | 范围 | 标签 | 日期 |
|---|---|---|---|
然后保持行按 日期 降序排序(最新的在前)。
使用简洁的报告告知用户捕获的内容,例如:
经验捕获报告:created=1 (
api-timeout-retry-pattern), updated=1 (db-migration-run-order), skipped=1 (显而易见的行为)
如果所有受影响的卡片共享相同的结果类型,则在报告中包含 decision=create 或 decision=update。如果一次捕获过程同时创建和更新了卡片,则只报告 created=<n> 和 updated=<n> 计数。
当捕获或更新更改了置信度时,为每张受影响的卡片包含置信度转换 旧值->新值 及简短原因。
对于新卡片,使用 none-><值>。
如果转换达到 0.0,则明确声明该卡片已从常规回忆中排除。
示例:
经验捕获报告:decision=create, created=1 (\api-timeout-retry-pattern), confidence=none->0.5 (新的可复用模式)经验捕获报告:decision=update, updated=1 (\db-migration-run-order), confidence=0.7->0.6 (在当前配置中适用性减弱)经验捕获报告:decision=update, updated=1 (\legacy-bootstrap-flow), confidence=0.1->0.0 (已从常规回忆中排除)保持此确认信息简短。首选决策、受影响的卡片 ID 和一行规则摘要。在正常输出中避免转储完整的 Markdown 卡片或索引内容。
仅对高价值卡片使用 related 链接。
当至少满足 4 条中的 2 条 条件时创建 related 链接:
链接约束:
references/linking-heuristics.md 中的确定性排序。损坏的相关目标是非阻塞性的:
何时应用 中提供具体触发条件的宽泛建议。在捕获或更新期间应用这些检查。除非在其他地方明确列为警告,否则这些是阻塞性失败。
id 标识符。date 格式为 ISO YYYY-MM-DD。scope 是 project、module、feature 之一。tags 数量为 3–6。source 是有效的枚举值。confidence 是数值且在范围 0.0-0.9 内。related 数量为 0–2,且每个目标都解析到现有卡片。scope。_index.md 中的行按 日期 降序排序(最新的在前)。当在同一会话中与其他技能一起使用时,遵循触发约定作为唯一可信源:
这是一个不可替代的步骤——经验捕获不能被待办事项跟踪器、进度文件或其他技能制品替代。
每周安装数
54
仓库
首次出现
2026年2月6日
安全审计
安装于
gemini-cli52
github-copilot52
codex52
kimi-cli52
opencode52
amp51
Use this skill to maintain a lightweight project memory loop.
Treat this file as the single source of truth for lesson-memory behavior: trigger rules, recall flow, capture flow, limits, and validation. README.md, references/, and phase-entry commands must not override those rules.
Invoke this skill in these moments:
Do not trigger for:
When this skill is the primary process skill in a session:
Store all lesson artifacts under docs/lessons/ at the project root:
docs/lessons/
├── _index.md
├── api-timeout-retry-pattern.md
├── db-migration-run-order.md
└── null-check-before-save.md
Each lesson card is one atomic Zettelkasten note. Keep one reusable lesson per card.
Apply these limits everywhere in the skill package:
related links per card.confidence in the inclusive range 0.0-0.9.If another file conflicts with these limits, this file wins.
Run this phase before writing code.
docs/lessons/ does not exist, treat this as first-run state and skip recall.docs/lessons/ exists but _index.md does not, read existing card frontmatter directly for this recall pass and warn that _index.md should be rebuilt during the next capture/update maintenance pass.project for cross-cutting or repo-wide concernsmodule for package/directory-level concernsfeature for a specific flow or componentdocs/lessons/_index.md.If no cards match, continue work without lesson constraints.
Treat these as non-blocking and continue:
docs/lessons/ is missing on first run._index.md is missing, so this recall pass used direct card metadata.confidence and needs legacy fallback.related target is missing.Run this phase when any of these conditions are met:
Use this phase for both kinds of memory maintenance:
Ask: "Will this lesson save time next time a similar task appears?"
Apply this step separately for two decisions:
Skipping new-card creation does not skip corrective updates to an existing card. If current work shows that a recalled or related card needs correction, continue to Step 2 for that existing card even when no new lesson is captured.
Only capture non-obvious insights. Prioritize lessons such as:
Capture if:
Update an existing card if:
Skip if:
These skip rules apply to creating a new card. They do not block corrective updates to an existing card when current evidence shows that the card should be rewritten or its confidence should change.
Generate a semantic kebab-case ID that describes the lesson (e.g., api-timeout-retry-pattern) when creating a new card.
Before writing or updating a card, check for a semantically similar existing card and make the decision explicit:
decision=create when no similar card exists and a new lesson should be captured.decision=update when a similar card already covers the same lesson, or when current work corrects an existing card.Use decision=create or decision=update only when all affected cards in the capture pass share the same outcome kind. If one capture pass both creates and updates cards, report only the created=<n> and updated=<n> counts.
When one capture pass affects multiple cards, report created=<n> and updated=<n> counts. If one capture pass both creates and updates cards, do not include decision=.
Assign a scope before writing the card:
project for repo-wide constraintsmodule for package/directory-level constraintsfeature for one flow/componentAssign initial confidence by source:
user-correction: 0.7bug-fix: 0.5retrospective: 0.3Confidence changes only during capture/update, never during recall.
If the user explicitly confirms a lesson remains useful, increase confidence by +0.1 (max 0.9).
Decrease confidence by -0.1 when later evidence shows the lesson is less applicable.
When a lesson is partially outdated, update the card content first, then decrease confidence only if needed.
Set confidence directly to 0.0 only when the card should no longer participate in normal recall.
Do not decrease confidence solely because the lesson was not used recently.
Write the card to docs/lessons/<id>.md using the template in references/card-template.md.
Before creating a new card, check semantic duplication:
When current work weakens a recalled or related card:
confidence only if the lesson's default applicability is weaker than beforeconfidence to 0.0 only when the card should no longer participate in normal recallMinimal correction-capture example:
Lessons capture report: decision=update, updated=1 (
db-migration-run-order), confidence=0.7->0.6 (weaker applicability in current config), skipped=0
Card fields:
| Field | Purpose |
|---|---|
id | Semantic kebab-case slug, also the filename |
date | ISO date when the lesson was captured |
scope | project / module / feature applicability |
tags | 3–6 lowercase tags for recall matching |
source |
Task-end behavior:
Upsert one row in docs/lessons/_index.md per card ID.
If _index.md does not exist, create it with this structure:
# Lessons Index
> Auto-generated by lessons-learned skill. Do not edit manually.
| Card | Scope | Tags | Date |
|---|---|---|---|
Then keep rows sorted by Date descending (newest first).
Tell the user what was captured using a compact report, e.g.:
Lessons capture report: created=1 (
api-timeout-retry-pattern), updated=1 (db-migration-run-order), skipped=1 (obvious behavior)
If all affected cards share the same outcome kind, include decision=create or decision=update in the report. If one capture pass both creates and updates cards, report only the created=<n> and updated=<n> counts.
When capture or update changes confidence, include confidence transition old->new for each affected card plus a short reason.
For new cards, use none-><value>.
If a transition reaches 0.0, explicitly state that the card is excluded from normal recall.
Examples:
Lessons capture report: decision=create, created=1 (\api-timeout-retry-pattern), confidence=none->0.5 (new reusable pattern)Lessons capture report: decision=update, updated=1 (\db-migration-run-order), confidence=0.7->0.6 (weaker applicability in current config)Lessons capture report: decision=update, updated=1 (\legacy-bootstrap-flow), confidence=0.1->0.0 (excluded from normal recall)Keep this confirmation short. Prefer the decision, the affected card ID, and a one-line rule summary. Avoid dumping the full markdown card or index contents in normal output.
Use related links for high-value cards only.
Create related links when at least 2 of 4 conditions are true:
Linking constraints:
references/linking-heuristics.md.Broken related targets are non-blocking:
When to Apply.Apply these checks during capture or update. These are blocking failures unless explicitly listed as warnings elsewhere.
id slug.date format is ISO YYYY-MM-DD.scope is one of project, module, feature.tags count is 3–6.source is valid enum.confidence is numeric and in range 0.0-0.9.When used with other skills in the same session, follow the Trigger Contract as the single source of truth:
This is a non-replaceable step — lesson capture cannot be substituted by todo trackers, progress files, or other skill artifacts.
Weekly Installs
54
Repository
First Seen
Feb 6, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli52
github-copilot52
codex52
kimi-cli52
opencode52
amp51
BMAD工作流编排与SSD结构化系统设计 - 多代理AI开发流程自动化
10,600 周安装
Doublecheck AI 内容验证工具 - GitHub Copilot 三层事实核查流程,自动识别幻觉风险
1,400 周安装
Sentry问题修复指南:利用AI分析生产环境错误并自动修复
1,300 周安装
退货与逆向物流管理指南:策略、分级、处置与欺诈检测全流程解析
1,400 周安装
Next.js Turbopack 开发指南:加速启动与热更新,提升开发效率
1,400 周安装
Unity测试运行器 - 命令行自动化执行Unity EditMode/PlayMode测试,集成CI/CD
45 周安装
Kotlin测试模式指南:使用Kotest和MockK进行TDD测试与代码覆盖率
1,400 周安装
docs/lessons/.
confidence: 0.0.confidence remain eligible and use legacy fallback.confidence: 0.0 remain in docs/lessons/ for explicit historical lookup.tag match -> scope match -> confidence (desc) -> date (desc).
confidence is missing: derive it from source (user-correction=0.7, bug-fix=0.5, retrospective=0.3). If both are missing, use 0.3.related links from primary cards, loading up to 2 additional cards.confidence:
* Do not change confidence because a lesson was loaded.
* Do not change confidence because a lesson was not loaded.
* Do not change confidence because a lesson was not used recently.user-correction / bug-fix / retrospective |
confidence | Numeric confidence score used for recall ranking |
related | 0–2 high-relevance lesson references using [[card-id]] |
| Title | One-line summary of the lesson |
| Context | What was happening when the mistake occurred |
| Mistake | What went wrong |
| Lesson | Extracted rule or best practice |
| When to Apply | Future situations where this lesson matters |
related count is 0–2 and every target resolves to an existing card.scope._index.md rows are ordered by Date descending (newest first).