AgentSkillsCN

learn

一种持久化内存系统,可在不同会话间存储并调用学习成果。 当您遇到以下情况时,自动调用此技能: - 修复了一个看似不起眼的 Bug(将其归类为“Bug”); - 发现了一个实用的代码模式(将其归类为“模式”); - 遇到了某个易错点或边缘场景(将其归类为“易错点”); - 找到了一款好用的工具或库功能(将其归类为“工具”); - 实现了一项性能优化(将其归类为“性能优化”); - 发现了能有效解决问题的配置方案(将其归类为“配置”); - 做出带有充分理由的架构决策(将其归类为“架构”); - 深入洞察了有益的测试方法(将其归类为“测试”)。 此外,当用户说:“记住这个”、“记录学习心得”、“回顾所学”、“我们学到了什么”、“汲取经验教训”时,也请主动调用此技能。

SKILL.md
--- frontmatter
name: learn
description: |
  Persistent memory system for storing and recalling learnings across sessions.

  AUTO-INVOKE THIS SKILL when you:
  - Fix a non-obvious bug (store as "bug")
  - Discover a useful code pattern (store as "pattern")
  - Encounter a gotcha or edge case (store as "gotcha")
  - Find a useful tool/library feature (store as "tool")
  - Make a performance optimization (store as "perf")
  - Discover configuration that solved a problem (store as "config")
  - Make an architecture decision with rationale (store as "arch")
  - Find a useful testing insight (store as "test")

  Also invoke when user says: "remember this", "store learning", "recall learnings",
  "what did we learn", "lessons learned"

Persistent Learning System

Store learnings that survive across Claude Code sessions. Proactively store learnings when you discover something valuable - don't wait for the user to ask.

Auto-Store Triggers

Store a learning AUTOMATICALLY when:

  • You fix a bug that wasn't immediately obvious
  • You discover why something was breaking
  • You find a workaround for a limitation
  • You make a decision that future sessions should know about
  • You encounter behavior that was unexpected
  • You find a pattern that works well in this codebase

Actions

Store a learning

bash
bash ~/.claude/scripts/store-learning.sh "<category>" "<learning>" "[context]"

Categories: bug, pattern, gotcha, tool, perf, config, arch, test

Examples:

bash
# After fixing a hydration error
bash ~/.claude/scripts/store-learning.sh "bug" "useAuth hook causes hydration mismatch - wrap in dynamic import with ssr:false"

# After discovering a pattern
bash ~/.claude/scripts/store-learning.sh "pattern" "Always use Image wrapper from @/components/image, not next/image directly"

# After hitting a gotcha
bash ~/.claude/scripts/store-learning.sh "gotcha" "Biome ignores .mdx files by default - add to biome.json includes"

# After a tool discovery
bash ~/.claude/scripts/store-learning.sh "tool" "Use 'bun --bun' flag to enable native Bun APIs in scripts"

Recall learnings

bash
bash ~/.claude/scripts/recall-learnings.sh [filter] [value]

Filters:

  • all - All learnings for current project
  • all-projects - List all projects with learnings
  • category <cat> - Filter by category
  • search <keyword> - Search in learning text
  • recent <n> - Most recent n learnings

Delete a learning

bash
bash ~/.claude/scripts/delete-learning.sh <id>

Storage

Learnings are stored per-project at ~/.claude/learnings/<project>/learnings.json

Best Practices

  1. Be specific - Include the actual fix, not just "fixed the bug"
  2. Include context - What file, what component, what was the symptom
  3. Store immediately - Don't wait until end of session
  4. Categorize correctly - Helps with recall later