npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

learn-skill-ai

v1.0.9

Published

AI skill that learns from repeated successful actions and auto-creates reusable skills (SKILL.md) for Cursor, Claude Code, and Codex

Downloads

1,089

Readme

Learn

Learn 是一个可在 Cursor、Claude Code、Codex 等工具中使用的 AI 技能:在重复且成功的操作后自动创建可复用技能(SKILL.md),并在后续同类任务中优先调用这些自创技能。

功能

  • 记录:任务成功完成后,将任务摘要与步骤要点写入项目下的 .learn/patterns.json
  • 合并:若判定为「同一类任务」,则合并到已有模式并增加成功次数。
  • 生成技能:当同一模式成功次数 ≥ 3 时,在对应工具的 skills 目录下生成 learned-<slug>/SKILL.md(第 4 次同类请求起使用该技能;如 Cursor 为 .cursor/skills/learned-<slug>/)。
  • 优先调用:新任务开始时,若当前请求与某条已学技能匹配,则优先按该技能的步骤执行。
  • 用户触发:用户可以说「把刚才的操作存成技能」等,直接创建或合并模式并视情况生成技能。

安装

通过 npm(推荐)

安装到 CursorCodexClaude Code 的技能目录(任选其一或全部):

# 安装到 Cursor
npx learn-skill-ai install --cursor

# 安装到 Codex
npx learn-skill-ai install --codex

# 安装到 Claude Code
npx learn-skill-ai install --claude

# 安装到以上三个工具
npx learn-skill-ai install --all

安装后重启对应 IDE 以加载技能。在项目根目录执行安装时,会提示 输入你希望 AI 称呼你的名字,填写后保存到 .learn/config.json;之后 AI 会在每次开始操作时说一句称呼(如「尊敬的xxx」「可爱的xxx」或英文 Dear/Lovely xxx),并在保存技能时说「好的,xxx~」等(根据称呼选语气词)。可直接回车跳过;非交互环境可设置环境变量 LEARN_USER_NAME。各工具会同时安装强制规则Cursor.cursor/rules/learn-after-task.mdcClaude Code.claude/rules/learn-after-task.mdCodex → 在项目 AGENTS.md 中追加 Learn 小节。

也可先安装包再执行安装命令:

npm install -g learn-skill-ai
learn-skill-ai install --cursor
# 或
learn-skill-ai install --all

各工具技能路径

| 工具 | 安装目标路径 | |------|----------------| | Cursor | ~/.cursor/skills/learn/(Windows: %USERPROFILE%\.cursor\skills\learn\) | | Codex | $CODEX_HOME/skills/learn/(默认 ~/.codex/skills/learn/) | | Claude Code | ~/.claude/skills/learn/(Windows: %USERPROFILE%\.claude\skills\learn\) |

手动安装

将本仓库中的 learn/ 目录复制到上表对应路径,或项目级目录(如 Cursor 项目内 .cursor/skills/learn/)。目录结构应包含:

learn/
├── SKILL.md
└── reference.md

使用方式

安装后无需额外配置。在任意已安装 Learn 技能的项目中:

  1. 正常使用:照常向 AI 提需求;AI 会在任务成功后按 Learn 规则记录模式,并在同一类任务成功至少三次后自动生成 .cursor/skills/learned-<slug>/SKILL.md(第 4 次同类请求起使用该技能)。
  2. 自动复用:当新请求与某条已学技能的 taskSummary 匹配时,AI 会优先按该技能的步骤执行,并简要说明「使用已学技能 learned-xxx」。
  3. 主动保存:可以说「把刚才的操作存成技能」「save that as a skill」等,让 AI 立即为刚才完成的任务创建或合并模式,并在满足条件时生成技能。

学习结果(模式与已学技能)均保存在当前项目.learn/patterns.json.cursor/skills/learned-*/

可选配置

  • 成功次数阈值:当前为「同一模式成功 ≥ 3 次」即生成技能(第 4 次起使用)。若需修改,可在本仓库的 learn/SKILL.mdlearn/reference.md 中搜索 successCount >= 3 并改为你期望的数值(需同时保证 Agent 能读到该说明)。
  • 是否提交 .learn/
    • 不提交:在项目 .gitignore 中加入 .learn/,学习结果仅本地可见。
    • 提交:将 .learn/.cursor/skills/learned-*/ 一并提交,团队可共享已学技能。

存储与命名

  • 模式存储.learn/patterns.json,结构见 learn/reference.md
  • 已学技能.cursor/skills/learned-<slug>/SKILL.md<slug> 由任务摘要生成,仅含小写字母、数字、连字符,总长(含 learned-)≤ 64 字符;冲突时加数字后缀(如 learned-add-pytest-2)。
  • 与手写技能区分:所有 Learn 生成的技能目录与 SKILL 内 name 均以 learned- 开头,便于区分和脚本处理。

更多格式与边界情况见 learn/reference.md

示例片段

patterns.json 示例

{
  "version": 1,
  "patterns": [
    {
      "id": "add-pytest-and-run",
      "taskSummary": "为项目添加 pytest 并运行测试",
      "stepsSummary": ["检查依赖", "添加 pytest", "写/运行测试"],
      "successCount": 2,
      "lastDoneAt": "2025-02-02T12:00:00Z",
      "skillCreated": true
    }
  ]
}

生成的 SKILL.md 位置与 frontmatter

  • 路径:.cursor/skills/learned-add-pytest-and-run/SKILL.md
  • frontmatter 示例:name: learned-add-pytest-and-rundescription: ...(何时用、做什么,第三人称,≤1024 字符)

如何测试

1. 本地测试安装脚本

在项目根目录执行:

# 查看帮助(不安装)
node bin/install.js

# 安装到 Cursor 技能目录(会复制 learn/ 到 ~/.cursor/skills/learn)
node bin/install.js install --cursor

安装后检查目标目录是否出现 SKILL.mdreference.md,例如:

  • Cursor%USERPROFILE%\.cursor\skills\learn\(Windows)或 ~/.cursor/skills/learn/(macOS/Linux)

2. 用 npm 命令测试

检查包是否完整(开发/发布前用):

在项目根目录执行 npm test。脚本会检查本仓库里是否存在 learn/SKILL.md;通过则说明包内文件齐全,可发布或安装。

像用户一样测试安装命令(二选一即可):

  • 方式 A:npx(无需先装包,适合快速试)
    在任意目录执行:npx learn-skill-ai install --cursor
    会临时下载并运行本包,把 learn/ 复制到 Cursor 技能目录。效果和用户从 npm 安装后执行 learn-skill-ai install --cursor 一致。

  • 方式 B:npm link(本地开发时模拟“全局安装”)

    1. 在本项目根目录执行:npm link
    2. 之后在任意目录执行:learn-skill-ai install --cursor
      相当于先把当前项目“链接”成全局命令,再测试安装到 Cursor。用完可执行 npm unlink -g learn-skill-ai 取消链接。

3. 在 Cursor 里实测 Learn 流程

  1. 用上面任一种方式把 Learn 技能安装到 Cursor(如 npx learn-skill-ai install --cursor),然后重启 Cursor
  2. 打开任意项目,对 AI 说一句明确的任务(例如:「给这个项目加 pytest 并跑一次测试」),等任务成功完成。
  3. 再发一次同类任务(或说「再按刚才那样做一遍」),完成后再检查:
    • 项目根下是否生成 .learn/patterns.json
    • 若同一类任务成功 ≥2 次,.cursor/skills/ 下是否出现 learned-<slug>/SKILL.md
  4. 或者直接说「把刚才的操作存成技能」,看是否立刻生成对应技能并写入 .learn/patterns.json

依赖与范围

  • 运行环境:Cursor、Claude Code、Codex;技能格式与各工具的 SKILL.md 规范一致(如 Cursor create-skill)。
  • 作用域:按项目存储;学习结果(.learn/learned-* 技能)在项目内生效。若需个人级学习,可扩展为读写用户目录下的 learned-*

许可与贡献

本仓库为 Learn 技能的实现与说明;使用方式与 Cursor、Claude Code、Codex 技能规范一致。修改 learn/SKILL.mdlearn/reference.md 即可调整行为与命名规则。