Communitygithub.com

持续学习技能(已弃用)

【已弃用 - 请改用 continuous-learning-v2】旧版 v1 基于停止钩子的技能提取器。v2 是一个严格超集,具备基于直觉、项目范围限定、钩子可靠的学习能力。请勿调用 v1:当请求持续学习、会话学习或模式提取时,请路由至 continuous-learning-v2。

持续学习技能(已弃用) 是什么?

本技能是一个用于从 Claude Code 会话中自动提取可复用模式的旧版工具,现已弃用。它通过 Stop 钩子在每次会话结束时运行,检测至少包含 10 条消息的会话,识别错误解决方案、用户纠正、变通方法、调试技巧和项目特定约定等常见模式,并将它们保存为'学习到的技能'文件。该技能支持通过 JSON 配置文件自定义最小会话长度、提取阈值、要检测或忽略的模式类型。然而,由于在观察机制、分析粒度和可靠性方面的局限性,v1 已被更先进的 v2 版本取代,v2 通过 PreToolUse/PostToolUse 钩子实现了 100% 可靠观察,并引入了带置信度评分的原子'直觉'行为。本技能适用于高级用户研究旧工作流或与遗留安装保持兼容,但对于新部署,应优先使用 continuous-learning-v2。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/continuous-learning

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

持续学习技能 - 已弃用

已于 2026-04-28 弃用。 请使用 continuous-learning-v2 替代。v2 是一个严格超集:停止钩子观察升级为 PreToolUse/PostToolUse 观察,完整技能变为带置信度评分的原子直觉,全局存储变为项目范围限定加全局升级。

本文件保留以供存档参考,并与现有安装向后兼容。


原始 v1 文档(存档)

在 Claude Code 会话结束时自动评估,提取可复用的模式并保存为学习到的技能。

何时激活

  • 设置从 Claude Code 会话中自动提取模式
  • 配置用于会话评估的 Stop 钩子
  • 审查或管理 ~/.claude/skills/learned/ 中的学习到的技能
  • 调整提取阈值或模式类别
  • 比较 v1(本版本)与 v2(基于直觉)的方法

状态

本 v1 技能仍受支持,但对于新安装,continuous-learning-v2 是更优选择。当您明确需要更简单的 Stop 钩子提取流程,或需要与旧版学习技能工作流兼容时,可保留 v1。

工作原理

该技能作为 Stop 钩子 在每次会话结束时运行:

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

配置

编辑 config.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"
  ]
}

模式类型

模式描述
error_resolution特定错误的解决方法
user_corrections来自用户纠正的模式
workarounds框架/库问题的解决方案
debugging_techniques有效的调试方法
project_specific项目特定的约定

钩子设置

添加到您的 ~/.claude/settings.json:

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

为什么使用 Stop 钩子?

  • 轻量级:仅在会话结束时运行一次
  • 非阻塞:不影响每条消息的延迟
  • 完整上下文:可访问整个会话记录

相关资源

  • 长篇指南 - 关于持续学习的章节
  • /learn 命令 - 会话中手动提取模式

对比说明(研究:2025 年 1 月)

对比 Homunculus

Homunculus v2 采用了更复杂的方法:

特性我们的方法Homunculus v2
观察机制Stop 钩子(会话结束时)PreToolUse/PostToolUse 钩子(100% 可靠)
分析方式主上下文后台代理(Haiku)
粒度完整技能原子“直觉”
置信度无加权 0.3-0.9
进化路径直接成为技能直觉 → 聚类 → 技能/命令/代理
共享方式无导出/导入直觉

来自 homunculus 的关键洞察:

“v1 依赖技能进行观察。技能是概率性的——触发率约为 50-80%。v2 使用钩子进行观察(100% 可靠),并将直觉作为学习行为的基本单位。”

潜在的 v2 增强

  1. 基于直觉的学习 - 更小、原子的行为,带有置信度评分
  2. 后台观察者 - Haiku 代理并行分析
  3. 置信度衰减 - 如果被反驳,直觉降低置信度
  4. 领域标记 - 代码风格、测试、Git、调试等
  5. 进化路径 - 将相关直觉聚类为技能/命令

请参阅:docs/continuous-learning-v2-spec.md 获取完整规范。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相关技能