lesson-learned by softaworks/agent-toolkit
npx skills add https://github.com/softaworks/agent-toolkit --skill lesson-learned从实际的代码变更中提取具体、扎实的软件工程经验。这不是说教——而是一面镜子。向用户展示他们的代码已经证明了什么。
首先加载原则参考。
references/se-principles.md 以获取可用的原则目录references/anti-patterns.md在至少加载了 se-principles.md 之前,请勿继续。
询问用户或根据上下文推断需要分析什么。
| 范围 | Git 命令 | 使用时机 |
|---|---|---|
| 功能分支 | git log main..HEAD --oneline + git diff main...HEAD |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 用户处于非主分支上(默认) |
| 最近 N 次提交 | git log --oneline -N + git diff HEAD~N..HEAD | 用户指定了范围,或处于主分支上(默认 N=5) |
| 特定提交 | git show <sha> | 用户引用了特定的提交 |
| 工作区变更 | git diff + git diff --cached | 用户在提交前询问"这些变更怎么样?" |
默认行为:
git log 以获取提交列表和消息git diff 以获取该范围的完整差异git diff --stat,然后有选择地阅读变更最多的 3-5 个文件识别主导模式——关于这些变更中最具指导意义的一件事。
寻找:
将发现映射到 references/se-principles.md 中的具体原则。要具体——引用实际的代码,参考实际的文件名和行变更。
使用此模板:
## 经验:[原则名称]
**代码中发生了什么:**
[2-3 句话描述具体变更,引用文件和提交]
**起作用的原则:**
[1-2 句话解释软件工程原则]
**为什么这很重要:**
[1-2 句话说明实际后果——如果没有这个会出什么问题,或者因为有这个而有什么好处]
**下次的收获:**
[一句具体、可操作的句子,用户可以应用到未来的工作中]
如果还有第二个值得注意的经验(最多额外 2 个):
---
### 也值得注意:[原则名称]
**在代码中:** [1 句话]
**该原则:** [1 句话]
**收获:** [1 句话]
| 避免 | 原因 | 替代做法 |
|---|---|---|
| 列出每一个模糊适用的原则 | 令人不知所措且泛泛而谈 | 选择 1-2 个最相关的 |
| 分析未更改的文件 | 范围蔓延 | 坚持只分析差异 |
| 忽略提交消息 | 它们包含了差异中缺失的意图 | 将它们作为主要上下文来阅读 |
| 与代码脱节的抽象建议 | 不可操作 | 始终引用具体的文件/行 |
| 只有负面反馈 | 令人沮丧 | 先肯定有效的部分,再提出改进建议 |
| 超过 3 条经验 | 稀释了洞察力 | 一条有充分依据的经验胜过七条模糊的经验 |
每周安装量
510
仓库
GitHub 星标数
1.2K
首次出现
2026年2月8日
安全审计
安装于
opencode373
cline372
codex371
gemini-cli371
cursor371
claude-code370
Extract specific, grounded software engineering lessons from actual code changes. Not a lecture -- a mirror. Show the user what their code already demonstrates.
Load the principles reference first.
references/se-principles.md to have the principle catalog availablereferences/anti-patterns.md if you suspect the changes include areas for improvementDo not proceed until you've loaded at leastse-principles.md.
Ask the user or infer from context what to analyze.
| Scope | Git Commands | When to Use |
|---|---|---|
| Feature branch | git log main..HEAD --oneline + git diff main...HEAD | User is on a non-main branch (default) |
| Last N commits | git log --oneline -N + git diff HEAD~N..HEAD | User specifies a range, or on main (default N=5) |
| Specific commit | git show <sha> | User references a specific commit |
| Working changes | git diff + git diff --cached | User says "what about these changes?" before committing |
Default behavior:
git log with the determined scope to get the commit list and messagesgit diff for the full diff of the scopegit diff --stat first, then selectively read the top 3-5 most-changed filesIdentify the dominant pattern -- the single most instructive thing about these changes.
Look for:
Map findings to specific principles from references/se-principles.md. Be specific -- quote actual code, reference actual file names and line changes.
Use this template:
## Lesson: [Principle Name]
**What happened in the code:**
[2-3 sentences describing the specific change, referencing files and commits]
**The principle at work:**
[1-2 sentences explaining the SE principle]
**Why it matters:**
[1-2 sentences on the practical consequence -- what would go wrong without this, or what goes right because of it]
**Takeaway for next time:**
[One concrete, actionable sentence the user can apply to future work]
If there is a second lesson worth noting (maximum 2 additional):
---
### Also worth noting: [Principle Name]
**In the code:** [1 sentence]
**The principle:** [1 sentence]
**Takeaway:** [1 sentence]
| Avoid | Why | Instead |
|---|---|---|
| Listing every principle that vaguely applies | Overwhelming and generic | Pick the 1-2 most relevant |
| Analyzing files that were not changed | Scope creep | Stick to the diff |
| Ignoring commit messages | They contain intent that diffs miss | Read them as primary context |
| Abstract advice disconnected from the code | Not actionable | Always reference specific files/lines |
| Negative-only feedback | Demoralizing | Lead with what works, then suggest improvements |
| More than 3 lessons | Dilutes the insight | One well-grounded lesson beats seven vague ones |
Weekly Installs
510
Repository
GitHub Stars
1.2K
First Seen
Feb 8, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode373
cline372
codex371
gemini-cli371
cursor371
claude-code370
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
106,200 周安装