docs/ja-JP/skills/continuous-learning-v2/SKILL.md
一种基于本能(Instinct)的训练系统,通过钩子(Hooks)观察会话,创建带有置信度评分的原子化本能,并将其进化为技能(Skills)、命令(Commands)或智能体(Agents)。
npx skillsauth add xu-xiang/everything-claude-code-zh continuous-learning-v2Install this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
这是一款先进的学习系统,能够通过带有置信度评分的小型已学习行为——“本能(Instinct)”,将 Claude Code 会话转化为可重用的知识。
| 特性 | v1 | v2 | |---------|----|----| | 观察(Observation) | Stop 钩子(会话结束时) | PreToolUse/PostToolUse(100% 可靠性) | | 分析 | 主上下文(Main Context) | 后台智能体(Background Agent, Haiku) | | 粒度 | 完整的技能(Skill) | 原子化“本能(Instinct)” | | 置信度 | 无 | 0.3-0.9 加权 | | 进化 | 直接转化为技能 | 本能 → 聚类 → 技能/命令/智能体 | | 共享 | 无 | 本能导出/导入 |
本能(Instinct)是小型且已学习的行为:
---
id: prefer-functional-style
trigger: "when writing new functions"
confidence: 0.7
domain: "code-style"
source: "session-observation"
---
# 优先使用函数式风格
## Action
在合适的情况下,优先使用函数式模式而非类(Class)。
## Evidence
- 观察到 5 次优先使用函数式模式
- 用户在 2025-01-15 将基于类的方法修正为函数式
属性:
code-style、testing、git、debugging、workflow 等。会话活动(Session Activity)
│
│ 钩子捕获提示词 + 工具调用(100% 可靠性)
▼
┌─────────────────────────────────────────┐
│ observations.jsonl │
│ (prompts, tool calls, outcomes) │
└─────────────────────────────────────────┘
│
│ 观察者智能体(Observer Agent)读取(后台运行,Haiku)
▼
┌─────────────────────────────────────────┐
│ 模式检测 │
│ • 用户修正 → 本能 │
│ • 错误解决 → 本能 │
│ • 重复工作流 → 本能 │
└─────────────────────────────────────────┘
│
│ 创建/更新
▼
┌─────────────────────────────────────────┐
│ instincts/personal/ │
│ • prefer-functional.md (0.7) │
│ • always-test-first.md (0.9) │
│ • use-zod-validation.md (0.6) │
└─────────────────────────────────────────┘
│
│ /evolve 聚类
▼
┌─────────────────────────────────────────┐
│ evolved/ │
│ • commands/new-feature.md │
│ • skills/testing-workflow.md │
│ • agents/refactor-specialist.md │
└─────────────────────────────────────────┘
添加到 ~/.claude/settings.json 中。
作为插件安装时(推荐):
{
"hooks": {
"PreToolUse": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/hooks/observe.sh pre"
}]
}],
"PostToolUse": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/hooks/observe.sh post"
}]
}]
}
}
在 ~/.claude/skills 中手动安装时:
{
"hooks": {
"PreToolUse": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh pre"
}]
}],
"PostToolUse": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh post"
}]
}]
}
}
Python CLI 会自动创建,但你也可以手动创建:
mkdir -p ~/.claude/homunculus/{instincts/{personal,inherited},evolved/{agents,skills,commands}}
touch ~/.claude/homunculus/observations.jsonl
/instinct-status # 显示带有置信度评分的已学习本能
/evolve # 将相关的本能聚类为技能/命令
/instinct-export # 导出本能以便共享
/instinct-import # 从他人处导入本能
| 命令 | 说明 |
|---------|-------------|
| /instinct-status | 显示所有已学习的本能及其置信度 |
| /evolve | 将相关的本能聚类为技能/命令 |
| /instinct-export | 导出本能以便共享 |
| /instinct-import <file> | 从他人处导入本能 |
编辑 config.json:
{
"version": "2.0",
"observation": {
"enabled": true,
"store_path": "~/.claude/homunculus/observations.jsonl",
"max_file_size_mb": 10,
"archive_after_days": 7
},
"instincts": {
"personal_path": "~/.claude/homunculus/instincts/personal/",
"inherited_path": "~/.claude/homunculus/instincts/inherited/",
"min_confidence": 0.3,
"auto_approve_threshold": 0.7,
"confidence_decay_rate": 0.05
},
"observer": {
"enabled": true,
"model": "haiku",
"run_interval_minutes": 5,
"patterns_to_detect": [
"user_corrections",
"error_resolutions",
"repeated_workflows",
"tool_preferences"
]
},
"evolution": {
"cluster_threshold": 3,
"evolved_path": "~/.claude/homunculus/evolved/"
}
}
~/.claude/homunculus/
├── identity.json # 个人资料、技术水平
├── observations.jsonl # 当前会话观察记录
├── observations.archive/ # 已处理的观察记录
├── instincts/
│ ├── personal/ # 自动学习的本能
│ └── inherited/ # 从他人处导入的本能
└── evolved/
├── agents/ # 生成的专项智能体
├── skills/ # 生成的技能
└── commands/ # 生成的命令
使用 Skill Creator GitHub App 会同时生成:
SKILL.md 文件(用于向后兼容)来自仓库分析的本能会带有 source: "repo-analysis" 标记,并包含源仓库 URL。
置信度会随着时间进化:
| 分数 | 含义 | 行为 | |-------|---------|----------| | 0.3 | 暂定 | 会被建议但不会强制执行 | | 0.5 | 中等 | 在相关情况下应用 | | 0.7 | 强 | 应用会被自动批准 | | 0.9 | 几乎确定 | 核心行为 |
置信度提升的情况:
置信度下降的情况:
“v1 依赖于技能进行观察。技能是概率性的,根据 Claude 的判断,其触发概率约为 50-80%。”
钩子(Hooks)是100% 确定性触发的。这意味着:
v2 与 v1 完全兼容:
~/.claude/skills/learned/ 技能仍然有效。基于本能的学习:一次一次地观察,教会 Claude 你的模式。
documentation
将签证申请文件(图像)翻译成英文,并创建包含原文和译文的双语 PDF。
development
Claude Code 会话的全方位验证系统。
tools
在编写新功能、修复 Bug 或重构代码时使用此技能。强制执行测试驱动开发(TDD),包括单元测试、集成测试和 E2E 测试,且覆盖率需达到 80% 以上。
tools
SwiftUI 架构模式,使用 @Observable 进行状态管理,视图组合、导航、性能优化以及现代 iOS/macOS UI 最佳实践。