{"_id":"@agenticforge/skills","_rev":"4-e8d8957ac56f6cfd3b5ef122f555d44f","name":"@agenticforge/skills","dist-tags":{"latest":"1.4.0"},"versions":{"1.1.0":{"name":"@agenticforge/skills","version":"1.1.0","keywords":["agenticforge","agent","ai","llm","typescript","skills","agent-skills","skill-agent","plugin","semantic-kernel"],"license":"CC-BY-NC-SA-4.0","_id":"@agenticforge/skills@1.1.0","maintainers":[{"name":"littleblacky","email":"805399080@qq.com"}],"homepage":"https://github.com/LittleBlacky/AgenticFORGE/tree/main/packages/skills#readme","bugs":{"url":"https://github.com/LittleBlacky/AgenticFORGE/issues"},"dist":{"shasum":"a0ce775bbea8a3a9764ab460e2392fe2e047c47f","tarball":"https://registry.npmjs.org/@agenticforge/skills/-/skills-1.1.0.tgz","fileCount":41,"integrity":"sha512-nuuOig2S8DM55qLiptNPA4yQXiKEMxGpOymKhb0CDvdAFmcX8TAqAw6GIsaKY/RglnBpPpZ1y6LGuR0nhB0trw==","signatures":[{"sig":"MEQCID1UGMAiga15yKMwcxhDI50EqAXwhagQH1VhFv5PZu9EAiA0O9Q7x8VKirln8TLtK1R4sIJPhi5cYW8S1gGmukzx8w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":53487},"main":"./dist/cjs/index.cjs","type":"module","types":"./dist/types/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.cjs"}},"gitHead":"b05471ba9cf992a8c2a5a8ff2c8dfeb2b636f856","scripts":{"build":"pnpm run clean && pnpm run typecheck && pnpm run build:types && pnpm run build:js","clean":"rimraf dist","build:js":"rollup -c","typecheck":"tsc -p tsconfig.json --noEmit","build:types":"tsc -p tsconfig.build.json"},"_npmUser":{"name":"littleblacky","email":"805399080@qq.com"},"repository":{"url":"git+https://github.com/LittleBlacky/AgenticFORGE.git","type":"git","directory":"packages/skills"},"_npmVersion":"11.11.0","description":"Agent Skills system for AgenticFORGE — composable, routable agent capability units","directories":{},"sideEffects":false,"_nodeVersion":"22.13.1","dependencies":{"@agenticforge/core":"workspace:^","@agenticforge/tools":"workspace:^"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","rimraf":"^6.0.1","rollup":"^4.50.1","typescript":"~5.9.3","@types/node":"^25.3.3","@rollup/plugin-json":"^6.1.0","@rollup/plugin-terser":"^0.4.4","rollup-plugin-esbuild":"^6.2.1","@rollup/plugin-commonjs":"^28.0.8","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"tmp":"tmp/skills_1.1.0_1773824636532_0.1713874641827866","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@agenticforge/skills","version":"1.1.1","keywords":["agenticforge","agent","ai","llm","typescript","skills","agent-skills","skill-agent","plugin","semantic-kernel"],"license":"CC-BY-NC-SA-4.0","_id":"@agenticforge/skills@1.1.1","maintainers":[{"name":"littleblacky","email":"805399080@qq.com"}],"homepage":"https://github.com/LittleBlacky/AgenticFORGE/tree/main/packages/skills#readme","bugs":{"url":"https://github.com/LittleBlacky/AgenticFORGE/issues"},"dist":{"shasum":"ed9a9b73d417fd9214ac64d901017b17b0c57b95","tarball":"https://registry.npmjs.org/@agenticforge/skills/-/skills-1.1.1.tgz","fileCount":20,"integrity":"sha512-FCQYKsdcgXtWL33lNkFEQekqDCLSH8bQ4AYCEVGA706dbE2BR09ov7W3GaNjULS8wAYOLWfKd3nhFN4YmDiFbA==","signatures":[{"sig":"MEUCIQCUosTLLY7hF0SYDHNObROcsnPkQZmEVdCuNh4eSMImrgIgWY5hzBMFC/KFAXo/DbhB/jqqbzc8Ko5cJDm7R9HLE/I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":69941},"main":"./dist/cjs/index.cjs","type":"module","_from":"file:agenticforge-skills-1.1.1.tgz","types":"./dist/types/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.cjs"}},"scripts":{"build":"pnpm run clean && pnpm run typecheck && pnpm run build:types && pnpm run build:js","clean":"rimraf dist","build:js":"rollup -c","typecheck":"tsc -p tsconfig.json --noEmit","build:types":"tsc -p tsconfig.build.json"},"_npmUser":{"name":"littleblacky","email":"805399080@qq.com"},"_resolved":"C:\\Users\\-_-\\AppData\\Local\\Temp\\af79e4ce3cd295c95dc225a59d31b934\\agenticforge-skills-1.1.1.tgz","_integrity":"sha512-FCQYKsdcgXtWL33lNkFEQekqDCLSH8bQ4AYCEVGA706dbE2BR09ov7W3GaNjULS8wAYOLWfKd3nhFN4YmDiFbA==","repository":{"url":"git+https://github.com/LittleBlacky/AgenticFORGE.git","type":"git","directory":"packages/skills"},"_npmVersion":"11.11.0","description":"Agent Skills system for AgenticFORGE � composable, routable agent capability units","directories":{},"sideEffects":false,"_nodeVersion":"22.13.1","dependencies":{"@agenticforge/core":"^1.1.4","@agenticforge/tools":"^1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","rimraf":"^6.0.1","rollup":"^4.50.1","typescript":"~5.9.3","@types/node":"^25.3.3","@rollup/plugin-json":"^6.1.0","@rollup/plugin-terser":"^0.4.4","rollup-plugin-esbuild":"^6.2.1","@rollup/plugin-commonjs":"^28.0.8","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"tmp":"tmp/skills_1.1.1_1773979546513_0.8892976653485682","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@agenticforge/skills","version":"1.1.2","keywords":["agenticforge","agent","ai","llm","typescript","skills","agent-skills","skill-agent","plugin","semantic-kernel"],"license":"CC-BY-NC-SA-4.0","_id":"@agenticforge/skills@1.1.2","maintainers":[{"name":"littleblacky","email":"805399080@qq.com"}],"homepage":"https://github.com/LittleBlacky/AgenticFORGE/tree/main/packages/skills#readme","bugs":{"url":"https://github.com/LittleBlacky/AgenticFORGE/issues"},"dist":{"shasum":"8ec6e3fa76d0b7e47cbd3f7f5d7e600b3f74a86f","tarball":"https://registry.npmjs.org/@agenticforge/skills/-/skills-1.1.2.tgz","fileCount":19,"integrity":"sha512-i5pvzxcnCpM/UXbIVLXhJ5aN1i35ngqag5f1oHEkYmmCbzxJEGbHn9gNJFU6uMfEHfUidwvLhXeq7sa+QmJgQA==","signatures":[{"sig":"MEQCIFp5Q1yMxph6s3R64841QTFs5ILwIr95crvtwdGI98XaAiAoDt3ScFYXqNw6h3rh1jI2nsHRToxyYkaP7NqVKnygDQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48698},"main":"./dist/cjs/index.cjs","type":"module","types":"./dist/types/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.cjs"}},"gitHead":"65440e1c4a62a20c1940472075b61eda5fe8ebad","scripts":{"build":"pnpm run clean && pnpm run typecheck && pnpm run build:types && pnpm run build:js","clean":"rimraf dist","build:js":"rollup -c","typecheck":"tsc -p tsconfig.json --noEmit","build:types":"tsc -p tsconfig.build.json"},"_npmUser":{"name":"littleblacky","email":"805399080@qq.com"},"repository":{"url":"git+https://github.com/LittleBlacky/AgenticFORGE.git","type":"git","directory":"packages/skills"},"_npmVersion":"11.11.0","description":"Agent Skills system for AgenticFORGE - composable, routable agent capability units","directories":{},"sideEffects":false,"_nodeVersion":"22.13.1","dependencies":{"@agenticforge/core":"workspace:^","@agenticforge/tools":"workspace:^"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","rimraf":"^6.0.1","rollup":"^4.50.1","typescript":"~5.9.3","@types/node":"^25.3.3","@rollup/plugin-json":"^6.1.0","@rollup/plugin-terser":"^0.4.4","rollup-plugin-esbuild":"^6.2.1","@rollup/plugin-commonjs":"^28.0.8","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"tmp":"tmp/skills_1.1.2_1774106900479_0.5515703963692864","host":"s3://npm-registry-packages-npm-production"}},"1.4.0":{"name":"@agenticforge/skills","version":"1.4.0","description":"Agent Skills system for AgenticFORGE - composable, routable agent capability units","type":"module","sideEffects":false,"main":"./dist/cjs/index.cjs","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.cjs"}},"scripts":{"clean":"rimraf dist","typecheck":"tsc -p tsconfig.json --noEmit","build:types":"tsc -p tsconfig.build.json","build:js":"rollup -c","build":"pnpm run clean && pnpm run typecheck && pnpm run build:types && pnpm run build:js"},"dependencies":{"@agenticforge/core":"workspace:^","@agenticforge/tools":"workspace:^","@agenticforge/utils":"workspace:^"},"devDependencies":{"@rollup/plugin-commonjs":"^28.0.8","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.1","@rollup/plugin-terser":"^0.4.4","@types/node":"^25.3.3","rimraf":"^6.0.1","rollup":"^4.59.1","rollup-plugin-esbuild":"^6.2.1","tsx":"^4.21.0","typescript":"~5.9.3"},"repository":{"type":"git","url":"git+https://github.com/LittleBlacky/AgenticFORGE.git","directory":"packages/skills"},"homepage":"https://github.com/LittleBlacky/AgenticFORGE/tree/main/packages/skills#readme","bugs":{"url":"https://github.com/LittleBlacky/AgenticFORGE/issues"},"license":"CC-BY-NC-SA-4.0","keywords":["agenticforge","agent","ai","llm","typescript","skills","agent-skills","skill-agent","plugin","semantic-kernel"],"_id":"@agenticforge/skills@1.4.0","gitHead":"f014e1daba30a75cdd61be96d0a4d481af1d0fbc","_nodeVersion":"20.20.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-mKtPTC8rfe89BRZ5Nk9XsuIBbC6xzgEZCGQk+zg5c9nq3JNJw4GerZX2Uos96p9NQ1jSxhZNqy5QcO627R5yNQ==","shasum":"f8b07de45bc4d13a3566e2934f1e9f37dc5d11a7","tarball":"https://registry.npmjs.org/@agenticforge/skills/-/skills-1.4.0.tgz","fileCount":23,"unpackedSize":64328,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDoDRwTcyaVAP0M/TAFhhxQ/wAuPt43UJWTf6ucGHZNKQIhAKl8BIzMJa0pDXlIAGOBeXaZ2LGCZDFOUfcTs6MQOFjF"}]},"_npmUser":{"name":"littleblacky","email":"805399080@qq.com"},"directories":{},"maintainers":[{"name":"littleblacky","email":"805399080@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/skills_1.4.0_1774583823263_0.07600205497368173"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-18T09:03:56.458Z","modified":"2026-03-27T03:57:03.527Z","1.1.0":"2026-03-18T09:03:56.659Z","1.1.1":"2026-03-20T04:05:46.668Z","1.1.2":"2026-03-21T15:28:20.654Z","1.4.0":"2026-03-27T03:57:03.402Z"},"bugs":{"url":"https://github.com/LittleBlacky/AgenticFORGE/issues"},"license":"CC-BY-NC-SA-4.0","homepage":"https://github.com/LittleBlacky/AgenticFORGE/tree/main/packages/skills#readme","keywords":["agenticforge","agent","ai","llm","typescript","skills","agent-skills","skill-agent","plugin","semantic-kernel"],"repository":{"type":"git","url":"git+https://github.com/LittleBlacky/AgenticFORGE.git","directory":"packages/skills"},"description":"Agent Skills system for AgenticFORGE - composable, routable agent capability units","maintainers":[{"name":"littleblacky","email":"805399080@qq.com"}],"readme":"# @agenticforge/skills\n\n[![npm](https://img.shields.io/npm/v/@agenticforge/skills)](https://www.npmjs.com/package/@agenticforge/skills)\n[![License: CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/)\n\n<p><strong>中文</strong> | <a href=\"./README.md\">English</a></p>\n\nAgenticFORGE 的可组合、可路由 Agent 能力系统。将每种能力定义为一个聚焦的 **Skill** —— 用 Markdown 或 TypeScript —— 让框架自动把用户请求路由到最合适的那个。\n\n## 安装\n\n```bash\nnpm install @agenticforge/skills\n```\n\n---\n\n## 什么是 Skill？\n\nSkill 是一个具名、自包含的能力单元。把它想象成一个专家，你的 Agent 可以把具体问题委托给他：\n\n- 一个**天气 Skill**，只处理天气相关问题\n- 一个**代码审查 Skill**，专门评审 TypeScript 代码\n- 一个**股票查询 Skill**，查询实时行情数据\n\n每个 Skill 拥有自己的系统提示词、工具集和执行逻辑。用户请求到来时，框架自动路由到最匹配的 Skill。\n\n---\n\n## 定义 Skill\n\n### 方式 1 — Markdown（大多数场景推荐）\n\n创建一个 `SKILL.md` 文件。frontmatter 定义路由元数据，正文成为系统提示词。\n\n```markdown\n---\nname: code-reviewer\ndescription: 审查 TypeScript 和 JavaScript 代码，发现 Bug、类型安全问题和性能隐患。\ntriggerHint: 当用户要求审查、检查或改善代码质量时\n---\n\n# 代码审查员\n\n你是一位资深 TypeScript 工程师，正在进行严格的代码审查。\n优先关注正确性，其次是性能，最后是代码风格。\n\n## 审查清单\n- 类型安全：无隐式 `any`，返回值类型明确\n- 错误处理：无未处理的 Promise rejection\n- 边界条件：null/undefined、空数组\n\n## 输出格式\n1. **总体评价** — 一句话总结\n2. **问题列表** — 每条包含严重程度和修复建议\n3. **改进后的代码** — 重写有问题的部分\n```\n\n加载并运行：\n\n```ts\nimport { SkillLoader, SkillRunner } from \"@agenticforge/skills\";\n\nconst skills = await SkillLoader.fromDirectory(\"./skills\");\nconst runner = new SkillRunner({ llm, skills });\n\nconst result = await runner.run(\n  \"帮我审查这个函数：async function fetchUser(id) { return fetch('/api/' + id).then(r => r.json()); }\"\n);\nconsole.log(result.output);\n```\n\n### 方式 2 — TypeScript 类\n\n```ts\nimport { AgentSkill } from \"@agenticforge/skills\";\nimport type { SkillContext, SkillResult } from \"@agenticforge/skills\";\nimport type { LLMClient } from \"@agenticforge/core\";\n\nclass StockSkill extends AgentSkill {\n  constructor() {\n    super({\n      name: \"stock-query\",\n      description: \"查询任意股票代码的实时价格和市场数据。\",\n      triggerHint: \"当用户询问股票价格、市值、代码或交易数据时\",\n    });\n  }\n\n  override async execute(ctx: SkillContext, llm: LLMClient): Promise<SkillResult> {\n    const price = await fetchStockPrice(extractTicker(ctx.query));\n    const output = await llm.think([\n      { role: \"system\", content: \"用简洁友好的语言格式化股票数据。\" },\n      { role: \"user\",   content: `行情数据：${JSON.stringify(price)}\\n问题：${ctx.query}` },\n    ]);\n    return { output };\n  }\n}\n```\n\n简单场景直接实例化，无需继承：\n\n```ts\nconst translatorSkill = new AgentSkill({\n  name: \"translator\",\n  description: \"在任意两种语言之间翻译文本。\",\n  triggerHint: \"当用户想翻译文本，或问某个词在另一种语言中怎么说时\",\n  systemPrompt: \"你是专业翻译。只输出翻译结果，不附加任何解释。\",\n});\n```\n\n---\n\n## 多 Skill 自动路由\n\n`SkillRunner`（和 `SkillAgent`）使用**两级路由策略**：\n\n| 级别 | 工作方式 | LLM 调用次数 |\n|------|---------|-------------|\n| **规则路由**（优先） | 将 `triggerHint` 关键词与 query 匹配 | 0 |\n| **LLM 路由**（兜底） | 把所有 Skill 描述发给 LLM 做意图分类 | 1 |\n\n```ts\nconst runner = new SkillRunner({\n  llm,\n  skills: [...skills, new StockSkill(), new CalendarSkill()],\n  fallbackPrompt: \"你是一个通用助理。\",\n});\n\nawait runner.run(\"明天柏林天气如何？\");         // => 天气 Skill（规则路由命中）\nawait runner.run(\"帮我审查一下这段 TS 代码。\");  // => code-reviewer Skill\nawait runner.run(\"特斯拉现在股价多少？\");        // => StockSkill\nawait runner.run(\"帮我约一个周五下午三点的会。\"); // => CalendarSkill\n\n// 跳过路由，直接调用指定 Skill\nawait runner.runSkill(\"stock-query\", \"AAPL 和 MSFT 本周走势对比\");\n```\n\n---\n\n## 进阶：SkillDispatcher\n\n```ts\nimport { SkillDispatcher, SkillRegistry } from \"@agenticforge/skills\";\n\nconst registry = new SkillRegistry();\nregistry.register(weatherSkill);\nregistry.register(stockSkill);\n\nconst dispatcher = new SkillDispatcher(registry, llm);\nconst skill = await dispatcher.dispatch(\"东京明天下雨吗？\");\nif (skill) {\n  const result = await skill.execute({ query }, llm);\n}\n```\n\n---\n\n## API 参考\n\n### `SkillRunner`\n\n| 方法 | 说明 |\n|------|------|\n| `run(query, options?)` | 路由并执行最匹配的 Skill |\n| `runSkill(name, query, options?)` | 直接执行指定 Skill（跳过路由）|\n| `addSkill(skill)` | 运行时注册 Skill |\n| `removeSkill(name)` | 注销 Skill |\n| `listSkills()` | 列出所有已注册 Skill 名称 |\n\n### `AgentSkill`\n\n| 成员 | 说明 |\n|------|------|\n| `name` | 唯一标识 |\n| `description` | 一句话描述，LLM 路由读取此字段 |\n| `triggerHint` | 规则路由关键词（逗号分隔）|\n| `systemPrompt` | 执行时注入的系统提示词 |\n| `tools` | 该 Skill 专属工具集 |\n| `execute(ctx, llm)` | Override 实现自定义执行逻辑 |\n\n### `SkillLoader`\n\n| 方法 | 说明 |\n|------|------|\n| `fromDirectory(dir)` | 递归扫描 `SKILL.md` 和 `*.skill.md` |\n| `fromFiles(paths[])` | 从指定路径列表加载 |\n| `fromSources(sources[])` | 从原始字符串解析 |\n| `registryFromDirectory(dir)` | 一步完成扫描 + 封装为 `SkillRegistry` |\n\n### `SkillRegistry`\n\n| 方法 | 说明 |\n|------|------|\n| `register(skill)` | 注册 Skill |\n| `get(name)` | 按名称查找 |\n| `list()` | 所有已注册名称 |\n| `visible()` | 对 LLM 路由器可见的 Skills |\n| `describeAll()` | 生成路由 prompt 用的格式化列表 |\n\n---\n\n## 与 SkillAgent 配合使用\n\n如需有状态的 Agent 体验（对话历史、多轮），使用 `@agenticforge/agents` 中的 `SkillAgent`：\n\n```ts\nimport { SkillAgent } from \"@agenticforge/agents\";\nimport { SkillLoader } from \"@agenticforge/skills\";\n\nconst skills = await SkillLoader.fromDirectory(\"./skills\");\nconst agent = new SkillAgent({ name: \"assistant\", llm, skills });\n\n// 对话历史自动维护\nawait agent.run(\"伦敦今天天气怎么样？\");\nawait agent.run(\"那东京呢？\");       // 知道上一轮在问天气\nawait agent.run(\"哪个城市更暖和？\"); // 继续路由到天气 Skill\n\nagent.clearHistory(); // 会话结束时重置\n```\n\n---\n\n## 链接\n\n- [GitHub](https://github.com/LittleBlacky/AgenticFORGE/tree/main/packages/skills)\n- [npm](https://www.npmjs.com/package/@agenticforge/skills)\n- [主项目 README](https://github.com/LittleBlacky/AgenticFORGE)\n","readmeFilename":"README.zh_CN.md"}