continuous-learning

自动从 Claude Code 会话(Session)中提取可重用的模式(Pattern),并将其作为已学习的技能(Skill)保存以备将来使用。

351 stars

Best use case

continuous-learning is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. 自动从 Claude Code 会话(Session)中提取可重用的模式(Pattern),并将其作为已学习的技能(Skill)保存以备将来使用。

自动从 Claude Code 会话(Session)中提取可重用的模式(Pattern),并将其作为已学习的技能(Skill)保存以备将来使用。

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "continuous-learning" skill to help with this workflow task. Context: 自动从 Claude Code 会话(Session)中提取可重用的模式(Pattern),并将其作为已学习的技能(Skill)保存以备将来使用。

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/continuous-learning/SKILL.md --create-dirs "https://raw.githubusercontent.com/xu-xiang/everything-claude-code-zh/main/docs/ja-JP/skills/continuous-learning/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/continuous-learning/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How continuous-learning Compares

Feature / Agentcontinuous-learningStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

自动从 Claude Code 会话(Session)中提取可重用的模式(Pattern),并将其作为已学习的技能(Skill)保存以备将来使用。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 持续学习技能(Continuous Learning Skill)

Claude Code 会话结束时自动进行评估,提取可作为已学习技能保存的可重用模式(Pattern)。

## 工作原理(How it Works)

此技能在每个会话结束时作为 **Stop 钩子(Hook)** 执行:

1. **会话评估**:检查会话是否有足够的消息(默认:10 条以上)
2. **模式检测**:识别可从会话中提取的模式
3. **技能提取**:将有用的模式保存到 `~/.claude/skills/learned/`

## 配置(Configuration)

通过编辑 `config.json` 进行自定义:

```json
{
  "min_session_length": 10,
  "extraction_threshold": "medium",
  "auto_approve": false,
  "learned_skills_path": "~/.claude/skills/learned/",
  "patterns_to_detect": [
    "error_resolution",
    "user_corrections",
    "workarounds",
    "debugging_techniques",
    "project_specific"
  ],
  "ignore_patterns": [
    "simple_typos",
    "one_time_fixes",
    "external_api_issues"
  ]
}
```

## 模式类型(Pattern Types)

| 模式 | 描述 |
|---------|-------------|
| `error_resolution` | 特定错误的解决方法 |
| `user_corrections` | 来自用户修正的模式 |
| `workarounds` | 针对框架/库特性的解决方案 |
| `debugging_techniques` | 有效的调试方法(Debugging Approaches) |
| `project_specific` | 项目特定的约定 |

## 钩子配置(Hook Configuration)

添加到 `~/.claude/settings.json`:

```json
{
  "hooks": {
    "Stop": [{
      "matcher": "*",
      "hooks": [{
        "type": "command",
        "command": "~/.claude/skills/continuous-learning/evaluate-session.sh"
      }]
    }]
  }
}
```

## 为什么使用 Stop 钩子

- **轻量**:仅在会话(Session)结束时执行一次
- **非阻塞**:不会给每条消息增加延迟(Latency)
- **完整上下文**:可以访问整个会话的转录内容

## 相关项目

- [The Longform Guide](https://x.com/affaanmustafa/status/2014040193557471352) - 关于持续学习的部分
- `/learn` 命令 - 会话中的手动模式提取

---

## 对比笔记(调查:2025年1月)

### vs Homunculus

Homunculus v2 采用了更精细的方法:

| 功能 | 当前方法 | Homunculus v2 |
|---------|--------------|---------------|
| 观察 | Stop 钩子 (会话结束时) | PreToolUse/PostToolUse 钩子 (100% 可靠性) |
| 分析 | 主上下文 (Main Context) | 后台智能体 (Background Agent, Haiku) |
| 粒度 | 完整的技能 | 原子级的“本能 (Instinct)” |
| 置信度 | 无 | 0.3-0.9 的权重分配 |
| 演进 | 直接转换为技能 | 本能 → 集群 → 技能/命令/智能体 |
| 共享 | 无 | 本能的导出/导入 |

**homunculus 的重要洞察:**
> "v1 依赖技能进行观察。技能是概率性的,触发率约为 50-80%。v2 使用钩子(100% 可靠性)进行观察,并使用本能作为学习行为的原子单位。"

### v2 的潜在改进

1. **基于本能的学习** - 具有置信度评分的更小、原子级的行为
2. **后台观察者** - 并行分析的 Haiku 智能体
3. **置信度衰减** - 在发生冲突时降低本能的置信度
4. **领域标签** - 代码风格、测试、git、调试等
5. **演进路径** - 将相关的本能聚类为技能/命令/智能体

详细信息:请参阅 `/Users/affoon/Documents/tasks/12-continuous-learning-v2.md`。

Related Skills

continuous-learning-v2

351
from xu-xiang/everything-claude-code-zh

一种基于本能(Instinct)的训练系统,通过钩子(Hooks)观察会话,创建带有置信度评分的原子化本能,并将其进化为技能(Skills)、命令(Commands)或智能体(Agents)。

plankton-code-quality

351
from xu-xiang/everything-claude-code-zh

使用 Plankton 实现编写时代码质量强制执行 —— 通过钩子在每次文件编辑时进行自动格式化、代码检查,并由 Claude 驱动自动修复。

autonomous-loops

351
from xu-xiang/everything-claude-code-zh

自主运行 Claude Code 循环的模式与架构 —— 从简单的顺序流水线到 RFC 驱动的多智能体 DAG 系统。

visa-doc-translate

351
from xu-xiang/everything-claude-code-zh

将签证申请文件(图片)翻译成英文,并创建包含原文和译文的双语PDF

swiftui-patterns

351
from xu-xiang/everything-claude-code-zh

SwiftUI 架构模式,使用 @Observable 进行状态管理,视图组合,导航,性能优化,以及现代 iOS/macOS UI 最佳实践。

swift-protocol-di-testing

351
from xu-xiang/everything-claude-code-zh

基于协议的依赖注入,用于可测试的Swift代码——使用聚焦协议和Swift Testing模拟文件系统、网络和外部API。

swift-concurrency-6-2

351
from xu-xiang/everything-claude-code-zh

Swift 6.2 可接近的并发性 — 默认单线程,@concurrent 用于显式后台卸载,隔离一致性用于主 actor 类型。

swift-actor-persistence

351
from xu-xiang/everything-claude-code-zh

在 Swift 中使用 actor 实现线程安全的数据持久化——基于内存缓存与文件支持的存储,通过设计消除数据竞争。

skill-stocktake

351
from xu-xiang/everything-claude-code-zh

用于审计Claude技能和命令的质量。支持快速扫描(仅变更技能)和全面盘点模式,采用顺序子代理批量评估。

search-first

351
from xu-xiang/everything-claude-code-zh

研究优先于编码的工作流程。在编写自定义代码之前,搜索现有的工具、库和模式。调用研究员代理。

regex-vs-llm-structured-text

351
from xu-xiang/everything-claude-code-zh

选择在解析结构化文本时使用正则表达式还是大型语言模型的决策框架——从正则表达式开始,仅在低置信度的边缘情况下添加大型语言模型。

liquid-glass-design

351
from xu-xiang/everything-claude-code-zh

iOS 26 液态玻璃设计系统 — 适用于 SwiftUI、UIKit 和 WidgetKit 的动态玻璃材质,具有模糊、反射和交互式变形效果。